ElementData.cc 757 Bytes
Newer Older
1
2
3
4
5
6
#include "ElementData.h"

namespace AMDiS {

  void ElementData::serialize(::std::ostream& out) {
    ::std::string decoratedType;
7
    if (decorated_) {
8
9
10
11
12
13
14
15
16
17
18
19
20
21
      decoratedType = decorated_->getTypeName();
      out << decoratedType << ::std::endl;
      decorated_->serialize(out);
    } else {
      out << "NULL" << ::std::endl;
    }
  }

  void ElementData::deserialize(::std::istream& in) {
    TEST_EXIT(decorated_ == NULL)
      ("there are already decorated element data\n");
    ::std::string decoratedType;
    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;
    };
  }

}