MVault 0.0.1
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Friends | List of all members
mvlt::VaultRecordSet Class Reference

A class for storing query results. More...

#include <VaultRecordSet.h>

Inheritance diagram for mvlt::VaultRecordSet:
Inheritance graph
[legend]
Collaboration diagram for mvlt::VaultRecordSet:
Collaboration graph
[legend]

Public Member Functions

 VaultRecordSet () noexcept
 Default constructor.
 
 VaultRecordSet (const VaultRecordSet &other) noexcept
 Copy constructor.
 
VaultRecordSetoperator= (const VaultRecordSet &other) noexcept
 Operator assignment.
 
 VaultRecordSet (VaultRecordSet &&other) noexcept
 Move constructor.
 
VaultRecordSetoperator= (VaultRecordSet &&other) noexcept
 Move assignment perator.
 
bool GetIsParentVaultValid () const noexcept
 Method for checking the validity of the parent Vault.
 
std::string GetParentVaultUniqueId () const noexcept
 Method for getting parent vault unique id.
 
bool IsKeyExist (const std::string &key) const noexcept
 The method for getting a default key value.
 
template<class T >
VaultOperationResult GetKeyValue (const std::string &key, T &defaultKeyValue) const noexcept
 The method for getting a default key value.
 
bool GetKeyType (const std::string &key, std::type_index &keyType) const noexcept
 The method for getting a key type.
 
VaultOperationResult AddRecord (const VaultRecordRef &recordRef) noexcept
 Method for adding a record to VaultRecordSet.
 
template<class T >
VaultOperationResult GetRecord (const std::string &key, const T &keyValue, VaultRecordRef &vaultRecordRef) const noexcept
 The method for getting a reference to the data inside Vault.
 
template<class T >
VaultOperationResult GetRecords (const std::string &key, const T &keyValue, std::vector< VaultRecordRef > &recordsRefs, const std::size_t &amountOfRecords=-1) const noexcept
 The method for getting a vector of references to the data inside Vault.
 
