Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::ResultData Class Reference

Class for creating and referencing global created data called result data. This class allows linking of member functions of other classes to handle events generated by the data server and client. More...

#include <ResultData.h>

Inheritance diagram for sf::ResultData:
Collaboration diagram for sf::ResultData:

Public Member Functions

 ResultData ()
 Default constructor.
 
 ResultData (const ResultData &rd)
 Copy constructor.
 
 ResultData (id_type id, bool set_desired=false)
 Constructor for creating an instance that attaches to an existing reference by id.
 
 ResultData (const std::string &definition, ResultData::id_type id_ofs=0)
 Constructor for creating a completely new reference.
 
 ResultData (const Definition &definition, ResultData::id_type id_ofs=0)
 Creates a new result using the passed definition structure.
 
 ~ResultData () override
 Overridden destructor.
 
bool setup (const std::string &definition, id_type id_ofs=0)
 Creates a new reference from a setup string for this instance.
 
bool setup (const Definition &definition, id_type id_ofs)
 Creates a new TResultDataReference from a structure for this instance.
 
bool setup (const ResultData &rd)
 Sets reference as the reference in the past instance.
 
bool setup (ResultData::id_type id, bool set_did=false)
 Sets reference to other by id.
 
std::string getSetupString () const
 Gets the setup string for this instance.
 
bool setAccessRange (const Range &rng, bool skip_self=false)
 Sets the accessible range.
 
bool setAccessRange (Range::size_type stop, bool skip_self=false)
 Same as setAccessRange where the start value is default 0.
 
void setHandler (ResultDataHandler *handler)
 Sets an event handler for this instance.
 
const ResultDataHandlergetHandler () const
 Gets the handler pointer of this instance set with setHandler().
 
void makeOwner ()
 Make this instance owner of this result.
 
ResultDatagetOwner ()
 Gets reference of the owning instance.
 
bool isOwner () const
 Checks if this is the owner of this result.
 
void setUserData (void *data)
 Sets the void pointer data member for general purposes to cast in a handler.
 
void * getUserData () const
 Gets the UserData void pointer data member.
 
bool isValid () const
 Gets the instance validity.
 
data_type getValueOffset () const
 Returns the correction offset for each value to get the real value.
 
data_type getValueRange () const
 Gets the value range (max) taking the significant bits into account.
 
sdata_type getValue (const void *data) const
 Returns the value derived from a buffer data pointer mapped to the appropriate type and corrected with the results offset.
 
data_type getValueU (const void *data) const
 Same as getValue but no offset is added.
 
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.
 
data_type getValueU (size_type idx, const void *data) const
 Same as getValue but no offset is added.
 
id_type getId () const
 Returns the result identifier.
 
id_type getDesiredId () const
 Gets the desired id data member value.
 
id_type getSequenceId () const
 Gets the sequential id of this instance.
 
std::string getName (int levels=0) const
 Gets the result data name which is default the full result data path name.
 
int getNameLevelCount () const
 Gets the amount of levels of the fullname path.
 
std::string getDescription () const
 Gets the instance description.
 
void setDesiredId ()
 Sets the desired id member variable to the current reference id.
 
void setDesiredId (id_type id)
 Sets the desired id member variable to the passed id.
 
template<typename T >
void setData (T data)
 Sets the data for this instance for user purposes.
 
template<typename T = uint64_t>
getData () const
 Gets the data for this instance for user purposes Set with setData().
 
size_type getUsageCount () const
 Gets the usage count of this result reference.
 
const FileMappedStoragegetDataStore () const
 Returns reference to underlying multithreaded safe storage class.
 
size_type getBufferSize (size_type blocks) const
 Gets the size in bytes needed for buffers for reading or writing the amount of blocks.
 
size_type getBufferSize (const Range &rng) const
 Gets the size in bytes needed for buffers for reading or writing the range.
 
size_type getBlockSize () const
 Gets the block size in bytes.
 
Range::size_type getBlockCount () const
 Gets the accessible block count which does not mean it is valid.
 
FileMappedStorage::size_type getSegmentSize () const
 Gets the segment size in blocks.
 
FileMappedStorage::size_type getSegmentCount () const
 Gets the accessible segment count.
 
FileMappedStorage::size_type getReservedBlockCount () const
 Get the amount of reserved blocks.
 
FileMappedStorage::size_type getReservedSize () const
 Returns the total reserved size in bytes for this instance.
 
bool blockRead (Range::size_type ofs, Range::size_type sz, void *dest, bool force=false) const
 Reads blocks from the storage using an offset.
 
bool blockRead (const Range &rng, void *dest, bool force=false) const
 Reads a range of blocks from storage.
 
bool readIndexRange (Range::size_type ofs, Range &range)
 Reads a range when this instance holds indices.
 
