TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Describes the index structure of data stored for several indices. More...
#include <IndexDescriptor.h>
Public Types | |
enum | Format { None, Ranges, Custom, Dynamic } |
Public Types inherited from TBTK::Serializable | |
enum | Mode { Debug, Binary, XML, JSON } |
Public Member Functions | |
IndexDescriptor () | |
IndexDescriptor (const std::vector< int > &ranges) | |
IndexDescriptor (const IndexTree &indexTree) | |
IndexDescriptor (const IndexDescriptor &indexDescriptor) | |
IndexDescriptor (IndexDescriptor &&indexDescriptor) | |
IndexDescriptor (const std::string &serialization, Mode mode) | |
~IndexDescriptor () | |
IndexDescriptor & | operator= (const IndexDescriptor &rhs) |
IndexDescriptor & | operator= (IndexDescriptor &&rhs) |
Format | getFormat () const |
std::vector< int > | getRanges () const |
const IndexTree & | getIndexTree () const |
void | add (const Index &index) |
int | getLinearIndex (const Index &index, bool returnNegativeForMissingIndex=false) const |
unsigned int | getSize () const |
bool | contains (const Index &index) const |
virtual std::string | serialize (Mode mode) 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) |
Friends | |
bool | operator== (const IndexDescriptor &lhs, const IndexDescriptor &rhs) |
bool | operator!= (const IndexDescriptor &lhs, const IndexDescriptor &rhs) |
Additional Inherited Members | |
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) |
Describes the index structure of data stored for several indices.
The IndexDescriptor is a helper class for the AbstractProperty to help handle the storage of data using different type of indexing. See AbstractProperty for a description of the various formats.
|
strong |
Enum class determining the storage format.
TBTK::IndexDescriptor::IndexDescriptor | ( | ) |
Constructs an IndexDescriptor on the Format::None.
TBTK::IndexDescriptor::IndexDescriptor | ( | const std::vector< int > & | ranges | ) |
Constructs an IndexDescriptor on the Format::Ranges.
ranges | The upper limits (exlcusive) of the grid described by the IndexDescriptor. |
TBTK::IndexDescriptor::IndexDescriptor | ( | const IndexTree & | indexTree | ) |
Constructs an IndexDescriptor on the Format::Custom.
indexTree | An IndexTree containing all the Indices that should be described by the IndexDescriptor. |
TBTK::IndexDescriptor::IndexDescriptor | ( | const IndexDescriptor & | indexDescriptor | ) |
Copy constructor.
indexDescriptor | IndexDescriptor to copy. |
TBTK::IndexDescriptor::IndexDescriptor | ( | IndexDescriptor && | indexDescriptor | ) |
Move constructor.
indexDescriptor | IndexDescriptor to move. |
TBTK::IndexDescriptor::IndexDescriptor | ( | const std::string & | serialization, |
Mode | mode | ||
) |
Constructor. Construct the IndexDescriptor from a serialization string.
serialization | Serialization string from which to construct the IndexDescriptor. |
mode | Mode with which the string has been serialized. |
TBTK::IndexDescriptor::~IndexDescriptor | ( | ) |
Destructor.
|
inline |
|
inline |
Check whether a given Index is contained in the IndexDescriptor. [Only works for the Custom and Dynamic formats.]
|
inline |
Get format.
|
inline |
Get IndexTree. [Only works for the Custom format.]
|
inline |
Get linear index. [Only works for the Custom and Dynamic formats.]
index | The Index to get the linear Index for. |
returnNegativeForMissingIndex | If set to true, requesting an Index that is not included results in -1 being returned. If set to false, an IndexException will be thrown in the same situation. |
|
inline |
Get ranges. [Only works for the Ranges format.]
unsigned int TBTK::IndexDescriptor::getSize | ( | ) | const |
Get the number of data elements described by the IndexDescriptor. For Format::None this is equal to 1, while for the other formats this is equal to the number of Indices that are described by the IndexDescriptor.
IndexDescriptor& TBTK::IndexDescriptor::operator= | ( | const IndexDescriptor & | rhs | ) |
Assignment operator.
rhs | IndexDescriptor to assign to the left hand side. |
IndexDescriptor& TBTK::IndexDescriptor::operator= | ( | IndexDescriptor && | rhs | ) |
Move assignment operator.
rhs | IndexDescriptor to assign to the left hand side. |
|
virtual |
Implements Serializable::serialize().
Implements TBTK::Serializable.
|
friend |
Inequality operator.
rhs | Left hand side of the inequality sign. |
rhs | Right hand side of the inequality sign. |
|
friend |
Comparison operator.
rhs | Left hand side of the equality sign. |
rhs | Right hand side of the equality sign. |