Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::RsaServer Class Referencefinal

RSA implementation of an information server. More...

#include <RsaServer.h>

Inheritance diagram for sf::RsaServer:
Collaboration diagram for sf::RsaServer:

Classes

struct  ExtraInfo
 Structure placed in the Variable's Data field for fast access to information. More...
 

Public Member Functions

 RsaServer (id_type device_number, const std::string &server_name={})
 Constructor.
 
 ~RsaServer () override
 Destructor.
 
std::string getServerName () const
 Gets the name given at the constructor.
 
std::string getImplementationName () const
 Gets the name of the current implementation.
 
bool createImplementation (const std::string &name={})
 Creates an attached implementation by name.
 
void destroyImplementation ()
 Destroys the created implementation.
 
RsaInterfacegetAcquisition ()
 Gets a pointer to the current acquisition implementation.
 
bool isLocked () const
 Returns true whe all parameters are locked.
 
void setLocked (bool)
 Locks the variables by making them all read only.
 
void addPropertyPages (PropertySheetDialog *sheet)
 Add the property sheets for this server to the given dialog.
 
- Public Member Functions inherited from sf::InformationServer
 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.
 

Protected Member Functions

void createInterface ()
 Create interface parameters at construction once.
 
void destroyInterface ()
 Remove all parameters and results.
 
Variable::PtrVector::size_type variableListFind (IdType id) const
 Looks up a parameter which is represented by the interface id.
 
bool createVariable (Variable *&var, const ParamInfo &info, const std::string &setup)
 Creates a variable with a extra info structure attached.
 
void destroyVariable (Variable *var)
 Destroys a variable including the attached extra info structure.
 
std::string createSetupString (const ParamInfo &info, IdType vid)
 Creates a setup string from the passed parameter info structure.
 
void evaluateInterfaceParams ()
 Evaluate parameters after the configuration has changed.
 
std::string getNameOffset (const ParamInfo &info)
 Gets the name of the channel using the device name.
 
std::string getDescription (const ParamInfo &info)
 Gets the description prefix of the channel.
 
ResultData::PtrVector::size_type resultListFind (IdType id) const
 Looks up a result data which is represented by the interface id.
 
bool createResultData (ResultData *&res, const ResultInfo &info, const std::string &setup)
 Creates a variable with a extra info structure attached.
 
void destroyResultData (ResultData *var)
 Destroys a variable including the attached extra info structure.
 
std::string createSetupString (const ResultInfo &info, IdType vid)
 Creates a setup string from the passed result info structure.
 
void evaluateInterfaceResults ()
 Evaluate results after the configuration has changed.
 
std::string getNameOffset (const ResultInfo &info)
 Returns the name of the channel using the device name.
 
std::string getDescription (const ResultInfo &info)
 Returns the description prefix of the channel.
 
ExtraInfocastExtraInfo (const Variable *var) const
 Easy to use function to access the extra info from a variable. TODO: Use Variable::getData<type>() template function for casting.
 
ExtraInfocastExtraInfo (const ResultData *res) const
 Easy to use function to access the extra info from a result data. TODO: Use ResultData::getData<type>() template function for casting.
 
void onStateChange (EState prevState, EState nextState) override
 Overloaded from TInfoServer.
 
void paramNotify (id_type id)
 Hook function indirectly called from the implementation.
 
void resultNotify (id_type id)
 Hook function indirectly called from the implementation.
 
void checkReadOnly ()
 Sets the variables to readonly based on the flags and lock status.
 
void clearValidations () override
 Overridden from InformationServer.
 
void serverVariableHandler (Variable::EEvent event, const Variable &caller, Variable &linker, bool same_inst)
 Event handler for variables.
 
void serverResultDataHandler (ResultData::EEvent event, const ResultData &caller, ResultData &link, const Range &rng, bool same_inst)
 Event handler for results.
 

Static Protected Member Functions

static void paramNotifyProc (void *data, id_type id)
 Parameter hook function called directly by the implementation.
 
static void resultNotifyProc (void *data, id_type id)
 Result hook function called directly by the implementation.
 

