TBTK
TBTK::Serializable Class Referenceabstract
Inheritance diagram for TBTK::Serializable:
TBTK::Property::AbstractProperty< DataType > TBTK::Property::AbstractProperty< double > TBTK::Property::AbstractProperty< SpinMatrix > TBTK::Property::AbstractProperty< std::complex< double > > TBTK::IndexedDataTree< SerializeableVector< std::complex< double > > > TBTK::IndexedDataTree< std::vector< std::complex< double > > > TBTK::IndexedDataTree< std::vector< TBTK::SourceAmplitude > > TBTK::IndexedDataTree< TBTK::SerializableVector< std::complex< double > > > TBTK::IndexedDataTree< unsigned int > TBTK::SerializableVector< std::complex< double > > TBTK::BoundaryCondition TBTK::DataManager TBTK::Geometry TBTK::HoppingAmplitudeList TBTK::HoppingAmplitudeSet TBTK::HoppingAmplitudeTree TBTK::IndexDescriptor TBTK::IndexedDataTree< Data, isSerializeable > TBTK::IndexedDataTree< Data, false > TBTK::IndexedDataTree< Data, true > TBTK::IndexTree TBTK::Model TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable > TBTK::Range TBTK::SerializableVector< DataType, bool > TBTK::SerializableVector< DataType, false > TBTK::SerializableVector< DataType, true > TBTK::SingleParticleContext TBTK::SourceAmplitudeSet

Public Types

enum  Mode { Debug, Binary, XML, JSON }
 

Public Member Functions

virtual std::string serialize (Mode mode) const =0
 

Static Public Member Functions

static bool hasID (const std::string &serialization, Mode mode)
 
static std::string getID (const std::string &serialization, Mode mode)
 
static std::string extractComponent (const std::string &serialization, const std::string &containerID, const std::string &componentID, const std::string &componentName, Mode mode)
 

Static Protected Member Functions

static bool validate (const std::string &serialization, const std::string &id, Mode mode)
 
static std::string getContent (const std::string &serialization, Mode mode)
 
static std::vector< std::string > split (const std::string &content, Mode mode)
 
static std::string serialize (bool b, Mode mode)
 
static void deserialize (const std::string &serialization, bool *b, Mode mode)
 
static std::string serialize (int i, Mode mode)
 
static void deserialize (const std::string &serialization, int *i, Mode mode)
 
static std::string serialize (unsigned int u, Mode mode)
 
static void deserialize (const std::string &serialization, unsigned int *u, Mode mode)
 
static std::string serialize (double d, Mode mode)
 
static void deserialize (const std::string &serialization, double *d, Mode mode)
 
static std::string serialize (std::complex< double > c, Mode mode)
 
static void deserialize (const std::string &serialization, std::complex< double > *c, Mode mode)
 
static std::string serialize (Statistics s, Mode mode)
 
static void deserialize (const std::string &serialization, Statistics *s, Mode mode)
 
static std::string extract (const std::string &serialization, Mode mode, std::string component)
 

Friends

class Index
 
class HoppingAmplitude
 
class SourceAmplitude
 

Member Enumeration Documentation

Serialization modes. Note that debug is not guaranteed to be backward compatible.

Member Function Documentation

void TBTK::Serializable::deserialize ( const std::string &  serialization,
bool *  b,
Mode  mode 
)
inlinestaticprotected

Deserialize bool.

void TBTK::Serializable::deserialize ( const std::string &  serialization,
int *  i,
Mode  mode 
)
inlinestaticprotected

Deserialize int.

void TBTK::Serializable::deserialize ( const std::string &  serialization,
unsigned int *  u,
Mode  mode 
)
inlinestaticprotected

Deserialize unsigned int.

void TBTK::Serializable::deserialize ( const std::string &  serialization,
double *  d,
Mode  mode 
)
inlinestaticprotected

Deserialize double.

void TBTK::Serializable::deserialize ( const std::string &  serialization,
std::complex< double > *  c,
Mode  mode 
)
inlinestaticprotected

Deserialize complex<double>.

void TBTK::Serializable::deserialize ( const std::string &  serialization,
Statistics s,
Mode  mode 
)
inlinestaticprotected

Deserialize Statistics.

static std::string TBTK::Serializable::extract ( const std::string &  serialization,
Mode  mode,
std::string  component 
)
staticprotected

Extracts a component of a serialization string, catching potential errors. In particular used to extract the serialization string for parents in the constructor of a child, because no try-catch block is possible to insert at this point.

