46 std::string
id()
const;
74 template<
typename VectorType>
87 std::string oldTimeName = fieldDoc.
field<VectorType>().
name +
"_0";
88 VectorType& oldVector =
91 .field = fieldDoc.
field<VectorType>(),
97 setCurrentVectorAndLevel(oldTimeDocument);
102 template<
typename VectorType>
103 const VectorType&
get(std::string idOfNextVector)
const
135 std::string fieldCollectionName_;
146template<
typename VectorType>
151 return oldTimeCollection.
getOrInsert<VectorType>(field.key);
162template<
typename VectorType>
163const VectorType&
oldTime(
const VectorType& field)
167 return oldTimeCollection.
get<VectorType>(field.key);
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.
VectorType & oldTime(VectorType &field)
Retrieves the old time field of a given field.