Protected Attributes

RsaInterface_acquisition
 Holds the acquisition implementation.
 
TVariableHandler< RsaServer_serverVariableHandler
 Callback hook for variable events.
 
Variable::PtrVector _variableVector
 Holds all created variables for the selected implementation.
 
TResultDataHandler< RsaServer_serverResultDataHandler
 Callback hook for result events.
 
ResultData::PtrVector _resultVector
 Holds all created results for this instance.
 
IdType _deviceNumber
 Holds the device number passed at the constructor.
 
IdType _implementationId
 Holds the VID of the implementation.
 
std::string _serverName
 Holds the device name for creating the variable names.
 
bool _lock
 Variable indicating lock status.
 
IdType _handledParamId
 The id of the interface parameter being processed by the param hook.
 

Additional Inherited Members

- Public Types inherited from sf::InformationServer
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...
 
- 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 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_typeIdVector
 Vector for lists of information ID's.
 
typedef TVector< InformationBase * > Vector
 Vector for containing different information base derived classes.
 
- Public Types inherited from sf::RsaTypes
enum  EParamFlag {
  pfReadonly = 1 << 0 , pfEffectsParameter = 1 << 1 , pfEffectsResult = 1 << 2 , pfEffectsData = 1 << 3 ,
  pfChannelSingle = 1 << 4 , pfGate = 1 << 5 , pfMethod = 1 << 6 , pfExport = 1 << 7 ,
  pfSystem = 1 << 8 , pfWriteable = 1 << 9 , pfAlias = 1 << 10 , pfArchive = 1 << 11 ,
  pfWriteAtOff = 1 << 12
}
 Parameter flags for defining parameter behaviour. More...
 
enum  EResultFlag {
  rfGate = 1 << 0 , rfIndex = 1 << 1 , rfAsync = 1 << 2 , rfAsyncIndex = 1 << 3 ,
  rfHugeData = 1 << 4 , rfStored = 1 << 5
}
 Result flags for defining result behaviour. More...
 
enum  EAcquisitionType { atUltrasonic , atEddyCurrent }
 
enum  EDefaultParam : uint64_t {
  apNone = 0x0000 , apChannels = 0x0002 , apError = 0x0003 , apErrorMessage = 0x0004 ,
  apAmplitudeUnit = 0x0005 , apUserFirst = 0x000F , apChannel_Mask = 0x4000 , apChannel_RepRate = 0x4001 ,
  apChannel_SyncMode = 0x4002 , apChannel_Gates = 0x4003 , apChannel_Inputs = 0x4004 , apChannel_TimeUnits = 0x4005 ,
  apChannel_CopyDelay = 0x4006 , apChannel_CopyRange = 0x4007 , apChannel_SampleRate = 0x4008 , apChannel_CopyEnable = 0x4009 ,
  apChannel_PopManual = 0x400A , apChannel_BiDirMode = 0x400B , apChannel_UserFirst = 0x401F , apGate_Mask = 0x8000 ,
  apGate_Name = 0x8001 , apGate_Delay = 0x8002 , apGate_Range = 0x8003 , apGate_SlaveTo = 0x8004 ,
  apGate_Enable = 0x8005 , apGate_Method = 0x8006 , apGate_Threshold = 0x8007 , apGate_Amplitude = 0x8008 ,
  apGate_TimeOfFlight = 0x8009 , apGate_UserFirst = 0x801F
}
 
enum  EDefaultResult : uint64_t {
  arNone = 0x0000 , arUserFirst = 0x0001 , arChannel_Mask = 0x4000 , arChannel_PopIndex = 0x4001 ,
  arChannel_CopyData = 0x4002 , arChannel_CopyIndex = 0x4003 , arChannel_UserFirst = 0x401F , arGate_Amplitude = 0x8001 ,
  arGate_TimeOfFlight = 0x8002 , arGate_Copy = 0x8003 , arGate_Mask = 0x8000 , arGate_UserFirst = 0x801F
}
 
