ElementData.cc 729 Bytes
Newer Older
1
2
3
4
#include "ElementData.h"

namespace AMDiS {

Thomas Witkowski's avatar
Thomas Witkowski committed
5
6
  void ElementData::serialize(std::ostream& out) {
    std::string decoratedType;
7
    if (decorated_) {
8
      decoratedType = decorated_->getTypeName();
Thomas Witkowski's avatar
Thomas Witkowski committed
9
      out << decoratedType << "\n";
10
11
      decorated_->serialize(out);
    } else {
Thomas Witkowski's avatar
Thomas Witkowski committed
12
      out << "NULL\n";
13
14
15
    }
  }

Thomas Witkowski's avatar
Thomas Witkowski committed
16
  void ElementData::deserialize(std::istream& in) {
17
18
    TEST_EXIT(decorated_ == NULL)
      ("there are already decorated element data\n");
Thomas Witkowski's avatar
Thomas Witkowski committed
19
    std::string decoratedType;
20
21
    in >> decoratedType; 
    in.get();
22
    if (decoratedType != "NULL") {
23
24
25
26
27
28
29
30
      decorated_ = CreatorMap<ElementData>::getCreator(decoratedType)->create();
      decorated_->deserialize(in);
    } else {
      decorated_ = NULL;
    };
  }

}