template<class T >
VaultOperationResult RequestEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 A method for getting all records that have a value equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestGreater (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 A method for getting all records that have a value greater than keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestGreaterOrEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 A method for getting all records that have a value greater than or equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestLess (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 A method for getting all records that have a value less than keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestLessOrEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 A method for getting all records that have a value less than or equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestInterval (const std::string &key, const T &beginKeyValue, const T &endKeyValue, VaultRecordSet &vaultRecordSet, const bool &isIncludeBeginKeyValue=true, const bool &isIncludeEndKeyValue=true, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const
 The method for getting the result of the request.
 
template<VaultRequestType Type>
VaultOperationResult Request (const VaultRequest< Type > &&request, VaultRecordSet &vaultRecordSet) const
 A method for complex requests.
 
bool CheckRecord (const VaultRecordRef &ref) const noexcept
 A method for checking for an entry in set.
 
void Reset () noexcept
 Resets the object to its initial state.
 
void Clear () noexcept
 Clear VaultRecordSet.
 
bool RemoveRecord (const VaultRecordRef &recordRefToErase) noexcept
 Method for remove a record from a Vault.
 
template<class T >
VaultOperationResult RemoveRecord (const std::string &key, const T &keyValue) noexcept
 Method for remove a record from a Vault.
 
template<class T >
VaultOperationResult RemoveRecords (const std::string &key, const T &keyValue, const std::size_t &amountOfRecords=-1) noexcept
 The method for remove records using key and value.
 
std::size_t Size () const noexcept
 Method for getting the number of records.
 
std::vector< std::string > GetKeys () const noexcept
 The method for getting all the keys.
 
std::vector< VaultRecordRefGetSortedRecords (const std::string &key, const bool &isReverse=false, const std::size_t &amountOfRecords=-1) const noexcept
 Method for getting sorted records.
 
template<class F >
void SortBy (const std::string &key, const F &&func, const bool &isReverse=false, const std::size_t &amountOfRecords=-1) const noexcept
 Method for handle sorted records.
 
std::string ToJson (const bool &isFormat=false, const std::size_t &tabSize=2, const bool &isUseRecordTemplate=true, const std::string &recordTemplate="Record") const noexcept
 Method for saving the contents of the VaultRecordSet in json.
 
void PrintSet (const std::size_t &amountOfRecords=-1) const noexcept
 A method for displaying the contents of a Vault on the screen.
 
void PrintAsTable (bool isPrintId=false, const std::size_t &amountOfRecords=-1, std::string primaryKey="", const bool &isReverse=false, const std::list< std::string > keys={}) const noexcept
 A method for displaying the contents of a Vault as a table on the screen.
 
VaultOperationResult Join (const VaultRecordSet &a) noexcept
 A method for adding all records from a to this.
 
VaultOperationResult Exclude (const VaultRecordSet &a) noexcept
 A method for deleting all records from this that are also in a.
 
VaultOperationResult Intersect (const VaultRecordSet &a) noexcept
 A method to delete all records from this that are not in a.
 
bool SaveToFile (const std::string &fileName, const std::vector< std::string > keys={}, const std::string &separator=",", const bool &isSaveKey=true) const noexcept
 A method for saving data to a table file. The file format is csv.
 
 ~VaultRecordSet () noexcept
 Destructor.
 

Public Attributes

friend Vault
 Make Vault class friend.
 
friend VaultRecord
 Make VaultRecord class friend.
 

Friends

bool operator== (const VaultRecordSet &a, const VaultRecordSet &b)
 Making operator comparison function friendly.
 
VaultOperationResult Union (const VaultRecordSet &a, const VaultRecordSet &b, VaultRecordSet &res) noexcept
 Making Union function friendly.
 
VaultOperationResult Intersection (const VaultRecordSet &a, const VaultRecordSet &b, VaultRecordSet &res) noexcept
 Making Intersection function friendly.
 

Additional Inherited Members

- Protected Types inherited from mvlt::Vault
enum class  VaultDerivedClasses { VaultBase , VaultRecordSetDerived }
 Enum for storing the object type during inheritance. More...
 
- Protected Member Functions inherited from mvlt::Vault
template<class T >
VaultOperationResult SetDataToRecord (VaultRecord *dataRecord, const std::string &key, const T &data) noexcept
 Method for setting a new value in VaultRecord and Vault.
 
std::unordered_set< VaultRecord * >::iterator RemoveRecord (VaultRecord *recordToErase, bool *wasDeleted) noexcept
 Method for removing a record from a Vault.
 
template<class T >
VaultOperationResult RequestRecordsSet (const VaultRequestType &requestType, const std::string &key, const T &beginKeyValue, const T &endKeyValue, std::unordered_set< VaultRecord * > &recordsSet, const bool &isIncludeBeginKeyValue, const bool &isIncludeEndKeyValue, const std::size_t &amountOfRecords, const std::function< bool(const VaultRecordRef &)> &requestPredicat) const noexcept
 The method for getting the result of the request in the std::set.
 
template<class T >
VaultOperationResult RequestRecords (const VaultRequestType &requestType, const std::string &key, const T &beginKeyValue, const T &endKeyValue, VaultRecordSet &vaultRecordSet, const bool &isIncludeBeginKeyValue, const bool &isIncludeEndKeyValue, const std::size_t &amountOfRecords, const std::function< bool(const VaultRecordRef &)> &requestPredicat) const noexcept
 The method for getting the result of the request.
 
template<class T >
VaultOperationResult AddKey (const std::string &key, const T &defaultKeyValue, const bool &isUniqueKey, const bool &isUniqueKeyWithoutLambda, std::function< T(std::size_t, const VaultRecordRef &)> uniqueKeyFunction) noexcept
 Template method to add new key with default value to Vault.
 
bool ReadFile (const std::string &fileName, const bool &isPreprocessRecord, std::function< void(const std::vector< std::string > &, std::vector< std::string > &)> recordHandler, const char &separator, const bool &isLoadKeys, const std::vector< std::string > userKeys) noexcept
 A method for reading a csv file and loading data from it into memory.
 
 Vault () noexcept
 Default constructor.
 
 Vault (const Vault &other) noexcept
 Copy constructor.
 
Vaultoperator= (const Vault &other) noexcept
 Assignment operator.
 
 Vault (Vault &&other) noexcept
 Move constructor.
 
Vaultoperator= (Vault &&other) noexcept
 Move assignment operator.
 
template<class T >
bool AddKey (const std::string &key, const T &defaultKeyValue) noexcept
 Template method to add new key with default value to Vault.
 
template<class T >
VaultOperationResult AddUniqueKey (const std::string &key) noexcept
 Template method to add new unique key to Vault.
 
template<class T >
VaultOperationResult AddUniqueKey (const std::string &key, std::function< T(std::size_t, const VaultRecordRef &)> uniqueKeyFunction) noexcept
 Template method to add new unique key to Vault.
 
template<class T >
VaultOperationResult UpdateKey (const std::string &key, const T &defaultKeyValue) noexcept
 Template method to update default key value.
 
bool IsKeyExist (const std::string &key) const noexcept
 The method for getting a default key value.
 
template<class T >
VaultOperationResult GetKeyValue (const std::string &key, T &defaultKeyValue) const noexcept
 The method for getting a default key value.
 
bool GetKeyType (const std::string &key, std::type_index &keyType) const noexcept
 The method for getting a key type.
 
std::vector< std::string > GetKeys () const noexcept
 The method for getting all the keys.
 
std::vector< std::string > GetUniqueKeys () const noexcept
 The method for getting the unique keys.
 
bool RemoveKey (const std::string &key) noexcept
 The method for deleting the key.
 
VaultOperationResult CreateRecord (const std::vector< std::pair< std::string, VaultParamInput > > &params) noexcept
 Method to create new VaultRecord.
 
VaultOperationResult CreateRecord (VaultRecordRef &vaultRecordRef, const std::vector< std::pair< std::string, VaultParamInput > > &params) noexcept
 Method to create new VaultRecord.
 
template<class T >
VaultOperationResult GetRecord (const std::string &key, const T &keyValue, VaultRecordRef &vaultRecordRef) const noexcept
 The method for getting a reference to the data inside Vault.
 
template<class T >
VaultOperationResult GetRecords (const std::string &key, const T &keyValue, std::vector< VaultRecordRef > &recordsRefs, const std::size_t &amountOfRecords=-1) const noexcept
 The method for getting a vector of references to the data inside Vault.
 
template<class T >
VaultOperationResult RequestEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 A method for getting all records that have a value equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestGreater (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 A method for getting all records that have a value greater than keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestGreaterOrEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 A method for getting all records that have a value greater than or equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestLess (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 A method for getting all records that have a value less than keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestLessOrEqual (const std::string &key, const T &keyValue, VaultRecordSet &vaultRecordSet, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 A method for getting all records that have a value less than or equal to keyValue stored by the key key.
 
template<class T >
VaultOperationResult RequestInterval (const std::string &key, const T &beginKeyValue, const T &endKeyValue, VaultRecordSet &vaultRecordSet, const bool &isIncludeBeginKeyValue=true, const bool &isIncludeEndKeyValue=true, const std::size_t &amountOfRecords=-1, const std::function< bool(const VaultRecordRef &)> &requestPredicat=DefaultRequestPredicat) const noexcept
 The method for getting the result of the request.
 
template<VaultRequestType Type>
VaultOperationResult Request (const VaultRequest< Type > &&request, VaultRecordSet &vaultRecordSet) const
 A method for complex requests.
 
void DropVault () noexcept
 A method for deleting all data and keys.
 
void DropData () noexcept
 A method for deleting all data, but keeping all keys.
 
bool EraseRecord (const VaultRecordRef &recordRefToErase) noexcept
 Method for deleting a record from a Vault.
 
template<class T >
VaultOperationResult EraseRecord (const std::string &key, const T &keyValue) noexcept
 The method for erase record using key and value.
 
template<class T >
VaultOperationResult EraseRecords (const std::string &key, const T &keyValue, const std::size_t &amountOfRecords=-1) noexcept
 The method for erase records using key and value.
 
std::size_t Size () const noexcept
 Method for getting the number of records.
 
std::vector< VaultRecordRefGetSortedRecords (const std::string &key, const bool &isReverse=false, const std::size_t &amountOfRecords=-1) const noexcept
 Method for getting sorted records.
 
template<class F >
void SortBy (const std::string &key, const F &&func, const bool &isReverse=false, const std::size_t &amountOfRecords=-1) const noexcept
 Method for handle sorted records.
 
std::string ToJson (const bool &isFormat=false, const std::size_t &tabSize=2, const bool &isUseRecordTemplate=true, const std::string &recordTemplate="Record") const noexcept
 Method for saving the contents of the Vault in json.
 
void PrintVault (const std::size_t &amountOfRecords=-1) const noexcept
 A method for displaying the contents of a Vault on the screen.
 
void PrintAsTable (bool isPrintId=false, const std::size_t &amountOfRecords=-1, std::string primaryKey="", const bool &isReverse=false, const std::list< std::string > keys={}) const noexcept
 A method for displaying the contents of a Vault as a table on the screen.
 
bool SaveToFile (const std::string &fileName, const std::vector< std::string > keys={}, const std::string &separator=",", const bool &isSaveKey=true) const noexcept
 A method for saving data to a table file. The file format is csv.
 
bool ReadFile (const std::string &fileName, const char &separator=',', const bool &isLoadKeys=true, const std::vector< std::string > keys={}) noexcept
 A method for reading a csv file and loading data from it into memory.
 
bool ReadFile (const std::string &fileName, const char &separator, const bool &isLoadKeys, std::function< void(const std::vector< std::string > &, std::vector< std::string > &)> recordHandler) noexcept
 A method for reading a csv file and loading data from it into memory.
 
std::vector< std::pair< std::size_t, std::string > > GetErrorsInLastReadedFile () const noexcept
 A method for getting errors in the last read file.
 
 ~Vault () noexcept
 Default destructor.
 
- Protected Attributes inherited from mvlt::Vault
VaultDerivedClasses VaultDerivedClass
 A variable for storing the object type in the Vault inheritance tree.
 
std::unordered_set< VaultRecord * > RecordsSet
 Unordered set with all VaultRecord pointers.
 
std::unordered_set< VaultRecordSet * > RecordSetsSet
 Unordered set with all VaultRecordSet pointers.
 
friend VaultRecordRef
 Making the VaultRecordRef class friendly so that it has access to the internal members of the Vault class.
 
friend VaultRecordSet
 Making the VaultRecordSet class friendly so that it has access to the internal members of the Vault class.
 

Detailed Description

A class for storing query results.

The class inherits from Vault, but does not provide functionality for working with keys and creating new records. No new records will be created during the request, and this class will only store pointers to records in the original Vault.

Constructor & Destructor Documentation

◆ VaultRecordSet() [1/2]

mvlt::VaultRecordSet::VaultRecordSet ( const VaultRecordSet other)
noexcept

Copy constructor.

Parameters
[in]otherobject to copy

◆ VaultRecordSet() [2/2]

mvlt::VaultRecordSet::VaultRecordSet ( VaultRecordSet &&  other)
noexcept

Move constructor.

Parameters
[in]otherobject to move

Member Function Documentation

◆ AddRecord()

VaultOperationResult mvlt::VaultRecordSet::AddRecord ( const VaultRecordRef recordRef)
noexcept

Method for adding a record to VaultRecordSet.

Parameters
[in]recordRefA constant reference pointing to a record

◆ CheckRecord()

bool mvlt::VaultRecordSet::CheckRecord ( const VaultRecordRef ref) const
noexcept

A method for checking for an entry in set.

Parameters
[in]refref to the record to check for availability in the set
Returns
returns true if the record is in set, otherwise false

◆ Clear()

void mvlt::VaultRecordSet::Clear ( )
noexcept

Clear VaultRecordSet.

Remove all references to records from the Vault Request Result, but the records themselves in the original Vault will not be changed

◆ Exclude()

VaultOperationResult mvlt::VaultRecordSet::Exclude ( const VaultRecordSet a)
noexcept

A method for deleting all records from this that are also in a.

Parameters
[in]athe record set that contains the records to remove
Returns
exclude result

◆ GetIsParentVaultValid()

bool mvlt::VaultRecordSet::GetIsParentVaultValid ( ) const
noexcept

Method for checking the validity of the parent Vault.

Returns
true if it is valid, otherwise false

◆ GetKeys()

std::vector< std::string > mvlt::VaultRecordSet::GetKeys ( ) const
noexcept

The method for getting all the keys.

If the parent Vault is not valid, it will return an empty vector

Returns
vector with keys

◆ GetKeyType()

bool mvlt::VaultRecordSet::GetKeyType ( const std::string &  key,
std::type_index &  keyType 
) const
noexcept

The method for getting a key type.

Parameters
[in]keythe name of the key to search for
[in]keyTypethe ref to std::type_index
Returns
returns false if the parent vault invalid or the key was not found otherwise returns true

◆ GetKeyValue()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::GetKeyValue ( const std::string &  key,
T defaultKeyValue 
) const
noexcept

The method for getting a default key value.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]defaultKeyValuethe value of the key

◆ GetParentVaultUniqueId()

std::string mvlt::VaultRecordSet::GetParentVaultUniqueId ( ) const
noexcept

Method for getting parent vault unique id.

Returns
id or null in case invalid parent

◆ GetRecord()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::GetRecord ( const std::string &  key,
const T keyValue,
VaultRecordRef vaultRecordRef 
) const
noexcept

The method for getting a reference to the data inside Vault.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordRef, where information about the requested record will be recorded. If the key is not found, or the saved type does not match the type T, the parameter will not change. If the key was found and the types matched, but the value was not found, a nullptr record will be saved to the ref and the vaultRecordRef.isValid() method returns false.

The method will return Ref to the original Vault, but if the original Vault and Vault Request are changed, the Result will be changed

Returns
VaultOperationResult object with GetRecord result

◆ GetRecords()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::GetRecords ( const std::string &  key,
const T keyValue,
std::vector< VaultRecordRef > &  recordsRefs,
const std::size_t &  amountOfRecords = -1 
) const
noexcept

The method for getting a vector of references to the data inside Vault.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]recordsRefsA reference to std::vector<VaultRecordRef?, where information about the requested records will be recorded. In case of errors, the vector will not change
[in]amountOfRecordsThe number of records requested
Returns
VaultOperationResult object with GetRecords result

◆ GetSortedRecords()

std::vector< VaultRecordRef > mvlt::VaultRecordSet::GetSortedRecords ( const std::string &  key,
const bool isReverse = false,
const std::size_t &  amountOfRecords = -1 
) const
noexcept

Method for getting sorted records.

Parameters
[in]keyThe key by which the data should be sorted
[in]isReverseSort in descending order or descending order. By default, ascending
[in]amountOfRecordsThe number of records. By default, everything is

If the parent Vault is not valid, it will return an empty vector If the key is missing in the vault, the result vector will be empty

Returns
A vector with links to records. The order of entries in the vector is determined by the amountOfRecords parameter

◆ Intersect()

VaultOperationResult mvlt::VaultRecordSet::Intersect ( const VaultRecordSet a)
noexcept

A method to delete all records from this that are not in a.

Parameters
[in]aa set that contains records that do not need to be removed
Returns
intersect result

◆ IsKeyExist()

bool mvlt::VaultRecordSet::IsKeyExist ( const std::string &  key) const
noexcept

The method for getting a default key value.

Parameters
[in]keythe name of the key to search for
Returns
returns false if the parent vault invalid or key was not found otherwise returns true

◆ Join()

VaultOperationResult mvlt::VaultRecordSet::Join ( const VaultRecordSet a)
noexcept

A method for adding all records from a to this.

Parameters
[in]athe set from which the recordings will be added
Returns
join result

◆ operator=() [1/2]

VaultRecordSet & mvlt::VaultRecordSet::operator= ( const VaultRecordSet other)
noexcept

Operator assignment.

Parameters
[in]otherobject to copy
Returns
reference to copied object

◆ operator=() [2/2]

VaultRecordSet & mvlt::VaultRecordSet::operator= ( VaultRecordSet &&  other)
noexcept

Move assignment perator.

Parameters
[in]otherobject to move
Returns
reference to moveed object

◆ PrintAsTable()

void mvlt::VaultRecordSet::PrintAsTable ( bool  isPrintId = false,
const std::size_t &  amountOfRecords = -1,
std::string  primaryKey = "",
const bool isReverse = false,
const std::list< std::string >  keys = {} 
) const
noexcept

A method for displaying the contents of a Vault as a table on the screen.

Parameters
[in]isPrintIdwill the unique IDs be printed in the table
[in]amountOfRecordsThe number of records to be printed. The default value is -1, which means that all entries will be output
[in]primaryKeyThe key by which the data will be sorted
[in]isReverseThe sorting direction. If true, the data will be output from the larger to the smaller
[in]keyslist of keys to be printed. By default, the list is empty, which means that all keys will be output

◆ PrintSet()

void mvlt::VaultRecordSet::PrintSet ( const std::size_t &  amountOfRecords = -1) const
noexcept

A method for displaying the contents of a Vault on the screen.

Parameters
[in]amountOfRecordsThe number of records to be printed. The default value is -1, which means that all entries will be output

◆ RemoveRecord() [1/2]

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RemoveRecord ( const std::string &  key,
const T keyValue 
)
noexcept

Method for remove a record from a Vault.

Template Parameters
<T>Any type of data except for c arrays

The record itself will not be changed in any way

Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
Returns
VaultOperationResult object with RemoveRecord result

◆ RemoveRecord() [2/2]

bool mvlt::VaultRecordSet::RemoveRecord ( const VaultRecordRef recordRefToErase)
noexcept

Method for remove a record from a Vault.

The record itself will not be changed in any way

Parameters
[in]recordRefToErasethe reference to the record that needs to be removed
Returns
Returns true if the record existed and was successfully removed, otherwise it returns false

◆ RemoveRecords()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RemoveRecords ( const std::string &  key,
const T keyValue,
const std::size_t &  amountOfRecords = -1 
)
noexcept

The method for remove records using key and value.

Template Parameters
<T>Any type of data except for c arrays

The records itself will not be changed in any way

Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]amountOfRecordsThe number of records to delete. By default set to minus one or all records.

If the amountOfRecords is greater than the number of records stored inside the Vault, then all records with this key and value will be deleted.

Returns
VaultOperationResult object with RemoveRecords result

◆ Request()

template<VaultRequestType Type>
VaultOperationResult mvlt::VaultRecordSet::Request ( const VaultRequest< Type > &&  request,
VaultRecordSet vaultRecordSet 
) const

A method for complex requests.

Parameters
[in]requestThe request
[in]vaultRecordSetSet, to save the query result

◆ RequestEqual()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestEqual ( const std::string &  key,
const T keyValue,
VaultRecordSet vaultRecordSet,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

A method for getting all records that have a value equal to keyValue stored by the key key.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ RequestGreater()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestGreater ( const std::string &  key,
const T keyValue,
VaultRecordSet vaultRecordSet,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

A method for getting all records that have a value greater than keyValue stored by the key key.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ RequestGreaterOrEqual()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestGreaterOrEqual ( const std::string &  key,
const T keyValue,
VaultRecordSet vaultRecordSet,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

A method for getting all records that have a value greater than or equal to keyValue stored by the key key.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ RequestInterval()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestInterval ( const std::string &  key,
const T beginKeyValue,
const T endKeyValue,
VaultRecordSet vaultRecordSet,
const bool isIncludeBeginKeyValue = true,
const bool isIncludeEndKeyValue = true,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

The method for getting the result of the request.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]beginKeyValuethe begin value of the key to be found
[in]endKeyValuethe end value of the key to be found
[in]isIncludeBeginKeyValueinclude beginKeyValue in the interval or not
[in]isIncludeEndKeyValueinclude endKeyValue in the interval or not
[in]vaultRecordSetA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ RequestLess()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestLess ( const std::string &  key,
const T keyValue,
VaultRecordSet vaultRecordSet,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

A method for getting all records that have a value less than keyValue stored by the key key.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ RequestLessOrEqual()

template<class T >
VaultOperationResult mvlt::VaultRecordSet::RequestLessOrEqual ( const std::string &  key,
const T keyValue,
VaultRecordSet vaultRecordSet,
const std::size_t &  amountOfRecords = -1,
const std::function< bool(const VaultRecordRef &)> &  requestPredicat = DefaultRequestPredicat 
) const

A method for getting all records that have a value less than or equal to keyValue stored by the key key.

Template Parameters
<T>Any type of data except for c arrays
Parameters
[in]keythe name of the key to search for
[in]keyValuethe value of the key to be found
[in]vaultRecordRefA reference to VaultRecordSet
[in]amountOfRecordsThe number of records requested. By default request all records
[in]requestPredicatA function that accepts VaultRecordRef and decides whether to add an record to the request. When the function returns true, the record is added, and when false is not added.
Returns
VaultOperationResult object with RequestRecords result

◆ SaveToFile()

bool mvlt::VaultRecordSet::SaveToFile ( const std::string &  fileName,
const std::vector< std::string >  keys = {},
const std::string &  separator = ",",
const bool isSaveKey = true 
) const
noexcept

A method for saving data to a table file. The file format is csv.

Parameters
[in]fileNameThe file name to save the data, the extension must be specified manually
[in]keysa vector with the keys to save. The keys will be stored in the same order as in the vector
[in]separatorThe symbol that will be used to separate the record elements in the file
[in]isSaveKeyA variable that determines whether to save keys to a file

The validity of the keys is provided by the user. In case of a non-existent key, an empty column will be written to the file. If parent Vault not valid return false

Returns
It will return true if it was possible to open the file and write the data, otherwise it will return false

◆ Size()

std::size_t mvlt::VaultRecordSet::Size ( ) const
noexcept

Method for getting the number of records.

If the parent Vault is not valid, it will return 0

Returns
number of records

◆ SortBy()

template<class F >
void mvlt::VaultRecordSet::SortBy ( const std::string &  key,
const F &&  func,
const bool isReverse = false,
const std::size_t &  amountOfRecords = -1 
) const
noexcept

Method for handle sorted records.

Template Parameters
<T>A function that takes const VaultRecordRef& as a parameter and returns bool.
Parameters
[in]keyThe key by which the data should be sorted
[in]funcA function takes const VaultRecordRef& as a parameter. If you need the function to be called again for the next record, then this function call should return true. To stop the loop and interrupt the processing of sorted data, the function must return false. To get values from a function, use lambdas and context capture
[in]isReverseSort in descending order or descending order. By default, ascending
[in]amountOfRecordsThe number of records. By default, everything is

If the parent Vault is not valid, it will call func 0 times The function iterate over all records sorted by the key parameter, in the order specified by the isReverse parameter. For each record, the function passed in the func parameter is called. This function does not sort the data when it is called, the sorted data is already stored inside the Vault. If the key is missing in the vault, the function will be called 0 times

◆ ToJson()

std::string mvlt::VaultRecordSet::ToJson ( const bool isFormat = false,
const std::size_t &  tabSize = 2,
const bool isUseRecordTemplate = true,
const std::string &  recordTemplate = "Record" 
) const
noexcept

Method for saving the contents of the VaultRecordSet in json.

Parameters
[in]isFormatis line formatting required, i.e. adding line breaks and tabs
[in]tabSizethe number of spaces when tabbing
[in]isUseRecordTemplatewill recordTemplate be used for the title of the record or will an internal unique identifier be used
[in]recordTemplatea template for the record name to which the record number will be added
Returns
json string

Friends And Related Symbol Documentation

◆ Intersection

VaultOperationResult Intersection ( const VaultRecordSet a,
const VaultRecordSet b,
VaultRecordSet res 
)
friend

Making Intersection function friendly.

Making Intersection function friendly.

Parameters
[in]aa set to intersection
[in]ba set to intersection
[out]resa set to save the result
Returns
intersection result

◆ operator==

bool operator== ( const VaultRecordSet a,
const VaultRecordSet b 
)
friend

Making operator comparison function friendly.

Making VaultRecordSet operator comparison function friendly.

Parameters
[in]afirst set to compare
[in]bsecond set to compare
Returns
true if a equal b, false otherwise

◆ Union

VaultOperationResult Union ( const VaultRecordSet a,
const VaultRecordSet b,
VaultRecordSet res 
)
friend

Making Union function friendly.

Parameters
[in]aa set to combine
[in]ba set to combine
[out]resa set to save the result
Returns
union result

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