bool readIndexRange (const Range &index, Range &range)
 Reads a range when this instance holds indices.
 
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.
 
bool isRangeValid (const Range &rng) const
 Checks if the passed block range is valid to access/read.
 
bool isIndexRangeValid (const Range &rng) const
 Gets if the specified index range is valid.
 
const RangegetAccessRange () const
 Gets the accessible block range where the stop value. is the same as the result of calling 'getBlockCount'.
 
bool getRequests (Range::Vector &requests) const
 Returns a copy of the client requests that are out for data for only the owner.
 
bool getSplitRequests (Range::Vector &req_list) const
 Returns the ranges which are bound by the segment bounds.
 
std::ostream & reportStatus (std::ostream &os) const
 Reports the status as in the past 'std::ostream'.
 
Range::id_type getTransId () const
 Gets the transaction id used in requests of data.
 
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.
 
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.
 
size_type commitValidations (bool skip_self=false)
 Commits all validated ranges and to notifies assigned handlers.
 
bool setReservedBlockCount (Range::size_type sz, bool skip_self=false)
 Sets the amount of blocks to reserve only for owners.
 
bool clearValidations (bool skip_self=false)
 Clears all the valid ranges of this instance.
 
void validateRange (Range::size_type ofs, Range::size_type sz)
 Adds a validated range of blocks for committing later. Only available for owners.
 
void validateRange (Range rng)
 Adds a validated range of blocks for committing later. Only available for owners.
 
void validateRange (const Range::Vector &rl)
 Like validateRange() but for a vector/list of ranges.
 
bool requestRange (Range::size_type ofs, Range::size_type sz)
 Requests a range using offset and size in blocks to validate.
 
bool requestRange (const Range &rng)
 Requests a range in blocks to validate.
 
bool requestIndexRange (const Range &rng)
 Same as requestRange() but for when this instance is an index.
 
void clearRequests ()
 Clears the outstanding requests for only this instance.
 
bool isFlag (int flag) const
 Check if a certain flag or flags (mask) are set.
 
bool setFlag (int flag, bool skip_self)
 Sets a flag or multiple flags allowed by owners only.
 
bool unsetFlag (int flag, bool skip_self)
 Unsets a flag or multiple flags allowed by owners only.
 
std::string getCurFlagsString () const
 Gets the current flags as a string.
 
std::string getFlagsString () const
 Gets the original setup flags as a string.
 
bool updateFlags (int flag, bool skip_self)
 Sets a new set flags for this instance allowed by owners only.
 
flags_type getFlags () const
 Gets the set of flags at setup time.
 
flags_type getCurFlags () const
 Gets the current flags of this instance.
 
EType getType () const
 Gets current type of the instance.
 
ResultData::size_type getTypeSize () const
 Gets the byte size of this instance's type.
 
unsigned getSignificantBits () const
 Gets the significant bits of the type used for this result.
 
bool writeUpdate (std::ostream &os) const
 Writes id and current access range and current flags to the stream.
 
ResultDataoperator= (const ResultData &rd)
 Assigns the reference of the passed instance.
 
bool operator== (const ResultData &rd) const
 Comparison operator.
 
void operator delete (void *)
 During events no instances should be deleted. The destructor will be called but the data still exist.
 
void setDebug (bool debug)
 Sets the debug flag for this instance reference.
 
bool isDebug () const
 Gets the debug flag of the instance reference.
 
const ResultDataReferencegetReference ()
 Gets the underlying reference class of this instance.
 
const Range::VectorgetCommitList () const
 Gets a vector of ranges still to be committed.
 
const Range::VectorgetValidatedList () const
 Gets a vector of ranges that are validated.
 
size_type getSegmentLocks () const
 Returns the accumulation of locks on segments.
 
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 the list.
 
- Public Member Functions inherited from sf::InformationBase
virtual ~InformationBase ()=default
 Virtual destructor so derived classes can be destroyed by a pointer of this type.
 

Static Public Member Functions

static void initialize ()
 Must be called to initialize the statics which this class depends on.
 
static void uninitialize ()
 Called when terminating the application.
 
static EType getType (const char *type)
 Gets the type from the passed string name.
 
static const char * getType (EType type)
 Gets the string typename of the passed enumerate value.
 
static ResultData::size_type getTypeSize (EType type)
 Gets the size of the passed enumerate type value.
 
static size_type getCount ()
 Gets the amount of references in the system.
 
static size_type getInstanceCount ()
 Gets the amount of result data instances in the system.
 
static PtrVector getList ()
 Gets a list of owner instances available.
 
static std::string getFieldName (int field)
 Gets the name of the passed field enumerate EField.
 
static const ResultDatagetInstanceById (ResultData::id_type id)
 Gets instance with the given id otherwise the zero instance.
 
