20#if defined(__GNUC__) or defined(__llvm__)
21#pragma GCC diagnostic push
22#pragma GCC diagnostic ignored "-Wdangling-reference"
55 std::string
id()
const;
83 template<
typename VectorType>
96 std::string oldTimeName = fieldDoc.
field<VectorType>().
name +
"_0";
97 VectorType& oldVector =
100 .field = fieldDoc.
field<VectorType>(),
106 setCurrentVectorAndLevel(oldTimeDocument);
111 template<
typename VectorType>
112 const VectorType&
get(std::string idOfNextVector)
const
147 std::string fieldCollectionName_;
158template<
typename VectorType>
163 return oldTimeCollection.
getOrInsert<VectorType>(field.key);
174template<
typename VectorType>
175const VectorType&
oldTime(
const VectorType& field)
179 return oldTimeCollection.
get<VectorType>(field.key);
188template<
typename VectorType>
195 std::string currentId = field.key;
199 std::string nextId = oldTimeCollection.findNextTime(currentId);
206 currentId = oldTimeCollection.oldTimeDoc(nextId).previousTime();
244template<
typename VectorType>
249#if defined(__GNUC__) or defined(__llvm__)
250#pragma GCC diagnostic pop
A mixin class for collection of documents in a database to simplify the implementation of common oper...
const std::string & name() const
Gets the name of the collection.
const NeoN::Database & db() const
Gets a const reference to the database.
A class representing a document in a database.
Creates a VectorDocument from an existing field.
static const OldTimeCollection & instance(const VectorCollection &fieldCollection)
static const OldTimeCollection & instance(const Database &db, std::string name)
static OldTimeCollection & instance(Database &db, std::string name, std::string fieldCollectionName)
std::string findNextTime(std::string id) const
VectorType & getOrInsert(std::string idOfNextVector)
std::string findPreviousTime(std::string id) const
const VectorType & get(std::string idOfNextVector) const
OldTimeCollection(Database &db, std::string name, std::string fieldCollectionName)
OldTimeDocument & oldTimeDoc(const std::string &id)
bool insert(const OldTimeDocument &cc)
static OldTimeCollection & instance(VectorCollection &fieldCollection)
bool contains(const std::string &id) const
const OldTimeDocument & oldTimeDoc(const std::string &id) const
const std::string & previousTime() const
OldTimeDocument(const Document &doc)
const std::string & currentTime() const
OldTimeDocument(std::string nextTime, std::string previousTime, std::string currentTime, int32_t level)
const Document & doc() const
static std::string typeName()
const int32_t & level() const
std::string & previousTime()
std::string & currentTime()
const std::string & nextTime() const
A class representing a collection of field documents in a database.
VectorType & registerVector(CreateFunction createFunc)
Registers a field in the collection.
VectorDocument & fieldDoc(const std::string &id)
Retrieves a field document by its ID.
static VectorCollection & instance(NeoN::Database &db, std::string name)
Retrieves the instance of the VectorCollection with the given name.
A class representing a field document in a database.
std::int64_t subCycleIndex() const
Retrieves the sub-cycle index of the field.
std::int64_t timeIndex() const
Retrieves the time index of the field.
std::int64_t iterationIndex() const
Retrieves the iteration index of the field.
VectorType & field()
Retrieves the field from the document.
#define NF_ERROR_EXIT(message)
Macro for printing an error message and aborting the program.
int oldTimeLevel(const VectorType &field)
Helper function to retrieve the history depth of a field in oldTimeCollection.
void rotateOldTimes(VectorType &field)
Rotate time levels for a field. Meaning of level (computed via oldTimeLevel(field)): level == 0 : no ...
VectorType & oldTime(VectorType &field)
Retrieves the old time field of a given field.