![]() |
TBTK
|
Need a break? Support the development by playing Polarity Puzzles![]() |
Public Types | |
enum | Mode { Debug, Binary, XML, JSON } |
Public Member Functions | |
virtual std::string | serialize (Mode mode) const =0 |
template<> | |
std::string | serialize (const bool &data, Mode mode) |
template<> | |
std::string | serialize (const double &data, Mode mode) |
template<> | |
std::string | serialize (const std::complex< double > &data, Mode mode) |
template<> | |
std::string | serialize (const int &data, Mode mode) |
template<> | |
std::string | serialize (const unsigned int &data, Mode mode) |
template<> | |
std::string | serialize (const SpinMatrix &data, Mode mode) |
template<> | |
std::string | serialize (const Statistics &data, Mode mode) |
template<> | |
std::string | serialize (const std::vector< std::complex< double >> &data, Mode mode) |
template<> | |
int | deserialize (const std::string &serialization, Mode mode) |
template<> | |
unsigned int | deserialize (const std::string &serialization, Mode mode) |
template<> | |
double | deserialize (const std::string &serialization, Mode mode) |
template<> | |
std::complex< double > | deserialize (const std::string &serialization, Mode mode) |
template<> | |
SpinMatrix | deserialize (const std::string &serialization, Mode mode) |
template<> | |
Statistics | deserialize (const std::string &serialization, Mode mode) |
template<> | |
std::vector< std::complex< double > > | deserialize (const std::string &serialization, Mode mode) |
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) |
template<typename DataType > | |
static std::enable_if<!std::is_pointer< DataType >::value, std::string >::type | serialize (const DataType &data, Mode mode) |
template<typename DataType > | |
static std::enable_if< std::is_pointer< DataType >::value, std::string >::type | serialize (const DataType &data, Mode mode) |
template<typename DataType > | |
static DataType | deserialize (const std::string &serialization, Mode mode) |
static std::string | extract (const std::string &serialization, Mode mode, std::string component) |
Friends | |
class | Index |
class | HoppingAmplitude |
class | SourceAmplitude |
class | OverlapAmplitude |
template<typename DataType > | |
class | CArray |
|
strong |
Serialization modes. Note that debug is not guaranteed to be backward compatible.
|
staticprotected |
Deserialize.
serialization | The serialization from which the data is to be deserialized. |
mode | The mode with which the data has been serialized. |
|
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 |
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.
containerID | ID for the container (child class). |
componentID | ID for the component (parent class). |
componentName | Name used to refer to the parent object. Only used in some modes. |
mode | Mode with which the string has been serialized. |
|
staticprotected |
Get the content of a serializtion string.
|
static |
Get the ID of a serialization string.
|
static |
Returns true if the serialization string has an ID.
|
pure virtual |
Serialize object.
Implemented in TBTK::Array< DataType >, TBTK::Array< double >, TBTK::HoppingAmplitudeTree, TBTK::HoppingAmplitudeSet, TBTK::Property::AbstractProperty< DataType >, TBTK::Property::AbstractProperty< SpinMatrix >, TBTK::Property::AbstractProperty< double >, TBTK::Property::AbstractProperty< std::complex< double > >, TBTK::Property::EnergyResolvedProperty< DataType >, TBTK::Property::EnergyResolvedProperty< SpinMatrix >, TBTK::Property::EnergyResolvedProperty< double >, TBTK::Property::EnergyResolvedProperty< std::complex< double > >, TBTK::IndexTree, TBTK::Model, TBTK::SourceAmplitudeSet, TBTK::OverlapAmplitudeSet, TBTK::Property::LDOS, TBTK::IndexDescriptor, TBTK::Property::Density, TBTK::Property::DOS, TBTK::SingleParticleContext, TBTK::Property::SpinPolarizedLDOS, TBTK::Property::EigenValues, TBTK::Property::WaveFunctions, TBTK::SourceAmplitude, TBTK::IndexedDataTree< Data >, TBTK::IndexedDataTree< unsigned int >, TBTK::IndexedDataTree< SerializableVector< TBTK::SourceAmplitude > >, TBTK::IndexedDataTree< TBTK::OverlapAmplitude >, TBTK::IndexedDataTree< SerializableVector< double > >, TBTK::BoundaryCondition, TBTK::Range, TBTK::Property::Magnetization, TBTK::Geometry, TBTK::HoppingAmplitudeList, and TBTK::AnnotatedArray< DataType, AxesType >.
|
staticprotected |
Serialize.
data | The data to serialize. |
mode | The mode with which to serialize the data. |
|
staticprotected |
Split content string.
|
staticprotected |
Validate serialization string.
|
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).