static const ResultDatagetInstanceById (id_type id, const PtrVector &list)
 Finds instance in the past vector having the passed id.
 
static const ResultDatagetInstanceBySequenceId (ResultData::id_type seq_id, const PtrVector &list)
 Finds instance in passed vector. in vector with passed sequential ID and returns a reference to it. If not found it returns ZeroResultData.
 
static ResultData::size_type getTotalReservedSize ()
 Gets the total amount of bytes reserved by all instances.
 
static bool create (std::istream &is, PtrVector &list=null_ref< PtrVector >(), int &err_line=null_ref< int >())
 Setup multiple instances from an input stream.
 
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.
 
static Definition getDefinition (const std::string &str)
 
static flags_type toFlags (const std::string &flags)
 Gets flags enumerate combination of the passed flags string.
 
static std::string getFlagsString (flags_type flags)
 Gets flags string from the passed flags passed.
 
static const char * getEventName (EEvent event)
 Gets the name of the passed EEvent number.
 

Friends

class ResultDataHandler
 
class ResultDataReference
 
class ResultDataStatic
 

Additional Inherited Members

- Public Types inherited from sf::ResultDataTypes
enum  EEvent : int {
  reNewId = -32000 , reUserGlobal , reFirstLocal = 0 , reFlagsChange ,
  reAccessChange , reCommitted , reReserve , reInvalid ,
  reClear , reUserLocal , reFirstPrivate = 16000 , reSetup ,
  reIdChanged , reDesiredId , reRemove , reGetOwner ,
  reLostOwner , reLinked , reUnlinked , reGotRange ,
  reGetRange , reUserPrivate
}
 Event enumerate values used in broadcasting where global events have a negative value. More...
 
enum  EField : int {
  rfId = 0 , rfName , rfFlags , rfDescription ,
  rfType , rfBlockSize , rfSegmentSize , rfSigBits ,
  rfOffset
}
 This enumerate is the order of fields in the setup string. More...
 
enum  EType : int {
  rtInvalid = 0 , rtString , rtInt8 , rtInt16 ,
  rtInt32 , rtInt64 , rtLastEntry
}
 This enumerate is used to identify the type of data. More...
 
enum  EFlag : flags_type { flgRecycle = 1 << 0 , flgArchive = 1 << 1 , flgShare = 1 << 2 , flgHidden = 1 << 3 }
 Flags of the flags description field. More...
 
enum  ERangeInfo {
  riAvailable = 1 << 0 , riAccessible = 1 << 1 , riPartialAccessible = 1 << 2 , riRequested = 1 << 3 ,
  riAddressable = 1 << 5 , riSegmented = 1 << 4
}
 Enumerate for range information bit values. More...
 
typedef TVector< ResultData * > PtrVector
 Vector for pointer to results.
 
typedef TVector< ResultDataVector
 Vector for instances of results.
 
typedef TVector< ResultDataReference * > ReferenceVector
 Type for internal use.
 
- Public Types inherited from sf::InformationTypes
typedef unsigned long long id_type
 Type used for the identifying integer (64-bits).
 
typedef int32_t flags_type
 Type used for the flag integer.
 
typedef size_t size_type
 Type used for size of vectors.
 
typedef uint64_t data_type
 Type used for containing a single data element which is the largest integer.
 
typedef int64_t sdata_type
 Type used for containing a single data element which is the largest signed integer.
 
typedef TVector< id_typeIdVector
 Vector for lists of information ID's.
 
typedef TVector< InformationBase * > Vector
 Vector for containing different information base derived classes.
 
- Static Public Attributes inherited from sf::InformationTypes
static constexpr size_t npos = std::numeric_limits<size_type>::max()
 Unsigned size value indicating not found or no index.
 

Detailed Description

Class for creating and referencing global created data called result data. This class allows linking of member functions of other classes to handle events generated by the data server and client.

Constructor & Destructor Documentation

◆ ResultData() [1/5]

sf::ResultData::ResultData ( )

Default constructor.

◆ ResultData() [2/5]

sf::ResultData::ResultData ( const ResultData rd)
inline

Copy constructor.

Sets the reference as the passed instance.

Parameters
rdInstance to having the reference to assign.

◆ ResultData() [3/5]

sf::ResultData::ResultData ( ResultData::id_type  id,
bool  set_desired = false 
)
inlineexplicit

Constructor for creating an instance that attaches to an existing reference by id.

Parameters
idIdentifying number.
set_desiredWhen true the desired id is set as the passed id.

◆ ResultData() [4/5]

sf::ResultData::ResultData ( const std::string &  definition,
ResultData::id_type  id_ofs = 0 
)
inlineexplicit

Constructor for creating a completely new reference.

Parameters
definitionComma separated string with fields according the EField enumerate.
id_ofsOffset added to the id passed in the string.

◆ ResultData() [5/5]

