TBTK
Need a break? Support the development by playing Polarity Puzzles
TBTK::IndexedDataTree< Data > Class Template Reference
Inheritance diagram for TBTK::IndexedDataTree< Data >:
TBTK::Serializable

Classes

class  ConstIterator
 
class  Iterator
 

Public Member Functions

 IndexedDataTree ()
 
 IndexedDataTree (const std::string &serialization, Mode mode)
 
virtual ~IndexedDataTree ()
 
void add (const Data &data, const Index &index)
 
bool get (Data &data, const Index &index) const
 
Data & get (const Index &index)
 
const Data & get (const Index &index) const
 
void clear ()
 
unsigned int getSizeInBytes () const
 
virtual std::string serialize (Mode mode) const
 
Iterator begin ()
 
ConstIterator begin () const
 
ConstIterator cbegin () const
 
Iterator end ()
 
ConstIterator end () const
 
ConstIterator cend () const
 
- Public Member Functions inherited from TBTK::Serializable
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)
 

Additional Inherited Members

- Public Types inherited from TBTK::Serializable
enum  Mode { Debug, Binary, XML, JSON }
 
- Static Public Member Functions inherited from TBTK::Serializable
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 inherited from TBTK::Serializable
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)
 

Constructor & Destructor Documentation

◆ IndexedDataTree() [1/2]

template<typename Data >
TBTK::IndexedDataTree< Data >::IndexedDataTree ( )

Constructor.

◆ IndexedDataTree() [2/2]

template<typename Data >
TBTK::IndexedDataTree< Data >::IndexedDataTree ( const std::string &  serialization,
Mode  mode 
)
inline

Constructor. Constructs the IndexedDataTree from a serialization string.

Parameters
serializationSerialization string from which to construct the IndexedDataTree.
modeMode with which the string has been serialized.

◆ ~IndexedDataTree()

template<typename Data >
TBTK::IndexedDataTree< Data >::~IndexedDataTree ( )
virtual

Destructor.

Member Function Documentation

◆ add()

template<typename Data>
void TBTK::IndexedDataTree< Data >::add ( const Data &  data,
const Index index 
)

Add indexed data. Multiple calls to the function with the same Index will overwrite previous data.

Parameters
dataData element to add.
indexIndex at which to add the element.

◆ begin() [1/2]

template<typename Data >
IndexedDataTree< Data >::Iterator TBTK::IndexedDataTree< Data >::begin ( )

Create Iterator.

Returns
Iterator pointing at the first element in the IndexedDataTree.

◆ begin() [2/2]

template<typename Data >
IndexedDataTree< Data >::ConstIterator TBTK::IndexedDataTree< Data >::begin ( ) const

Create ConstIterator.

Returns
ConstIterator pointing at the first element in the IndexedDataTree.

◆ cbegin()

template<typename Data >
IndexedDataTree< Data >::ConstIterator TBTK::IndexedDataTree< Data >::cbegin ( ) const

Create ConstIterator.

Returns
ConstIterator pointing at the first element in the IndexedDataTree.

◆ cend()

template<typename Data >
IndexedDataTree< Data >::ConstIterator TBTK::IndexedDataTree< Data >::cend ( ) const

Get ConstIterator that points to the end.

Returns
A ConstIterator pointing at the end of the IndexedDataTree.

◆ clear()

template<typename Data >
void TBTK::IndexedDataTree< Data >::clear ( )

Clear the data.

◆ end() [1/2]

template<typename Data >
IndexedDataTree< Data >::Iterator TBTK::IndexedDataTree< Data >::end ( )

Get Iterator pointing to the end.

Returns
An Iterator pointing at the end of the IndexedDataTree.

◆ end() [2/2]

template<typename Data >
IndexedDataTree< Data >::ConstIterator TBTK::IndexedDataTree< Data >::end ( ) const

Get ConstIterator pointing to the end.

Returns
A ConstIterator pointing at the end of the IndexedDataTree.

◆ get() [1/3]

template<typename Data>
bool TBTK::IndexedDataTree< Data >::get ( Data &  data,
const Index index 
) const

Get data.

Parameters
dataReference to an object that the data will be written to.
indexIndex for which to extract the data for.
Returns
True if a data element was found, otherwise false.

◆ get() [2/3]

template<typename Data>
Data & TBTK::IndexedDataTree< Data >::get ( const Index index)

Get data.

Parameters
indexIndex for which to extract the data for.
Returns
Reference to the element.
Exceptions
ElementNotFoundExceptionIf the no element with the requested Index exists.

◆ get() [3/3]

template<typename Data>
const Data & TBTK::IndexedDataTree< Data >::get ( const Index index) const

Get data.

Parameters
indexIndex for which to extract the data for.
Returns
Reference to the element.
Exceptions
ElementNotFoundExceptionIf the no element with the requested Index exists.

◆ getSizeInBytes()

template<typename Data >
unsigned int TBTK::IndexedDataTree< Data >::getSizeInBytes ( ) const

Get size in bytes.

Returns
Memory size required to store the IndexedDataTree.

◆ serialize()

template<typename Data >
std::string TBTK::IndexedDataTree< Data >::serialize ( Mode  mode) const
inlinevirtual

Serilaize.

Parameters
modeSerialization mode to use.
Returns
Serialized string representation of the IndexedDataTree.

Implements TBTK::Serializable.


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