MVault 1.0.0
Simple c++ database
Loading...
Searching...
No Matches
VaultRecord.h
1#pragma once
2
3#include <vector>
4#include <sstream>
5#include <mutex>
6
7#include "VaultClasses.h"
8
9namespace mvlt
10{
17 class VaultRecord : public DataHashMap
18 {
19 private:
20 // Variable to store object validity
21 bool IsValid = true;
22
23 // Validity counter
24 std::size_t RefCounter = 0;
25
26 // Mutex for thread safety
27 mutable std::recursive_mutex VaultRecordMutex;
28
29 // Set with all dependent VaultRecordSets
30 std::unordered_set<VaultRecordSet*> dependentVaultRecordSets;
31
32 public:
34 friend Vault;
35
38
41
44
51
60
67
76
78 void AddRef() noexcept;
79
81 void RemoveRef() noexcept;
82
84 void Invalidate() noexcept;
85
91
94
101
108
119
122 };
123}
Iterator class for all library maps.
Definition Map.h:18
Specialization of class DataContainer, used as a type std::unordered_map<std::string,...
Definition DataContainer.h:288
A class for storing data inside Vault.
Definition VaultRecord.h:18
void AddToDependentSets(VaultRecordSet *vaultRecordSet) noexcept
A method for adding an record to a vaultRecordSet and adding a vaultRecordSet to dependent sets.
Definition VaultRecord.cpp:124
void RemoveFromDependentSets() noexcept
A method for removing record from all dependent VaultRecordSets.
Definition VaultRecord.cpp:113
friend Vault
Making the Vault class friendly so that it has access to the internal members of the VaultRecord clas...
Definition VaultRecord.h:34
friend VaultRecordRef
Making the VaultRecordRef class friendly so that it has access to the internal members of the VaultRe...
Definition VaultRecord.h:37
bool GetIsValid() const noexcept
A method for checking whether a record is inside a Vault.
Definition VaultRecord.cpp:102
VaultRecord() noexcept
Default constructor.
Definition VaultRecord.cpp:6
void Invalidate() noexcept
A method to indicate that the record is no longer valid and is not inside Vault.
Definition VaultRecord.cpp:89
void RemoveRef() noexcept
A method to reduce the number of references to an object.
Definition VaultRecord.cpp:76
void AddRef() noexcept
A method for increasing the number of references to an object.
Definition VaultRecord.cpp:67
void UpdateDependentSets(const std::string &key, const T &data) noexcept
A method for updating the position of a record within all dependencies.
Definition VaultRecord.hpp:9
friend VaultRecordSet
Making the VaultRecordSet class friendly so that it has access to the internal members of the VaultRe...
Definition VaultRecord.h:40
void EraseDependentSet(VaultRecordSet *vaultRecordSet) noexcept
A method for erasing an record from a vaultRecordSet and erasing a vaultRecordSet from dependent sets...
Definition VaultRecord.cpp:133
A class for storing query results.
Definition VaultRecordSet.h:14