sf::ResultData::ResultData ( const Definition definition,
ResultData::id_type  id_ofs = 0 
)
inlineexplicit

Creates a new result using the passed definition structure.

Parameters
definitionDefinition structure.
id_ofsOffset given to the id.

◆ ~ResultData()

sf::ResultData::~ResultData ( )
override

Overridden destructor.

Member Function Documentation

◆ blockRead() [1/2]

bool sf::ResultData::blockRead ( const Range rng,
void *  dest,
bool  force = false 
) const
inline

Reads a range of blocks from storage.

This function also calls isRangeValid() to check the validity of the data.

Parameters
rngRange of blocks to read.
destDestination to write the data to.
forceWhen true the function won't check the validity of the range but only the block count.
Returns
True on success false on failure and not valid.
See also
blockRead()

◆ blockRead() [2/2]

bool sf::ResultData::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 validity of the data.

Parameters
ofsOffset in blocks as start to read.
szSize in blocks to read.
destDestination to write the data to.
forceWhen true the function won't check the validity of the range but only the block count.
Returns
True if it succeeded to read the data.

◆ blockWrite() [1/2]

bool sf::ResultData::blockWrite ( const Range rng,
const void *  src,
bool  auto_reserve = false 
)
inline

For owners to writes data to storage in using a range in blocks.

Written data needs to be committed using commitValidations() which emits the events to all event handlers.

Parameters
rngRange to write in blocks.
srcSource pointer to data to read from.
auto_reserveReserve file mapped memory when needed.
See also
blockWrite()

◆ blockWrite() [2/2]

bool sf::ResultData::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 committed using commitValidations() which emits the events to all event handlers. Passing npos as offset means that the data is appended and getBlockCount is called internally to get the offset.

Parameters
ofsWhen the value is npos the data is appended.
szSize in blocks to write.
srcSource pointer to data to read from.
auto_reserveReserve file mapped memory when needed.
Returns
True if it succeeds to write/store the data.

◆ clearRequests()

void sf::ResultData::clearRequests ( )

Clears the outstanding requests for only this instance.

Enables making fresh start in events.

◆ clearValidations()

bool sf::ResultData::clearValidations ( bool  skip_self = false)

Clears all the valid ranges of this instance.

It generates an event reClear before it is actually cleared.

Parameters
skip_selfTrue when skipping this instance's handler.
Returns
True when clear had any effect if not no event was generated.

◆ commitValidations()

size_type sf::ResultData::commitValidations ( bool  skip_self = false)

Commits all validated ranges and to notifies assigned handlers.

Emits the reCommitted event to all handlers of this instance.

Parameters
skip_selfTrue when skipping this instance's handler.
See also
blockWrite()

◆ create()

static bool sf::ResultData::create ( std::istream &  is,
PtrVector list = null_refPtrVector >(),
int &  err_line = null_ref< int >() 
)
static

Setup multiple instances from an input stream.

Useful when reading a data file.

Parameters
isInput stream definition strings.
listReturns vector of created instances.
err_lineError line number.
Returns
True when no error occurred.

◆ emitEvent()

size_type sf::ResultData::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 the list.

Parameters
event
rng
skip_self
Returns

◆ getAccessRange()

const Range & sf::ResultData::getAccessRange ( ) const

Gets the accessible block range where the stop value. is the same as the result of calling 'getBlockCount'.

Returns
Accessible range.

◆ getBlockCount()

Range::size_type sf::ResultData::getBlockCount ( ) const

Gets the accessible block count which does not mean it is valid.

Returns
Amount of blocks.

◆ getBlockSize()

size_type sf::ResultData::getBlockSize ( ) const

Gets the block size in bytes.

Returns
Size of block in bytes.

◆ getBufferSize() [1/2]

ResultData::size_type sf::ResultData::getBufferSize ( const Range rng) const
inline

Gets the size in bytes needed for buffers for reading or writing the range.

Parameters
rngRange depicting the block size.
Returns
Size of the buffer in Bytes.

◆ getBufferSize() [2/2]

size_type sf::ResultData::getBufferSize ( size_type  blocks) const

Gets the size in bytes needed for buffers for reading or writing the amount of blocks.

Parameters
blocksAmount of blocks.
Returns
Size of the buffer in Bytes.

◆ getCommitList()

const Range::Vector & sf::ResultData::getCommitList ( ) const

Gets a vector of ranges still to be committed.

Returns
Vector of ranges.

◆ getCount()

static size_type sf::ResultData::getCount ( )
static

Gets the amount of references in the system.

In fact the amount references in the system excluding the zero one.

Returns
Amount of references.

◆ getCurFlags()

flags_type sf::ResultData::getCurFlags ( ) const

Gets the current flags of this instance.

Returns
One or a combination of flags.

