5 #include "ContentOfDataFlow.hxx"
6 #include "ConversionException.hxx"
15 * Manage Data exchanged through dataflow pipe between 2 nodes. This class minimizes duplications of data.
16 * WARNING : Data has a type defined on constructor or after having called edSetNewType method.
17 * All the methods that change the content of data check the validity regarding _edType attribute.
24 ContentOfDataFlow::Type _exContent;
25 static const char Data::UNRECOGNIZEDTYPENAME[];
27 Data(DynType typeOfContent);
28 Data(const std::string& content, DynType typeOfContent) throw(Exception);
31 Data(const Data& other);
33 Data &operator =(const Data& other) throw(ConversionException);
35 Data &operator =(T val) throw(ConversionException);
36 std::string edGetRepresentation() const;
37 void edSetNewType(DynType newTypeOfContent) throw(ConversionException);
38 void exSetContent(const std::string& content) throw(ConversionException);
40 T exGet() const throw(ConversionException);
41 void edInitToType(DynType typeOfContent);
43 DynType edGetType() const { return _edType; }
44 static std::string edGetTypeInPrintableForm(DynType type);
45 bool isStaticallyCompatibleWith(const Data& other) const throw(Exception);
46 static bool areStaticallyCompatible(DynType type1, DynType type2) throw(Exception);
53 _edType=TypeDescriptorTraitsInv<T>::_typeEnum;
54 _exContent=ContentOfDataFlow::createNewContent(val);
58 Data &Data::operator =(T val) throw(ConversionException)
60 ContentOfDataFlow::release(_exContent);
61 typename ContentOfDataFlow::Type content=ContentOfDataFlow::createNewContent(val);
62 if(_edType==TypeDescriptorTraitsInv<T>::_typeEnum)
68 _exContent=ContentOfDataFlow::convertContent(content,TypeDescriptorTraitsInv<T>::_typeEnum,_edType);
69 ContentOfDataFlow::release(content);
75 T Data::exGet() const throw(ConversionException)
78 ContentOfDataFlow::readContent(_exContent,ret);