enum  EPopManual { pmDisabled = 0 , pmReady , pmTrigger }
 Enumerate for the pop manual function. More...
 
typedef unsigned long long IdType
 Type for gathering parameter ID's.
 
typedef TVector< IdTypeIdList
 Type for gathering parameter ID's.
 
typedef void(* NotifyProc) (void *data, IdType id)
 Function type for the function type which is called when a parameter changes as a result of changes in the interface itself.
 
typedef TVector< ParamStateParamStates
 Vector to specify states.
 
- Static Public Member Functions inherited from sf::InformationTypes
template<typename T >
static constexpr std::enable_if_t<(sizeof(T)<=sizeof(data_type)), data_typetoDataType (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 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

RSA implementation of an information server.

Constructor & Destructor Documentation

◆ RsaServer()

sf::RsaServer::RsaServer ( id_type  device_number,
const std::string &  server_name = {} 
)
explicit

Constructor.

Parameters
device_numberThe device number used for creating an implementation. (default is UT)
server_nameServer name added to the settings and results. (Default is 'Acquisition')

◆ ~RsaServer()

sf::RsaServer::~RsaServer ( )
override

Destructor.

Member Function Documentation

◆ addPropertyPages()

void sf::RsaServer::addPropertyPages ( PropertySheetDialog sheet)

Add the property sheets for this server to the given dialog.

◆ castExtraInfo() [1/2]

ExtraInfo * sf::RsaServer::castExtraInfo ( const ResultData res) const
protected

Easy to use function to access the extra info from a result data. TODO: Use ResultData::getData<type>() template function for casting.

◆ castExtraInfo() [2/2]

ExtraInfo * sf::RsaServer::castExtraInfo ( const Variable var) const
protected

Easy to use function to access the extra info from a variable. TODO: Use Variable::getData<type>() template function for casting.

◆ checkReadOnly()

void sf::RsaServer::checkReadOnly ( )
protected

Sets the variables to readonly based on the flags and lock status.

◆ clearValidations()

void sf::RsaServer::clearValidations ( )
overrideprotectedvirtual

Overridden from InformationServer.

Reimplemented from sf::InformationServer.

◆ createImplementation()

bool sf::RsaServer::createImplementation ( const std::string &  name = {})

Creates an attached implementation by name.

◆ createInterface()

void sf::RsaServer::createInterface ( )
protected

Create interface parameters at construction once.

◆ createResultData()

bool sf::RsaServer::createResultData ( ResultData *&  res,
const ResultInfo info,
const std::string &  setup 
)
protected

Creates a variable with a extra info structure attached.

◆ createSetupString() [1/2]

std::string sf::RsaServer::createSetupString ( const ParamInfo info,
IdType  vid 
)
protected

Creates a setup string from the passed parameter info structure.

◆ createSetupString() [2/2]

std::string sf::RsaServer::createSetupString ( const ResultInfo info,
IdType  vid 
)
protected

Creates a setup string from the passed result info structure.

◆ createVariable()

bool sf::RsaServer::createVariable ( Variable *&  var,
const ParamInfo info,
const std::string &  setup 
)
protected

Creates a variable with a extra info structure attached.

◆ destroyImplementation()

void sf::RsaServer::destroyImplementation ( )
inline

Destroys the created implementation.

◆ destroyInterface()

void sf::RsaServer::destroyInterface ( )
protected

Remove all parameters and results.

◆ destroyResultData()

void sf::RsaServer::destroyResultData ( ResultData var)
protected

Destroys a variable including the attached extra info structure.

◆ destroyVariable()

void sf::RsaServer::destroyVariable ( Variable var)
protected

Destroys a variable including the attached extra info structure.

◆ evaluateInterfaceParams()

void sf::RsaServer::evaluateInterfaceParams ( )
protected

Evaluate parameters after the configuration has changed.

◆ evaluateInterfaceResults()

void sf::RsaServer::evaluateInterfaceResults ( )
protected

Evaluate results after the configuration has changed.

◆ getAcquisition()

RsaInterface * sf::RsaServer::getAcquisition ( )
inline

Gets a pointer to the current acquisition implementation.

◆ getDescription() [1/2]

std::string sf::RsaServer::getDescription ( const ParamInfo info)
protected

Gets the description prefix of the channel.

◆ getDescription() [2/2]

std::string sf::RsaServer::getDescription ( const ResultInfo info)
protected

Returns the description prefix of the channel.

◆ getImplementationName()

std::string sf::RsaServer::getImplementationName ( ) const

Gets the name of the current implementation.

◆ getNameOffset() [1/2]

std::string sf::RsaServer::getNameOffset ( const ParamInfo info)
protected

Gets the name of the channel using the device name.

◆ getNameOffset() [2/2]

std::string sf::RsaServer::getNameOffset ( const ResultInfo info)
protected

Returns the name of the channel using the device name.

◆ getServerName()

std::string sf::RsaServer::getServerName ( ) const

Gets the name given at the constructor.

◆ isLocked()

bool sf::RsaServer::isLocked ( ) const
inline

Returns true whe all parameters are locked.

◆ onStateChange()

void sf::RsaServer::onStateChange ( EState  prevState,
EState  nextState 
)
overrideprotectedvirtual

Overloaded from TInfoServer.

Implements sf::InformationServer.

◆ paramNotify()

void sf::RsaServer::paramNotify ( id_type  id)
protected

Hook function indirectly called from the implementation.

◆ paramNotifyProc()

static void sf::RsaServer::paramNotifyProc ( void *  data,
id_type  id 
)
staticprotected

Parameter hook function called directly by the implementation.

◆ resultListFind()

ResultData::PtrVector::size_type sf::RsaServer::resultListFind ( IdType  id) const
protected

Looks up a result data which is represented by the interface id.

◆ resultNotify()

void sf::RsaServer::resultNotify ( id_type  id)
protected

Hook function indirectly called from the implementation.

◆ resultNotifyProc()

static void sf::RsaServer::resultNotifyProc ( void *  data,
id_type  id 
)
staticprotected

Result hook function called directly by the implementation.

◆ serverResultDataHandler()

void sf::RsaServer::serverResultDataHandler ( ResultData::EEvent  event,
const ResultData caller,
ResultData link,
const Range rng,
bool  same_inst 
)
protected

Event handler for results.

◆ serverVariableHandler()

void sf::RsaServer::serverVariableHandler ( Variable::EEvent  event,
const Variable caller,
Variable linker,
bool  same_inst 
)
protected

Event handler for variables.

◆ setLocked()

void sf::RsaServer::setLocked ( bool  )

Locks the variables by making them all read only.

◆ variableListFind()

Variable::PtrVector::size_type sf::RsaServer::variableListFind ( IdType  id) const
protected

Looks up a parameter which is represented by the interface id.

Member Data Documentation

◆ _acquisition

RsaInterface* sf::RsaServer::_acquisition
protected

Holds the acquisition implementation.

◆ _deviceNumber

IdType sf::RsaServer::_deviceNumber
protected

Holds the device number passed at the constructor.

◆ _handledParamId

IdType sf::RsaServer::_handledParamId
protected

The id of the interface parameter being processed by the param hook.

◆ _implementationId

IdType sf::RsaServer::_implementationId
protected

Holds the VID of the implementation.

◆ _lock

bool sf::RsaServer::_lock
protected

Variable indicating lock status.

◆ _resultVector

ResultData::PtrVector sf::RsaServer::_resultVector
protected

Holds all created results for this instance.

◆ _serverName

std::string sf::RsaServer::_serverName
protected

Holds the device name for creating the variable names.

◆ _serverResultDataHandler

TResultDataHandler<RsaServer> sf::RsaServer::_serverResultDataHandler
protected

Callback hook for result events.

◆ _serverVariableHandler

TVariableHandler<RsaServer> sf::RsaServer::_serverVariableHandler
protected

Callback hook for variable events.

◆ _variableVector

Variable::PtrVector sf::RsaServer::_variableVector
protected

Holds all created variables for the selected implementation.


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