◆ getCurFlagsString()

std::string sf::ResultData::getCurFlagsString ( ) const

Gets the current flags as a string.

Returns
Flags string.

◆ getData()

template<typename T >
T sf::ResultData::getData ( ) const
inline

Gets the data for this instance for user purposes Set with setData().

Returns
Could be a pointer cast value.

◆ getDataStore()

const FileMappedStorage & sf::ResultData::getDataStore ( ) const

Returns reference to underlying multithreaded safe storage class.

To access the data a local data store class must be wrapped around it.

Returns
Reference to the file map storage class.

◆ getDefinition()

static Definition sf::ResultData::getDefinition ( const std::string &  str)
static

Fills a definition structure from a string. On failure the _valid field is set to false.

Parameters
strDefinition string
Returns
Definition structure

◆ getDescription()

std::string sf::ResultData::getDescription ( ) const

Gets the instance description.

Returns
Name string

◆ getDesiredId()

ResultData::id_type sf::ResultData::getDesiredId ( ) const
inline

Gets the desired id data member value.

Returns
Desired identifier.

◆ getEventName()

static const char * sf::ResultData::getEventName ( EEvent  event)
static

Gets the name of the passed EEvent number.

Parameters
eventThe event number.
Returns
String with name.

◆ getFieldName()

static std::string sf::ResultData::getFieldName ( int  field)
static

Gets the name of the passed field enumerate EField.

◆ getFlags()

flags_type sf::ResultData::getFlags ( ) const

Gets the set of flags at setup time.

Returns

◆ getFlagsString() [1/2]

std::string sf::ResultData::getFlagsString ( ) const

Gets the original setup flags as a string.

Returns
Flags string.

◆ getFlagsString() [2/2]

static std::string sf::ResultData::getFlagsString ( flags_type  flags)
static

Gets flags string from the passed flags passed.

Parameters
flagsCombination of enumerate EFlag.
Returns
String of flag characters.

◆ getHandler()

const ResultDataHandler * sf::ResultData::getHandler ( ) const
inline

Gets the handler pointer of this instance set with setHandler().

Returns
Handler object or NULL when not assigned.
See also
setHandler()

◆ getId()

id_type sf::ResultData::getId ( ) const

Returns the result identifier.

Returns
ID integer value.

◆ getInstanceById() [1/2]

static const ResultData & sf::ResultData::getInstanceById ( id_type  id,
const PtrVector list 
)
static

Finds instance in the past vector having the passed id.

When not found it te returns a reference to the zero instance.

Parameters
idIdentifier.
list
Returns
Reference to instance.
See also
sf::ResultDataStatic::zero()

◆ getInstanceById() [2/2]

static const ResultData & sf::ResultData::getInstanceById ( ResultData::id_type  id)
static

Gets instance with the given id otherwise the zero instance.

Parameters
idIdentifier integer.
Returns
Reference to instance.

◆ getInstanceBySequenceId()

static const ResultData & sf::ResultData::getInstanceBySequenceId ( ResultData::id_type  seq_id,
const PtrVector list 
)
static

Finds instance in passed vector. in vector with passed sequential ID and returns a reference to it. If not found it returns ZeroResultData.

Parameters
seq_id
list
Returns

◆ getInstanceCount()

static size_type sf::ResultData::getInstanceCount ( )
static

Gets the amount of result data instances in the system.

Returns
Amount of clients and servers combined.

◆ getList()

static PtrVector sf::ResultData::getList ( )
static

Gets a list of owner instances available.

Useful in populating a selection dialog.

Returns
Vector of instance pointers.

◆ getName()

std::string sf::ResultData::getName ( int  levels = 0) const

Gets the result data name which is default the full result data path name.

When levels is 'n' and larger than zero the last 'n' levels are returned. When levels is 'n' and smaller than zero the first 'n' levels are omitted.

Parameters
levels
Returns

◆ getNameLevelCount()

int sf::ResultData::getNameLevelCount ( ) const

Gets the amount of levels of the fullname path.

Returns
Name string

◆ getOwner()

ResultData & sf::ResultData::getOwner ( )

Gets reference of the owning instance.

◆ getReference()

const ResultDataReference & sf::ResultData::getReference ( )
inline

Gets the underlying reference class of this instance.

Returns
Reference class.

◆ getRequests()

bool sf::ResultData::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 narrowed down to essential ranges.

Parameters
requestsReturned ranges of outstanding current requests.
Returns
True on success.

◆ getReservedBlockCount()

FileMappedStorage::size_type sf::ResultData::getReservedBlockCount ( ) const

Get the amount of reserved blocks.

Returns
Amount of blocks

◆ getReservedSize()

FileMappedStorage::size_type sf::ResultData::getReservedSize ( ) const

Returns the total reserved size in bytes for this instance.

