76 inline bool setup(
const std::string& definition,
id_type id_ofs = 0);
248 [[nodiscard]] std::string
getName(
int levels = 0)
const;
285 template<
typename T = u
int64_t>
560 [[nodiscard]]
bool isFlag(
int flag)
const;
715 static bool create(std::istream& is,
PtrVector& list = null_ref<PtrVector>(),
int& err_line = null_ref<int>());
777 void operator delete(
void*);
801 [[maybe_unused]]
size_type emitLocalEvent(
EEvent event,
const Range& rng,
bool skip_self =
true)
const;
810 [[maybe_unused]]
size_type emitGlobalEvent(
EEvent event,
const Range& rng,
bool skip_self =
true)
const;
853 bool recycleEnable(
bool recycle);
868 Range::id_type _transactionId{0};
872 id_type _desiredId{0};
876 void* _userData{
nullptr};
954#include <gii/gen/ResultData.hpp>
This class provides storing of huge amounts of data using file mapping. Mapping only what is needed ...
Definition FileMappedStorage.h:55
uint64_t size_type
Type used for sizes of storage.
Definition FileMappedStorage.h:60
Type to contain and manipulate range lists.
Definition Range.h:67
Class to manage 64-bit integer ranges.
Definition Range.h:52
RANGE::size_type size_type
Integer type used for start and stop.
Definition Range.h:57
RANGE::id_type id_type
Integer type used for the ID.
Definition Range.h:61
Class used to give a ResultData instance access to virtual method of a derived class.
Definition ResultDataHandler.h:12
Base class of the sf::ResultData having all global static data members.
Definition ResultDataStatic.h:13
This base class contains all local types of used in the sf::ResultData class. Multiple inheritance m...
Definition ResultDataTypes.h:25
EEvent
Event enumerate values used in broadcasting where global events have a negative value.
Definition ResultDataTypes.h:46
EType
This enumerate is used to identify the type of data.
Definition ResultDataTypes.h:122
Class for creating and referencing global created data called result data. This class allows linking ...
Definition ResultData.h:20
Range::size_type getBlockCount() const
Gets the accessible block count which does not mean it is valid.
bool requestRange(const Range &rng)
Requests a range in blocks to validate.
bool requestRange(Range::size_type ofs, Range::size_type sz)
Requests a range using offset and size in blocks to validate. Emits event reGetRange to the owner whe...
ResultData(id_type id, bool set_desired=false)
Constructor for creating an instance that attaches to an existing reference by id.
~ResultData() override
Overridden destructor.
bool updateFlags(int flags, bool skip_self)
Sets a new set flags for this instance allowed by owners only.
void setUserData(void *data)
Sets the void pointer data member for general purposes to cast in a handler.
const FileMappedStorage & getDataStore() const
Returns reference to underlying multithreaded safe storage class. To access the data a local data sto...
static size_type getTotalReservedSize()
Gets the total amount of bytes reserved by all instances.
bool setup(const Definition &definition, id_type id_ofs)
Creates a new TResultDataReference from a structure for this instance.
bool blockRead(const Range &rng, void *dest, bool force=false) const
Reads a range of blocks from storage. This function also calls isRangeValid() to check the validity o...
ResultData(const Definition &definition, id_type id_ofs=0)
Creates a new result using the passed definition structure.
FileMappedStorage::size_type getReservedBlockCount() const
Get the amount of reserved blocks.
void setDebug(bool debug) const
Sets the debug flag for this instance reference.
static bool readUpdate(std::istream &is, bool skip_self, PtrVector &list=null_ref< PtrVector >())
Read new multiple current access range and current flags are read from stream. Used in communication ...
size_type getBufferSize(size_type blocks) const
Gets the size in bytes needed for buffers for reading or writing the amount of blocks.
ResultData()
Default constructor.
bool setAccessRange(const Range &rng, bool skip_self=false)
Sets the accessible range. When needed the method calls setReservedBlockCount() to match the given ra...
static const ResultData & getInstanceById(id_type id, const PtrVector &list)
Finds instance in the past vector having the passed id. When not found it te returns a reference to t...
std::string getSetupString() const
Gets the setup string for this instance.
sdata_type getValue(const void *data) const
Returns the value derived from a buffer data pointer mapped to the appropriate type and corrected wit...
size_type getUsageCount() const
Gets the usage count of this result reference.
void validateRange(const Range::Vector &rl) const
Like validateRange() but for a vector/list of ranges.
size_type commitValidations(bool skip_self=false)
Commits all validated ranges and to notifies assigned handlers. Emits the reCommitted event to all ha...
unsigned getSignificantBits() const
Gets the significant bits of the type used for this result.
size_type getTypeSize() const
Gets the byte size of this instance's type.
flags_type getFlags() const
Gets the set of flags at setup time.
void setData(T data)
Sets the data for this instance for user purposes.
T getData() const
Gets the data for this instance for user purposes Set with setData().
Range::id_type getTransId() const
Gets the transaction id used in requests of data.
bool blockRead(Range::size_type ofs, Range::size_type sz, void *dest, bool force=false) const
Reads blocks from the storage using an offset. This function also calls isRangeValid() to check the v...
static EType getType(std::string_view type)
Gets the type from the passed string name.
std::string getCurFlagsString() const
Gets the current flags as a string.
const Range::Vector & getCommitList() const
Gets a vector of ranges still to be committed.
id_type getDesiredId() const
Gets the desired id data member value.
static bool create(std::istream &is, PtrVector &list=null_ref< PtrVector >(), int &err_line=null_ref< int >())
Setup multiple instances from an input stream. Useful when reading a data file.
void setDesiredId()
Sets the desired id member variable to the current reference id.
static PtrVector getList()
Gets a list of owner instances available. Useful in populating a selection dialog.
bool setReservedBlockCount(Range::size_type sz, bool skip_self=false)
Sets the amount of blocks to reserve only for owners. This method is called underwater when 'auto_res...
ResultData(const ResultData &rd)
Copy constructor. Sets the reference as the passed instance.
void setHandler(ResultDataHandler *handler)
Sets an event handler for this instance.
size_type getSegmentLocks() const
Gets the accumulation of locks on segments.
size_type getBlockSize() const
Gets the block size in bytes.
static void initialize()
Must be called to initialize the statics which this class depends on.
static void uninitialize()
Called when terminating the application.
ResultData(const std::string &definition, id_type id_ofs=0)
Constructor for creating a completely new reference.
bool isIndexRangeValid(const Range &rng) const
Gets if the specified index range is valid.
bool writeUpdate(std::ostream &os) const
Writes id and current access range and current flags to the stream.
static size_type getInstanceCount()
Gets the amount of result data instances in the system.
const Range & getAccessRange() const
Gets the accessible block range where the stop value. Is the same as the result of calling 'getBlockC...
void setDesiredId(id_type id)
Sets the desired id member variable to the passed id. If the passed 'id' is zero the automatic attach...
flags_type getCurFlags() const
Gets the current flags of this instance.
bool setup(const ResultData &rd)
Sets reference as the reference in the past instance.
bool operator==(const ResultData &rd) const
Comparison operator.
bool getSplitRequests(Range::Vector &req_list) const
Returns the ranges which are bound by the segment bounds.
static std::string_view getEventName(EEvent event)
Gets the name of the passed EEvent number.
bool clearValidations(bool skip_self=false) const
Clears all the valid ranges of this instance. It generates an event reClear before it is actually cle...
data_type getValueU(const void *data) const
Same as getValue but no offset is added.
static std::string getFieldName(int field)
Gets the name of the passed field enumerate EField.
static flags_type toFlags(const std::string &flags)
Gets flags enumerate combination of the passed flags string.
FileMappedStorage::size_type getSegmentCount() const
Gets the accessible segment count.
bool getRequests(Range::Vector &requests) const
Returns a copy of the client requests that are out for data for only the owner. This list is already ...
void * getUserData() const
Gets the UserData void pointer data member.
FileMappedStorage::size_type getSegmentSize() const
Gets the segment size in blocks.
int getNameLevelCount() const
Gets the amount of levels of the fullname path.
FileMappedStorage::size_type getReservedSize() const
Returns the total reserved size in bytes for this instance. Taking recycling into account....
data_type getValueRange() const
Gets the value range (max) taking the significant bits into account.
bool blockWrite(const Range &rng, const void *src, bool auto_reserve=false)
For owners to writes data to storage in using a range in blocks.
void clearRequests() const
Clears the outstanding requests for only this instance. Enables making fresh start in events.
std::ostream & reportStatus(std::ostream &os) const
Reports the status as in the past 'std::ostream'.
bool isRangeValid(Range::size_type ofs, Range::size_type sz) const
Checks if the passed block range depicted by offset and size is valid to access/read.
std::string getName(int levels=0) const
Gets the result data name which is default the full result data path name. When levels is 'n' and lar...
static size_type getCount()
Gets the amount of references in the system. In fact the amount references in the system excluding th...
EType getType() const
Gets current type of the instance.
sdata_type getValue(size_type idx, const void *data) const
Same as getValue() but now from the instance at the passed index from the array of the results type.
const ResultDataReference & getReference() const
Gets the underlying reference class of this instance.
static const ResultData & getInstanceBySequenceId(id_type seq_id, const PtrVector &list)
Finds instance in passed vector. in vector with passed sequential ID and returns a reference to it....
bool setAccessRange(Range::size_type stop, bool skip_self=false)
Same as setAccessRange where the start value is default 0.
size_type getBufferSize(const Range &rng) const
Gets the size in bytes needed for buffers for reading or writing the range.
bool readIndexRange(Range::size_type ofs, Range &range) const
Reads a range when this instance holds indices. An index instance groups blocks together for processi...
bool setup(const std::string &definition, id_type id_ofs=0)
Creates a new reference from a setup string for this instance.
bool setFlag(int flag, bool skip_self)
Sets a flag or multiple flags allowed by owners only.
std::string getFlagsString() const
Gets the original setup flags as a string.
void validateRange(Range rng) const
Adds a validated range of blocks for committing later. Only available for owners. This method is usef...
data_type getValueOffset() const
Returns the correction offset for each value to get the real value.
bool blockWrite(Range::size_type ofs, Range::size_type sz, const void *src, bool auto_reserve=false)
For owners to writes data to storage in using an offset and size in blocks. Written data needs to be ...
static std::string getFlagsString(flags_type flags)
Gets flags string from the passed flags passed.
bool isDebug() const
Gets the debug flag of the instance reference.
bool isRangeValid(const Range &rng) const
Checks if the passed block range is valid to access/read.
ResultData & getOwner() const
Gets reference of the owning instance.
static Definition getDefinition(const std::string &str)
Fills a definition structure from a string. On failure the _valid field is set to false.
bool isOwner() const
Checks if this is the owner of this result.
id_type getId() const
Returns the result identifier.
size_type emitEvent(EEvent event, const Range &rng, bool skip_self=false)
Initiate event for all instances of this result. If skip_self is 'true' this instance is left out of ...
bool readIndexRange(const Range &index, Range &range) const
Reads a range when this instance holds indices.
void makeOwner()
Make this instance owner of this result.
data_type getValueU(size_type idx, const void *data) const
Same as getValue but no offset is added.
bool isValid() const
Gets the instance validity.
ResultData & operator=(const ResultData &rd)
Assigns the reference of the passed instance. Calls actually setup(const ResultData& rd).
bool unsetFlag(int flag, bool skip_self)
Unsets a flag or multiple flags allowed by owners only.
std::string getDescription() const
Gets the instance description.
bool isFlag(int flag) const
Check if a certain flag or flags (mask) are set.
void validateRange(Range::size_type ofs, Range::size_type sz) const
Adds a validated range of blocks for committing later. Only available for owners. This method is usef...
bool setup(id_type id, bool set_did=false)
Sets reference to other by id. The global list of references is searched for the passed id and refere...
const ResultDataHandler * getHandler() const
Gets the handler pointer of this instance set with setHandler().
Definition ResultData.h:141
id_type getSequenceId() const
Gets the sequential id of this instance.
static std::string getType(EType type)
Gets the string typename of the passed enumerate value.
bool requestIndexRange(const Range &rng)
Same as requestRange() but for when this instance is an index.
const Range::Vector & getValidatedList() const
Gets a vector of ranges that are validated.
static const ResultData & getInstanceById(id_type id)
Gets instance with the given id otherwise the zero instance.
static size_type getTypeSize(EType type)
Gets the size of the passed enumerate type value.
#define _GII_CLASS
Definition gii/global.h:38
#define _GII_FUNC
Definition gii/global.h:37
Definition Application.h:10
_GII_FUNC std::istream & operator>>(std::istream &is, ResultData &)
Stream operator for setting up this instance with a setup std::string.
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.
Definition ResultDataReference.h:13
Structure used to setup a result reference.
Definition ResultDataTypes.h:175