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

RSA implementation of a 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 (int compatible, id_type deviceNumber, const std::string &serverName={})
 Constructor.
 
 ~RsaServer () override
 
std::string getServerName () const
 
bool createImplementation (const std::string &name)
 Creates an attached implementation by name.
 
std::string getImplementationName () const
 Gets the name of the current implementation.
 
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.
 
- 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)
 
void attachResult (ResultData *res)
 
void detachResult (ResultData *res)
 
bool isGeneratingResults ()
 

Protected Member Functions

bool createImplementation (int index)
 Creates the implementation of index on the registered implementations.
 
void createInterface ()
 Create interface parameters at construction once.
 
void destroyInterface ()
 Remove all parameters and results.
 
Variable::PtrVector::size_type variableListFind (id_type id) const
 Looks up a parameter which is represented by the interface id.
 
bool createVariable (Variable *&var, RsaTypes::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 RsaTypes::ParamInfo &info, long vid)
 Creates a setup string from the passed parameter info structure.
 
void evaluateInterfaceParams ()
 Evaluate parameters after the configuration has changed.
 
std::string getNameOffset (const RsaTypes::ParamInfo &info)
 Gets the name of the channel using the device name.
 
std::string getDescription (const RsaTypes::ParamInfo &info)
 Gets the description prefix of the channel.
 
ResultData::PtrVector::size_type resultListFind (id_type id) const
 Looks up a result data which is represented by the interface id.
 
bool createResultData (ResultData *&res, RsaTypes::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 RsaTypes::ResultInfo &info, long vid)
 Creates a setup string from the passed result info structure.
 
void evaluateInterfaceResults ()
 Evaluate results after the configuration has changed.
 
std::string getNameOffset (const RsaTypes::ResultInfo &info)
 Returns the name of the channel using the device name.
 
std::string getDescription (const RsaTypes::ResultInfo &info)
 Returns the description prefix of the channel.
 
ExtraInfocastExtraInfo (const Variable *var)
 Easy to use function to access the extra info from a variable.
 
ExtraInfocastExtraInfo (const ResultData *var)
 Easy to use function to access the extra info from a result data.
 
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 sameInst)
 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.
 
Variable _vImplementation
 Variable for selecting an 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.
 
int _compatible
 Holds the compatibility state passed at the constructor.
 
std::string _serverName
 Holds the device name for creating the variable names.
 
bool _lock
 Variable indicating lock status.
 
IdType _handledParamId
 ID of 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 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 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 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 a information server.

Constructor & Destructor Documentation

◆ RsaServer()

sf::RsaServer::RsaServer ( int  compatible,
id_type  deviceNumber,
const std::string &  serverName = {} 
)
explicit

Constructor.

Parameters
compatibleCompatibility switch. 1=Strip-chart 0=Current 2=Nerason
deviceNumberThe device number used for creating an implementation. (default is UT)
serverNameServer name added to the settings and results. (Default is 'Acquisition')

◆ ~RsaServer()

sf::RsaServer::~RsaServer ( )
override

Destructor.

Member Function Documentation

◆ castExtraInfo() [1/2]

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

Easy to use function to access the extra info from a result data.

◆ castExtraInfo() [2/2]

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

Easy to use function to access the extra info from a variable.

◆ 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() [1/2]

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

Creates an attached implementation by name.

◆ createImplementation() [2/2]

bool sf::RsaServer::createImplementation ( int  index)
protected

Creates the implementation of index on the registered implementations.

Returns
True on success.

◆ createInterface()

void sf::RsaServer::createInterface ( )
protected

Create interface parameters at construction once.

◆ createResultData()

bool sf::RsaServer::createResultData ( ResultData *&  res,
RsaTypes::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 RsaTypes::ParamInfo info,
long  vid 
)
protected

Creates a setup string from the passed parameter info structure.

◆ createSetupString() [2/2]

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

Creates a setup string from the passed result info structure.

◆ createVariable()

bool sf::RsaServer::createVariable ( Variable *&  var,
RsaTypes::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 RsaTypes::ParamInfo info)
protected

Gets the description prefix of the channel.

◆ getDescription() [2/2]

std::string sf::RsaServer::getDescription ( const RsaTypes::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 RsaTypes::ParamInfo info)
protected

Gets the name of the channel using the device name.

◆ getNameOffset() [2/2]

std::string sf::RsaServer::getNameOffset ( const RsaTypes::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 ( id_type  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  sameInst 
)
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 ( id_type  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.

◆ _compatible

int sf::RsaServer::_compatible
protected

Holds the compatibility state passed at the constructor.

◆ _deviceNumber

IdType sf::RsaServer::_deviceNumber
protected

Holds the device number passed at the constructor.

◆ _handledParamId

IdType sf::RsaServer::_handledParamId
protected

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

◆ _vImplementation

Variable sf::RsaServer::_vImplementation
protected

Variable for selecting an implementation.


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