Taking recycling into account. Don't use this to see if enough data is reserved or so.

Returns
Amount of blocks.

◆ getSegmentCount()

FileMappedStorage::size_type sf::ResultData::getSegmentCount ( ) const

Gets the accessible segment count.

Returns
Amount of segments.

◆ getSegmentLocks()

size_type sf::ResultData::getSegmentLocks ( ) const

Returns the accumulation of locks on segments.

◆ getSegmentSize()

FileMappedStorage::size_type sf::ResultData::getSegmentSize ( ) const

Gets the segment size in blocks.

Returns
Blocks in a single segment.

◆ getSequenceId()

id_type sf::ResultData::getSequenceId ( ) const

Gets the sequential id of this instance.

Returns
Sequential Id

◆ getSetupString()

std::string sf::ResultData::getSetupString ( ) const

Gets the setup string for this instance.

Returns
Setup string as initially created.

◆ getSignificantBits()

unsigned sf::ResultData::getSignificantBits ( ) const

Gets the significant bits of the type used for this result.

Returns
Number of bits.

◆ getSplitRequests()

bool sf::ResultData::getSplitRequests ( Range::Vector req_list) const

Returns the ranges which are bound by the segment bounds.

Parameters
req_list
Returns
True when successful.

◆ getTotalReservedSize()

static ResultData::size_type sf::ResultData::getTotalReservedSize ( )
static

Gets the total amount of bytes reserved by all instances.

Returns
Amount in bytes.1

◆ getTransId()

Range::id_type sf::ResultData::getTransId ( ) const
inline

Gets the transaction id used in requests of data.

Returns
The transaction id.

◆ getType() [1/3]

EType sf::ResultData::getType ( ) const

Gets current type of the instance.

Returns
Enumerate type value.

◆ getType() [2/3]

static EType sf::ResultData::getType ( const char *  type)
static

Gets the type from the passed string name.

Parameters
typeString depicting a data type like 'INT32'.
Returns
rtInvalid when not existing and the correct type otherwise.

◆ getType() [3/3]

static const char * sf::ResultData::getType ( EType  type)
static

Gets the string typename of the passed enumerate value.

Parameters
typeEnumerate value.
Returns
Typename string.

◆ getTypeSize() [1/2]

ResultData::size_type sf::ResultData::getTypeSize ( ) const
inline

Gets the byte size of this instance's type.

Returns
Size in bytes.

◆ getTypeSize() [2/2]

static ResultData::size_type sf::ResultData::getTypeSize ( EType  type)
static

Gets the size of the passed enumerate type value.

Parameters
typeEnumerate type value.
Returns
Size in bytes.

◆ getUsageCount()

size_type sf::ResultData::getUsageCount ( ) const

Gets the usage count of this result reference.

Returns
Amount of instances.

◆ getUserData()

void * sf::ResultData::getUserData ( ) const
inline

Gets the UserData void pointer data member.

Returns
Pointer to cast.

◆ getValidatedList()

const Range::Vector & sf::ResultData::getValidatedList ( ) const

Gets a vector of ranges that are validated.

Returns
Vector of ranges.

◆ getValue() [1/2]

sdata_type sf::ResultData::getValue ( const void *  data) const

Returns the value derived from a buffer data pointer mapped to the appropriate type and corrected with the results offset.

Parameters
dataPointer to element.
Returns
Signed integer data value.

◆ getValue() [2/2]

sdata_type sf::ResultData::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.

Parameters
idxIndex offset into the data.
dataPointer to element.
Returns
Signed integer data value.

◆ getValueOffset()

data_type sf::ResultData::getValueOffset ( ) const

Returns the correction offset for each value to get the real value.

Returns
Offset of the value.

◆ getValueRange()

data_type sf::ResultData::getValueRange ( ) const

Gets the value range (max) taking the significant bits into account.

Returns
Max value.

◆ getValueU() [1/2]

data_type sf::ResultData::getValueU ( const void *  data) const

Same as getValue but no offset is added.

Parameters
dataPointer to element.
Returns
Unsigned integer data value.

◆ getValueU() [2/2]

data_type sf::ResultData::getValueU ( size_type  idx,
const void *  data 
) const

Same as getValue but no offset is added.

Parameters
idx
data
Returns

◆ initialize()

static void sf::ResultData::initialize ( )
static

Must be called to initialize the statics which this class depends on.

◆ isDebug()

bool sf::ResultData::isDebug ( ) const
inline

Gets the debug flag of the instance reference.

Returns
True when enabled.

◆ isFlag()

bool sf::ResultData::isFlag ( int  flag) const

Check if a certain flag or flags (mask) are set.

Parameters
flagOne or a combination of flags.
Returns
True when the flag is or are set.

◆ isIndexRangeValid()

bool sf::ResultData::isIndexRangeValid ( const Range rng) const

Gets if the specified index range is valid.

Parameters
rngIndex range being validated.
Returns
True when valid.

◆ isOwner()

bool sf::ResultData::isOwner ( ) const

Checks if this is the owner of this result.

Returns
True when this instance is the owning instance.

◆ isRangeValid() [1/2]

bool sf::ResultData::isRangeValid ( const Range rng) const

Checks if the passed block range is valid to access/read.

Parameters
rngRange in blocks.
Returns
True when the passed range is valid to read.
See also
isRangeValid()

◆ isRangeValid() [2/2]

bool sf::ResultData::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.

Parameters
ofsOffset in blocks.
szSize in blocks.
Returns
True when the passed range is valid to read.

◆ isValid()

bool sf::ResultData::isValid ( ) const

Gets the instance validity.

Returns
True when valid.

◆ makeOwner()

void sf::ResultData::makeOwner ( )

Make this instance owner of this result.

◆ operator delete()

void sf::ResultData::operator delete ( void *  )

During events no instances should be deleted. The destructor will be called but the data still exist.

◆ operator=()

ResultData & sf::ResultData::operator= ( const ResultData rd)
inline

Assigns the reference of the passed instance.

Calls actually setup(const ResultData& rd).

Parameters
rdSource instance
Returns
Lvalue

◆ operator==()

bool sf::ResultData::operator== ( const ResultData rd) const
inline

Comparison operator.

Parameters
rdResult data to compare.
Returns
True when the same.

◆ readIndexRange() [1/2]

bool sf::ResultData::readIndexRange ( const Range index,
Range range 
)

Reads a range when this instance holds indices.

Parameters
indexRange pointing to the first index and the last index value to read.
rangeResulting range that was read.
Returns
True on success false on failure and not valid.

◆ readIndexRange() [2/2]

bool sf::ResultData::readIndexRange ( Range::size_type  ofs,
Range range 
)

Reads a range when this instance holds indices.

An index instance groups blocks together for processing/imaging purposes.

Parameters
ofsOffset in the storage container to read the index range.
rangeResulting range that was read.
Returns
True on success false on failure and not valid.

◆ readUpdate()

static bool sf::ResultData::readUpdate ( std::istream &  is,
bool  skip_self,
PtrVector list = null_refPtrVector >() 
)
static

Read new multiple current access range and current flags are read from stream.

Used in communication between applications.

Parameters
isInput stream.
skip_selfWhen true no events are send to this instance itself.
listOptional other list to use as source for instances.
Returns
True when successful.

◆ reportStatus()

std::ostream & sf::ResultData::reportStatus ( std::ostream &  os) const

Reports the status as in the past 'std::ostream'.

◆ requestIndexRange()

bool sf::ResultData::requestIndexRange ( const Range rng)

Same as requestRange() but for when this instance is an index.

Parameters
rngRequested index range.
Returns
True when the request was excepted.
See also
requestRange()

◆ requestRange() [1/2]

bool sf::ResultData::requestRange ( const Range rng)

Requests a range in blocks to validate.

Parameters
rngRange in blocks.
Returns
True when the request was excepted.
See also
requestRange()

◆ requestRange() [2/2]

bool sf::ResultData::requestRange ( Range::size_type  ofs,
Range::size_type  sz 
)
inline

Requests a range using offset and size in blocks to validate.

Emits event reGetRange to the owner when a handler is assigned to it. Returns false when the request was rejected by the range manager due to being already valid or when the range is not within the current accessible range.

Parameters
ofsOffset in blocks.
szSize in blocks.
Returns
True when the request was excepted.

◆ setAccessRange() [1/2]

bool sf::ResultData::setAccessRange ( const Range rng,
bool  skip_self = false 
)

Sets the accessible range.

When needed the method calls setReservedBlockCount() to match the given range emitting the reReserve event. When the range is increased an reAccessChange event is emitted.

Parameters
rngAccessible range in blocks.
skip_selfTrue when skipping this instance's handler.
Returns
True when a change was made to the range and false if not.

◆ setAccessRange() [2/2]

bool sf::ResultData::setAccessRange ( Range::size_type  stop,
bool  skip_self = false 
)
inline

Same as setAccessRange where the start value is default 0.

Parameters
stopEnd of range in blocks.
skip_selfTrue when skipping this instance's handler.
Returns
True when a change was made to the range and false if not.
See also
setAccessRange(const Range& rng, bool skip_self = false)

◆ setData()

template<typename T >
void sf::ResultData::setData ( data)
inline

Sets the data for this instance for user purposes.

Parameters
dataCould be a pointer cast value.

◆ setDebug()

void sf::ResultData::setDebug ( bool  debug)

Sets the debug flag for this instance reference.

Parameters
debugTrue to enable.

◆ setDesiredId() [1/2]

