![]() |
Scanframe Modular Application 0.1.0
|
#include <InformationServer.h>
Public Types | |
enum | EState { issOff = 0 , issRun , issRecord , issPause , issStop , issMaxState } |
Enumerate for state of the info server. More... | |
enum | EClass { clA = 0 , clB , clC , clMaxClass } |
Variable/parameter class enumerator. More... | |
![]() | |
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 ssize_t | ssize_type |
Same as size_type but a signed version. | |
typedef uintptr_t | data_type |
Type used for containing a single data element which is the largest integer. | |
typedef intptr_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 | |
InformationServer () | |
Default constructor. | |
virtual | ~InformationServer () |
void | setup (const std::string &name, const std::string &namePrefix, long vid, long deviceMask, long serverMask) |
When device mask is non-zero, variables are added automatically on creation to this info server. | |
void | flush () |
Clears the instance. Also called from setup. | |
EState | getState () const |
Gets the current state. | |
const char * | getStateName (int state) const |
Gets the name of the passed state. | |
void | setState (EState) |
Sets the current state. | |
bool | isServerId (id_type id) const |
Determines if the passed id belongs to this info server. | |
void | attachVariable (Variable *var, EClass cls) |
Adds a variable to the variables vector. | |
void | detachVariable (Variable *var) |
Removes a variable from the variable vector. | |
void | attachResult (ResultData *res) |
Adds a result to the result vector. | |
void | detachResult (ResultData *res) |
Removes a result from the result vector. | |
bool | isGeneratingResults () |
Reports if this server generates results depending on its current state. | |
virtual void | onStateChange (EState prevState, EState nextState)=0 |
To be overloaded by a derived class to handle a state change if necessary. | |
virtual void | clearValidations () |
Clears the committed ranges of the attached results. This one can be overloaded by the derived class. When so this function must be called as well. | |
Additional Inherited Members | |
![]() | |
template<typename T > | |
static constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)), data_type > | toDataType (T value) |
Casts any type to a data_type value. | |
template<typename T > | |
static constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)||std::is_reference_v< T >), T > | fromDataType (data_type value) |
Casts a data_type value to a given type. Reference types are also possible since they are the same size as a pointer underwater. | |
![]() | |
static constexpr size_t | npos = std::numeric_limits<size_type>::max() |
Unsigned size value indicating not found or no index. | |
Variable/parameter class enumerator.
sf::InformationServer::InformationServer | ( | ) |
Default constructor.
|
virtual |
Destructor
void sf::InformationServer::attachResult | ( | ResultData * | res | ) |
Adds a result to the result vector.
Adds a variable to the variables vector.
|
virtual |
Clears the committed ranges of the attached results. This one can be overloaded by the derived class. When so this function must be called as well.
Reimplemented in sf::RsaServer.
void sf::InformationServer::detachResult | ( | ResultData * | res | ) |
Removes a result from the result vector.
void sf::InformationServer::detachVariable | ( | Variable * | var | ) |
Removes a variable from the variable vector.
void sf::InformationServer::flush | ( | ) |
Clears the instance. Also called from setup.
EState sf::InformationServer::getState | ( | ) | const |
Gets the current state.
const char * sf::InformationServer::getStateName | ( | int | state | ) | const |
Gets the name of the passed state.
bool sf::InformationServer::isGeneratingResults | ( | ) |
Reports if this server generates results depending on its current state.
bool sf::InformationServer::isServerId | ( | id_type | id | ) | const |
Determines if the passed id belongs to this info server.
|
pure virtual |
To be overloaded by a derived class to handle a state change if necessary.
Implemented in sf::RsaServer.
void sf::InformationServer::setState | ( | EState | ) |
Sets the current state.
void sf::InformationServer::setup | ( | const std::string & | name, |
const std::string & | namePrefix, | ||
long | vid, | ||
long | deviceMask, | ||
long | serverMask | ||
) |
When device mask is non-zero, variables are added automatically on creation to this info server.
name | Name of the server. |
namePrefix | Prefix of the name. |
vid | Variable id of state parameter. |
deviceMask | Device vid mask of this server. |
serverMask | Server vid mask of this server. |