static std::string TBTK::Serializable::extractComponent ( const std::string &  serialization,
const std::string &  containerID,
const std::string &  componentID,
const std::string &  componentName,
Mode  mode 
)
static

Extract a component from a container serialization. When serializing classes, their parent are embedded inside the child class serialization. I.e. the parent class is a component contained in the child class serialization. However, when reconstructing a serialized class, its parent constructor has to be called before the child class is constructed. This function provides the means to extract the serialization of a parent class from the serialization of a child class.

Parameters
containerIDID for the container (child class).
componentIDID for the component (parent class).
componentNameName used to refer to the parent object. Only used in some modes.
modeMode with which the string has been serialized.
Returns
The serialization string for the component.
static std::string TBTK::Serializable::getContent ( const std::string &  serialization,
Mode  mode 
)
staticprotected

Get the content of a serializtion string.

static std::string TBTK::Serializable::getID ( const std::string &  serialization,
Mode  mode 
)
static

Get the ID of a serialization string.

static bool TBTK::Serializable::hasID ( const std::string &  serialization,
Mode  mode 
)
static

Returns true if the serialization string has an ID.

virtual std::string TBTK::Serializable::serialize ( Mode  mode) const
pure virtual

Serialize object.

Implemented in TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::IndexedDataTree< Data, false >, TBTK::HoppingAmplitudeSet, TBTK::HoppingAmplitudeTree, TBTK::IndexTree, TBTK::IndexedDataTree< Data, true >, TBTK::Property::AbstractProperty< DataType, isFundamental, isSerializable >, TBTK::Property::AbstractProperty< SpinMatrix >, TBTK::Property::AbstractProperty< double >, TBTK::Property::AbstractProperty< std::complex< double > >, TBTK::Property::AbstractProperty< DataType >, TBTK::Model, TBTK::SourceAmplitudeSet, TBTK::Property::EnergyResolvedProperty< DataType >, TBTK::Property::EnergyResolvedProperty< std::complex< double > >, TBTK::IndexDescriptor, TBTK::Property::SpinPolarizedLDOS, TBTK::Property::LDOS, TBTK::Property::WaveFunctions, TBTK::Geometry, TBTK::DataManager, TBTK::Property::Susceptibility, TBTK::SingleParticleContext, TBTK::IndexedDataTree< Data, isSerializeable >, TBTK::IndexedDataTree< SerializeableVector< std::complex< double > > >, TBTK::IndexedDataTree< std::vector< std::complex< double > > >, TBTK::IndexedDataTree< unsigned int >, TBTK::IndexedDataTree< std::vector< TBTK::SourceAmplitude > >, TBTK::IndexedDataTree< TBTK::SerializableVector< std::complex< double > > >, TBTK::BoundaryCondition, TBTK::Property::Magnetization, TBTK::Property::Density, TBTK::SerializableVector< DataType, false >, TBTK::Property::DOS, TBTK::Property::SpectralFunction, TBTK::HoppingAmplitudeList, TBTK::SerializableVector< DataType, true >, TBTK::Property::EigenValues, TBTK::Range, TBTK::SerializableVector< DataType, bool >, and TBTK::SerializableVector< std::complex< double > >.

std::string TBTK::Serializable::serialize ( bool  b,
Mode  mode 
)
inlinestaticprotected

Serialize bool.

std::string TBTK::Serializable::serialize ( int  i,
Mode  mode 
)
inlinestaticprotected

Serialize int.

std::string TBTK::Serializable::serialize ( unsigned int  u,
Mode  mode 
)
inlinestaticprotected

Serialize unsigned int.

std::string TBTK::Serializable::serialize ( double  d,
Mode  mode 
)
inlinestaticprotected

Serialize double.

std::string TBTK::Serializable::serialize ( std::complex< double >  c,
Mode  mode 
)
inlinestaticprotected

Serialize complex<double>.

std::string TBTK::Serializable::serialize ( Statistics  s,
Mode  mode 
)
inlinestaticprotected

Serialize Statistics.

static std::vector<std::string> TBTK::Serializable::split ( const std::string &  content,
Mode  mode 
)
staticprotected

Split content string.

static bool TBTK::Serializable::validate ( const std::string &  serialization,
const std::string &  id,
Mode  mode 
)
staticprotected

Validate serialization string.

Friends And Related Function Documentation

friend class Index
friend

Friend classes (Classes that are psudo-Serializable because they are so small and often used that a virtual function would have a non-negligible performance penalty).


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