void sf::ResultData::setDesiredId ( )

Sets the desired id member variable to the current reference id.

◆ setDesiredId() [2/2]

void sf::ResultData::setDesiredId ( id_type  id)

Sets the desired id member variable to the passed id.

If the passed 'id' is zero the automatic attachment mechanism is disabled.

Parameters
idDesiredId

◆ setFlag()

bool sf::ResultData::setFlag ( int  flag,
bool  skip_self 
)

Sets a flag or multiple flags allowed by owners only.

Parameters
flagOne or a combination of flags.
skip_selfTrue when skipping this instance's handler.
Returns
True when successful.

◆ setHandler()

void sf::ResultData::setHandler ( ResultDataHandler handler)

Sets an event handler for this instance.

Parameters
handlerPassing NULL will disable the link.

◆ setReservedBlockCount()

bool sf::ResultData::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_reserve' is true in a call to blockWrite(). Emits event reReserve to all instance handlers.

Parameters
szBlocks to reserve.
skip_selfTrue when skipping this instance's handler.
Returns
True when successful.

◆ setup() [1/4]

bool sf::ResultData::setup ( const Definition definition,
id_type  id_ofs 
)

Creates a new TResultDataReference from a structure for this instance.

Parameters
definitionDefinition structure.
id_ofsOffset given to the definition id.
Returns
True when successful.

◆ setup() [2/4]

bool sf::ResultData::setup ( const ResultData rd)
inline

Sets reference as the reference in the past instance.

Parameters
rdInstance to get the source reference from.
Returns
True when successful.

◆ setup() [3/4]

bool sf::ResultData::setup ( const std::string &  definition,
id_type  id_ofs = 0 
)
inline

Creates a new reference from a setup string for this instance.

Parameters
definitionComma separated string with fields according the EField enumerate.
id_ofsOffset for the id in the definition string.
Returns
True when successful.

◆ setup() [4/4]

bool sf::ResultData::setup ( ResultData::id_type  id,
bool  set_did = false 
)
inline

Sets reference to other by id.

The global list of references is searched for the passed id and referenced when found. When found event reIdChanged is emitted. When the desired id was set and changed the reDesiredId event is emitted. Cannot be used for local variables.

Parameters
idIdentifier.
set_didWhen true the desired id is set to the passed 'id'.
Returns
True when found and referenced.

◆ setUserData()

void sf::ResultData::setUserData ( void *  data)
inline

Sets the void pointer data member for general purposes to cast in a handler.

Parameters
dataPointer

◆ toFlags()

static flags_type sf::ResultData::toFlags ( const std::string &  flags)
static

Gets flags enumerate combination of the passed flags string.

Parameters
flagsFlags string.
Returns
Combination of enumerate EFlag.

◆ uninitialize()

static void sf::ResultData::uninitialize ( )
static

Called when terminating the application.

◆ unsetFlag()

bool sf::ResultData::unsetFlag ( int  flag,
bool  skip_self 
)

Unsets a flag or multiple flags allowed by owners only.

Parameters
flagOne or a combination of flags.
skip_selfTrue when skipping this instance's handler.
Returns
True when successful.

◆ updateFlags()

bool sf::ResultData::updateFlags ( int  flag,
bool  skip_self 
)

Sets a new set flags for this instance allowed by owners only.

Parameters
flagOne or a combination of flags.
skip_selfTrue when skipping this instance's handler.
Returns
True when successful.

◆ validateRange() [1/3]

void sf::ResultData::validateRange ( const Range::Vector rl)

Like validateRange() but for a vector/list of ranges.

Parameters
rlList of ranges.
See also
validateRange()

◆ validateRange() [2/3]

void sf::ResultData::validateRange ( Range  rng)

Adds a validated range of blocks for committing later. Only available for owners.

This method is useful when file mapped storage is written when locking it in memory when not using method blockWrite() which implies this.

Parameters
rngRange blocks.
See also
commitValidations()

◆ validateRange() [3/3]

void sf::ResultData::validateRange ( Range::size_type  ofs,
Range::size_type  sz 
)
inline

Adds a validated range of blocks for committing later. Only available for owners.

This method is useful when file mapped storage is written when locking it in memory when not using method blockWrite() which implies this.

Parameters
ofsOffset in blocks.
szSize in blocks.
See also
commitValidations()

◆ writeUpdate()

bool sf::ResultData::writeUpdate ( std::ostream &  os) const

Writes id and current access range and current flags to the stream.

Used in communication between applications.

Parameters
osOutput stream.
Returns
True when successful.

Friends And Related Symbol Documentation

◆ ResultDataHandler

friend class ResultDataHandler
friend

◆ ResultDataReference

friend class ResultDataReference
friend

◆ ResultDataStatic

friend class ResultDataStatic
friend

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