![]() |
Scanframe Modular Application 0.1.0
|
Script object for exporting GII parameters to a script object. More...
#include <ResultDataScriptObject.h>
Public Member Functions | |
ResultDataScriptObject (const Parameters ¶ms) | |
std::string | getStatusText () override |
Gets the status text of this object for debugging purposes. | |
![]() | |
ScriptObject (const char *type_name, ScriptObject *parent=nullptr) | |
virtual | ~ScriptObject ()=default |
Virtual destructor which can be overloaded to clean up objects. | |
int | getRefCount () const |
Gets the reference count. | |
operator Value () const | |
Cast operator to be able to return this instance as a Value. | |
std::string | getTypeName () const |
Returns the type name Set at the constructor. | |
ScriptObject * | getParent () |
Gets the script object owner. | |
const ScriptObject * | getParent () const |
Gets the script object owner. | |
ScriptObject * | castToObject (const Value &value) |
Casts a sf::Value::vitCustom typed sf::Value to a ScriptObject typed pointer. | |
![]() | |
ResultData () | |
Default constructor. | |
ResultData (const ResultData &rd) | |
Copy constructor. Sets the reference as the passed instance. | |
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, id_type id_ofs=0) | |
Constructor for creating a completely new reference. | |
ResultData (const Definition &definition, 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 (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 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. | |
std::string | getSetupString () const |
Gets the setup string for this instance. | |
bool | 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. | |
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 ResultDataHandler * | getHandler () const |
Gets the handler pointer of this instance set with setHandler(). | |
void | makeOwner () |
Make this instance owner of this result. | |
ResultData & | getOwner () const |
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. 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. | |
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. If the passed 'id' is zero the automatic attachment mechanism is disabled. | |
template<typename T > | |
void | setData (T data) |
Sets the data for this instance for user purposes. | |
template<typename T = uint64_t> | |
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 FileMappedStorage & | getDataStore () const |
Returns reference to underlying multithreaded safe storage class. To access the data a local data store class must be wrapped around it. | |
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. Taking recycling into account. Don't use this to see if enough data is reserved or so. | |
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 validity of the data. | |
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 of the data. | |
bool | readIndexRange (Range::size_type ofs, Range &range) const |
Reads a range when this instance holds indices. An index instance groups blocks together for processing/imaging purposes. | |
bool | readIndexRange (const Range &index, Range &range) const |
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 Range & | getAccessRange () 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. This list is already narrowed down to essential ranges. | |
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. 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. | |
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. Emits the reCommitted event to all handlers of this instance. | |
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_reserve' is true in a call to blockWrite(). Emits event reReserve to all instance handlers. | |
bool | clearValidations (bool skip_self=false) const |
Clears all the valid ranges of this instance. It generates an event reClear before it is actually cleared. | |
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 useful when file mapped storage is written when locking it in memory when not using method blockWrite() which implies this. | |
void | validateRange (Range rng) const |
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. | |
void | validateRange (const Range::Vector &rl) const |
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. 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. | |
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 () const |
Clears the outstanding requests for only this instance. Enables making fresh start in events. | |
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 flags, 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. | |
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. | |
ResultData & | operator= (const ResultData &rd) |
Assigns the reference of the passed instance. Calls actually setup(const ResultData& rd). | |
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) const |
Sets the debug flag for this instance reference. | |
bool | isDebug () const |
Gets the debug flag of the instance reference. | |
const ResultDataReference & | getReference () const |
Gets the underlying reference class of this instance. | |
const Range::Vector & | getCommitList () const |
Gets a vector of ranges still to be committed. | |
const Range::Vector & | getValidatedList () const |
Gets a vector of ranges that are validated. | |
size_type | getSegmentLocks () const |
Gets 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. | |
![]() | |
virtual | ~InformationBase ()=default |
Virtual destructor so derived classes can be destroyed by a pointer of this type. | |
![]() | |
template<typename T > | |
constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)), data_type > | toDataType (T value) const |
Casts any type to a data_type value. | |
template<typename T > | |
constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)), T > | fromDataType (data_type value) const |
Casts a data_type value to a given type. | |
Protected Member Functions | |
const IdInfo * | getInfo (const std::string &name) const override |
Must be overloaded for member namespace. | |
void | destroyObject (bool &should_delete) override |
Asks if the object should be deleted after having made this call. | |
bool | getSetValue (const IdInfo *info, Value *value, Value::vector_type *params, bool flag_set) override |
Gets or sets the passed data member. Must be overloaded in derived class. | |
![]() | |
void | makeParent (ScriptObject *so) |
Makes this object the owner of the other object. | |
void | setParent (ScriptObject *parent) |
Sets the owner to the pass script object. | |
Additional Inherited Members | |
![]() | |
enum | EIdentifier { idUnknown = 0 , idConstant , idVariable , idFunction , idTypedef , idKeyword } |
Keyword identifiers. More... | |
typedef std::string::size_type | pos_type |
Source position type. | |
typedef ssize_t | ip_type |
Instruction pointer type. | |
![]() | |
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< ResultData > | Vector |
Vector for instances of results. | |
typedef TVector< ResultDataReference * > | ReferenceVector |
Type for internal use. | |
![]() | |
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_type > | IdVector |
Vector for lists of information ID's. | |
typedef TVector< InformationBase * > | Vector |
Vector for containing different information base derived classes. | |
![]() | |
static const IdInfo * | getInfoUnknown () |
Returns the static Info structure for unknowns. | |
![]() | |
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 (std::string_view type) |
Gets the type from the passed string name. | |
static std::string | getType (EType type) |
Gets the string typename of the passed enumerate value. | |
static 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. In fact the amount references in the system excluding the zero one. | |
static size_type | getInstanceCount () |
Gets the amount of result data instances in the system. | |
static PtrVector | getList () |
Gets a list of owner instances available. Useful in populating a selection dialog. | |
static std::string | getFieldName (int field) |
Gets the name of the passed field enumerate EField. | |
static const ResultData & | getInstanceById (id_type id) |
Gets instance with the given id otherwise the zero instance. | |
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 the zero 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. If not found it returns ZeroResultData. | |
static 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. Useful when reading a data file. | |
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 between applications. | |
static Definition | getDefinition (const std::string &str) |
Fills a definition structure from a string. On failure the _valid field is set to false. | |
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 std::string_view | getEventName (EEvent event) |
Gets the name of the passed EEvent number. | |
![]() | |
static constexpr size_t | npos = std::numeric_limits<size_type>::max() |
Unsigned size value indicating not found or no index. | |
Script object for exporting GII parameters to a script object.
|
explicit |
|
inlineoverrideprotectedvirtual |
Asks if the object should be deleted after having made this call.
Implements sf::ScriptObject.
|
overrideprotectedvirtual |
Must be overloaded for member namespace.
Implements sf::ScriptObject.
|
overrideprotectedvirtual |
Gets or sets the passed data member. Must be overloaded in derived class.
Implements sf::ScriptObject.
|
overridevirtual |
Gets the status text of this object for debugging purposes.
Reimplemented from sf::ScriptObject.