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

Handles requests and events for indexed data sources. More...

#include <ResultDataRequester.h>

Inheritance diagram for sf::ResultDataRequester:
Collaboration diagram for sf::ResultDataRequester:

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...
 
- 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.
 

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 RangegetIndexRange () const
 Gets the index range the requester is working on or has done.
 
const RangegetDataRange () 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 ResultDataHandlergetHandler () 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.
 
- Public Member Functions inherited from sf::InformationTypes
template<typename T >
constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)), data_typetoDataType (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 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

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.

Member Enumeration Documentation

◆ EReqEvent

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.

◆ EState

Enumerate for states.

Enumerator
drsError 

Error state for debugging.

drsReady 

Ready for request.

drsGetIndex 

Trying to get a valid new index.

drsReadIndex 

Reads the index result for the data range.

drsTryData 

Checks to data accessible ranges.

drsGetData 

Trying to get a valid new data.

drsApply 

Apply the retrieved data.

drsWait 

Waiting a data event or timeout to occur.

Constructor & Destructor Documentation

◆ ResultDataRequester()

sf::ResultDataRequester::ResultDataRequester ( )

Default constructor.

◆ ~ResultDataRequester()

virtual sf::ResultDataRequester::~ResultDataRequester ( )
virtual

Virtual destructor.

Member Function Documentation

◆ attachData()

void sf::ResultDataRequester::attachData ( ResultData rd)

Hooks the result-data entries to this instance.

◆ attachIndex()

void sf::ResultDataRequester::attachIndex ( ResultData rd)

Links the single index result-data entry to this instance.

◆ detachData()

void sf::ResultDataRequester::detachData ( ResultData rd)

Unhooks the result-data entries to this instance.

◆ getDataRange()

const Range & sf::ResultDataRequester::getDataRange ( ) const
inline

Gets the data range the requester is working on or has done.

◆ getHandler()

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

Returns the linked handler hook object.

◆ getIndexRange()

const Range & sf::ResultDataRequester::getIndexRange ( ) const
inline

Gets the index range the requester is working on or has done.

◆ getState()

ResultDataRequester::EState sf::ResultDataRequester::getState ( ) const
inline

Gets the current state from the requester.

◆ getStateName()

const char * sf::ResultDataRequester::getStateName ( int  state = -2)

Gets the name of the state.

Parameters
stateWhen -2 is passed the current state is returned.
Returns
String of the state.

◆ getStatus()

std::ostream & sf::ResultDataRequester::getStatus ( std::ostream &  os)

For debugging purposes only it writes the status to the output stream.

◆ release()

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.

◆ requestData()

bool sf::ResultDataRequester::requestData ( const Range range)

Directly requests a range of the data without using the index.

Parameters
range
Returns
True on success.

◆ requestIndex() [1/2]

bool sf::ResultDataRequester::requestIndex ( const Range range)

Requests a range of the data using multiple index ranges.

Parameters
range
Returns
True on success.

◆ requestIndex() [2/2]

bool sf::ResultDataRequester::requestIndex ( size_type  index)
inline

Requests a range of the data using a single index range.

Returns
True on success.

◆ reset()

void sf::ResultDataRequester::reset ( )

Called when results are attached or detached and when a time-out occurred. Sets all members to their initial state.

◆ setHandler()

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.

Parameters
handlerPassing nullptr wil disable the link.

◆ setTimeout()

void sf::ResultDataRequester::setTimeout ( const TimeSpec timeout)
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.


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