Inviwo  0.9.10.1
Inviwo documentation
inviwo::Serializer Class Reference
+ Inheritance diagram for inviwo::Serializer:

Public Member Functions

 Serializer (const std::string &fileName, bool allowReference=true)
 Initializes serializer with a file name that will be used to set relative paths to data. The specified file name will not be used to write any content until writeFile() is called. More...
 
virtual void writeFile ()
 Writes serialized data to the file specified by the currently set file name. More...
 
virtual void writeFile (std::ostream &stream, bool format=false)
 Writes serialized data to stream. More...
 
template<typename T >
void serialize (const std::string &key, const std::vector< T > &sVector, const std::string &itemKey="item")
 
template<typename T >
void serialize (const std::string &key, const std::unordered_set< T > &sSet, const std::string &itemKey="item")
 
template<typename T >
void serialize (const std::string &key, const std::list< T > &container, const std::string &itemKey="item")
 
template<typename K , typename V , typename C , typename A >
void serialize (const std::string &key, const std::map< K, V, C, A > &map, const std::string &itemKey="item")
 
template<typename K , typename V , typename H , typename C , typename A >
void serialize (const std::string &key, const std::unordered_map< K, V, H, C, A > &map, const std::string &itemKey="item")
 
void serialize (const std::string &key, const signed char &data, const SerializationTarget &target=SerializationTarget::Node)
 
void serialize (const std::string &key, const char &data, const SerializationTarget &target=SerializationTarget::Node)
 
void serialize (const std::string &key, const unsigned char &data, const SerializationTarget &target=SerializationTarget::Node)
 
template<typename T , typename std::enable_if< std::is_integral< T >::value||util::is_floating_point< T >::value||util::is_string< T >::value, int >::type = 0>
void serialize (const std::string &key, const T &data, const SerializationTarget &target=SerializationTarget::Node)
 
template<typename T , typename std::enable_if< std::is_enum< T >::value, int >::type = 0>
void serialize (const std::string &key, const T &data, const SerializationTarget &target=SerializationTarget::Node)
 
template<typename T >
void serialize (const std::string &key, const flags::flags< T > &data, const SerializationTarget &target=SerializationTarget::Node)
 
template<typename Vec , typename std::enable_if< util::rank< Vec >::value==1, int >::type = 0>
void serialize (const std::string &key, const Vec &data)
 
template<typename Mat , typename std::enable_if< util::rank< Mat >::value==2, int >::type = 0>
void serialize (const std::string &key, const Mat &data)
 
template<unsigned N>
void serialize (const std::string &key, const std::bitset< N > &bits)
 
void serialize (const std::string &key, const Serializable &sObj)
 
template<class T >
void serialize (const std::string &key, const T *const &data)
 
template<class T , class D >
void serialize (const std::string &key, const std::unique_ptr< T, D > &data)
 
- Public Member Functions inherited from inviwo::SerializeBase
 SerializeBase (bool allowReference=true)
 Base class for Serializer and Deserializer. More...
 
 SerializeBase (std::string fileName, bool allowReference=true)
 Base class for Serializer and Deserializer. More...
 
 SerializeBase (std::istream &stream, const std::string &path, bool allowReference=true)
 Base class for Serializer and Deserializer. More...
 
 SerializeBase (const SerializeBase &rhs)=delete
 
 SerializeBase (SerializeBase &&rhs)=default
 
SerializeBaseoperator= (const SerializeBase &)=delete
 
SerializeBaseoperator= (SerializeBase &&)=default
 
virtual const std::string & getFileName () const
 gets the xml file name.
 
bool isPrimitiveType (const std::type_info &type) const
 Checks whether the given type is a primitive type. More...
 

Friends

class NodeSwitch
 

Additional Inherited Members

- Public Types inherited from inviwo::SerializeBase
using RefDataPair = std::pair< const void *, SerializeBase::ReferenceData >
 
using RefMap = std::multimap< const void *, ReferenceData >
 
- Static Public Member Functions inherited from inviwo::SerializeBase
static std::string nodeToString (const TxElement &node)
 
- Protected Attributes inherited from inviwo::SerializeBase
std::string fileName_
 
TxDocument doc_
 
TxElement * rootElement_
 
bool allowRef_
 
bool retrieveChild_
 
ReferenceDataContainer refDataContainer_
 

Constructor & Destructor Documentation

◆ Serializer()

inviwo::Serializer::Serializer ( const std::string &  fileName,
bool  allowReference = true 
)

Initializes serializer with a file name that will be used to set relative paths to data. The specified file name will not be used to write any content until writeFile() is called.

Parameters
fileNamefull path to xml file.
allowReferencedisables or enables reference management schemes.
Exceptions
SerializationException

Member Function Documentation

◆ writeFile() [1/2]

void inviwo::Serializer::writeFile ( )
virtual

Writes serialized data to the file specified by the currently set file name.

Note
File name needs to be set before calling this method.
Exceptions
SerializationException

◆ writeFile() [2/2]

void inviwo::Serializer::writeFile ( std::ostream &  stream,
bool  format = false 
)
virtual

Writes serialized data to stream.

Parameters
streamStream to be written to.
formatFormat the output, i.e. insert line breaks and tabs.
Exceptions
SerializationException

The documentation for this class was generated from the following files: