![]() |
Scanframe Modular Application 0.1.0
|
Handles requests and events for indexed data sources. More...
#include <ResultDataRequester.h>
Public Types | |
enum | EReqEvent { reDataValid = reUserLocal , reTimedOut = reUserLocal + 1 } |
Additional local user result data events. More... | |
enum | EState { drsError = -1 , drsReady , drsGetIndex , drsReadIndex , drsTryData , drsGetData , drsApply , drsWait } |
Enumerate for states. More... | |
![]() | |
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. | |
Public Member Functions | |
ResultDataRequester () | |
Default constructor. | |
virtual | ~ResultDataRequester () |
Virtual destructor. | |
void | attachIndex (ResultData *rd) |
Links the single index result-data entry to this instance. | |
void | attachData (ResultData *rd) |
Hooks the result-data entries to this instance. | |
void | detachData (ResultData *rd) |
Unhooks the result-data entries to this instance. | |
void | release () |
Releases all the result-data entries and set handlers. | |
bool | requestIndex (size_type index) |
Requests a range of the data using a single index range. | |
bool | requestIndex (const Range &range) |
Requests a range of the data using multiple index ranges. | |
bool | requestData (const Range &range) |
Directly requests a range of the data without using the index. | |
void | setTimeout (const TimeSpec &timeout) |
Sets the time-out in ms in which a request is allowed too take before it is timed out. A value of zero. makes it wait indefinitely. | |
void | reset () |
Called when results are attached or detached and when a time-out occurred. Sets all members to their initial state. | |
const Range & | getIndexRange () const |
Gets the index range the requester is working on or has done. | |
const Range & | getDataRange () const |
Gets the data range the requester is working on or has done. | |
void | setHandler (ResultDataHandler *handler) |
Sets an event handler for this instance to which all result events are rerouted after it handled its own stuff. | |
const ResultDataHandler * | getHandler () const |
Returns the linked handler hook object. | |
const char * | getStateName (int state=-2) |
Gets the name of the state. | |
EState | getState () const |
std::ostream & | getStatus (std::ostream &os) |
For debugging purposes only it writes the status to the output stream. | |
![]() | |
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. | |
Additional Inherited Members | |
![]() | |
static constexpr size_t | npos = std::numeric_limits<size_type>::max() |
Unsigned size value indicating not found or no index. | |
Handles requests and events for indexed data sources.
sf::ResultData instances can be attached to this type of instance to handle request on multiple results for when all data must be available at a time for processing.
Additional local user result data events.
Enumerator | |
---|---|
reDataValid | Requested data is valid and the passed. Range contains the requested index range. |
reTimedOut | State machine timed out on getting data. The passed range contains the requested index range. |
Enumerate for states.
sf::ResultDataRequester::ResultDataRequester | ( | ) |
Default constructor.
|
virtual |
Virtual destructor.
void sf::ResultDataRequester::attachData | ( | ResultData * | rd | ) |
Hooks the result-data entries to this instance.
void sf::ResultDataRequester::attachIndex | ( | ResultData * | rd | ) |
Links the single index result-data entry to this instance.
void sf::ResultDataRequester::detachData | ( | ResultData * | rd | ) |
Unhooks the result-data entries to this instance.
|
inline |
Gets the data range the requester is working on or has done.
|
inline |
Returns the linked handler hook object.
|
inline |
Gets the index range the requester is working on or has done.
|
inline |
Gets the current state from the requester.
const char * sf::ResultDataRequester::getStateName | ( | int | state = -2 | ) |
Gets the name of the state.
state | When -2 is passed the current state is returned. |
std::ostream & sf::ResultDataRequester::getStatus | ( | std::ostream & | os | ) |
For debugging purposes only it writes the status to the output stream.
void sf::ResultDataRequester::release | ( | ) |
Releases all the result-data entries and set handlers.
When both result-data instances and the requester are part of a class. This method must called from the owners destructor to prevent crashing.
bool sf::ResultDataRequester::requestData | ( | const Range & | range | ) |
Directly requests a range of the data without using the index.
range |
bool sf::ResultDataRequester::requestIndex | ( | const Range & | range | ) |
Requests a range of the data using multiple index ranges.
range |
|
inline |
Requests a range of the data using a single index range.
void sf::ResultDataRequester::reset | ( | ) |
Called when results are attached or detached and when a time-out occurred. Sets all members to their initial state.
void sf::ResultDataRequester::setHandler | ( | ResultDataHandler * | handler | ) |
Sets an event handler for this instance to which all result events are rerouted after it handled its own stuff.
handler | Passing nullptr wil disable the link. |
|
inline |
Sets the time-out in ms in which a request is allowed too take before it is timed out. A value of zero. makes it wait indefinitely.