Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
RsaServer.h
Go to the documentation of this file.
1#pragma once
5#include <rsa/iface/global.h>
6
7namespace sf
8{
9
10class RsaInterface;
11
16 : public InformationServer
17 , public RsaTypes
18{
19 public:
25 explicit RsaServer(id_type device_number, const std::string& server_name = {});
26
30 ~RsaServer() override;
31
35 std::string getServerName() const;
36
40 std::string getImplementationName() const;
41
45 bool createImplementation(const std::string& name = {});
46
51 {
52 createImplementation();
53 }
54
59 {
60 return _acquisition;
61 }
62
66 bool isLocked() const
67 {
68 return _lock;
69 }
70
74 void setLocked(bool);
75
80
81 protected:
86
91
96
100 bool createVariable(Variable*& var, const ParamInfo& info, const std::string& setup);
101
106
110 std::string createSetupString(const ParamInfo& info, IdType vid);
111
116
120 std::string getNameOffset(const ParamInfo& info);
121
125 std::string getDescription(const ParamInfo& info);
126
131
135 bool createResultData(ResultData*& res, const ResultInfo& info, const std::string& setup);
136
141
145 std::string createSetupString(const ResultInfo& info, IdType vid);
146
151
155 std::string getNameOffset(const ResultInfo& info);
156
160 std::string getDescription(const ResultInfo& info);
161
166 {
168 unsigned _channel;
172 std::string _setupString;
175 };
176
181 ExtraInfo* castExtraInfo(const Variable* var) const;
182
188
192 void onStateChange(EState prevState, EState nextState) override;
193
198
203
208
212 static void paramNotifyProc(void* data, id_type id);
213
217 static void resultNotifyProc(void* data, id_type id);
218
222 void clearValidations() override;
234 void serverVariableHandler(Variable::EEvent event, const Variable& caller, Variable& linker, bool same_inst);
246 void serverResultDataHandler(ResultData::EEvent event, const ResultData& caller, ResultData& link, const Range& rng, bool same_inst);
262 std::string _serverName;
266 bool _lock;
271};
272
273}// namespace sf
Definition InformationServer.h:10
EState
Enumerate for state of the info server.
Definition InformationServer.h:42
unsigned long long id_type
Type used for the identifying integer (64-bits).
Definition InformationBase.h:30
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Class to manage 64-bit integer ranges.
Definition Range.h:53
EEvent
Event enumerate values used in broadcasting where global events have a negative value.
Definition ResultDataTypes.h:46
Class for creating and referencing global created data called result data. This class allows linking ...
Definition ResultData.h:20
Base class for the repetitive signal acquisition interface.
Definition RsaInterface.h:17
RSA implementation of an information server.
Definition RsaServer.h:18
void destroyImplementation()
Destroys the created implementation.
Definition RsaServer.h:50
std::string getNameOffset(const ResultInfo &info)
Returns the name of the channel using the device name.
void createInterface()
Create interface parameters at construction once.
std::string getServerName() const
Gets the name given at the constructor.
std::string createSetupString(const ParamInfo &info, IdType vid)
Creates a setup string from the passed parameter info structure.
void serverVariableHandler(Variable::EEvent event, const Variable &caller, Variable &linker, bool same_inst)
Event handler for variables.
std::string _serverName
Holds the device name for creating the variable names.
Definition RsaServer.h:262
IdType _handledParamId
The id of the interface parameter being processed by the param hook.
Definition RsaServer.h:270
IdType _deviceNumber
Holds the device number passed at the constructor.
Definition RsaServer.h:254
void evaluateInterfaceParams()
Evaluate parameters after the configuration has changed.
void serverResultDataHandler(ResultData::EEvent event, const ResultData &caller, ResultData &link, const Range &rng, bool same_inst)
Event handler for results.
bool createImplementation(const std::string &name={})
Creates an attached implementation by name.
RsaInterface * getAcquisition()
Gets a pointer to the current acquisition implementation.
Definition RsaServer.h:58
static void paramNotifyProc(void *data, id_type id)
Parameter hook function called directly by the implementation.
std::string getNameOffset(const ParamInfo &info)
Gets the name of the channel using the device name.
void setLocked(bool)
Locks the variables by making them all read only.
void resultNotify(id_type id)
Hook function indirectly called from the implementation.
bool isLocked() const
Returns true whe all parameters are locked.
Definition RsaServer.h:66
ResultData::PtrVector::size_type resultListFind(IdType id) const
Looks up a result data which is represented by the interface id.
void destroyVariable(Variable *var)
Destroys a variable including the attached extra info structure.
ExtraInfo * castExtraInfo(const Variable *var) const
Easy to use function to access the extra info from a variable. TODO: Use Variable::getData<type>() te...
void addPropertyPages(PropertySheetDialog *sheet)
Add the property sheets for this server to the given dialog.
IdType _implementationId
Holds the VID of the implementation.
Definition RsaServer.h:258
void onStateChange(EState prevState, EState nextState) override
Overloaded from TInfoServer.
static void resultNotifyProc(void *data, id_type id)
Result hook function called directly by the implementation.
bool _lock
Variable indicating lock status.
Definition RsaServer.h:266
bool createVariable(Variable *&var, const ParamInfo &info, const std::string &setup)
Creates a variable with a extra info structure attached.
Variable::PtrVector _variableVector
Holds all created variables for the selected implementation.
Definition RsaServer.h:238
ExtraInfo * castExtraInfo(const ResultData *res) const
Easy to use function to access the extra info from a result data. TODO: Use ResultData::getData<type>...
void checkReadOnly()
Sets the variables to readonly based on the flags and lock status.
void clearValidations() override
Overridden from InformationServer.
RsaInterface * _acquisition
Holds the acquisition implementation.
Definition RsaServer.h:226
TResultDataHandler< RsaServer > _serverResultDataHandler
Callback hook for result events.
Definition RsaServer.h:242
bool createResultData(ResultData *&res, const ResultInfo &info, const std::string &setup)
Creates a variable with a extra info structure attached.
void paramNotify(id_type id)
Hook function indirectly called from the implementation.
Variable::PtrVector::size_type variableListFind(IdType id) const
Looks up a parameter which is represented by the interface id.
std::string createSetupString(const ResultInfo &info, IdType vid)
Creates a setup string from the passed result info structure.
~RsaServer() override
Destructor.
ResultData::PtrVector _resultVector
Holds all created results for this instance.
Definition RsaServer.h:250
std::string getDescription(const ParamInfo &info)
Gets the description prefix of the channel.
void destroyInterface()
Remove all parameters and results.
RsaServer(id_type device_number, const std::string &server_name={})
Constructor.
TVariableHandler< RsaServer > _serverVariableHandler
Callback hook for variable events.
Definition RsaServer.h:230
std::string getDescription(const ResultInfo &info)
Returns the description prefix of the channel.
void destroyResultData(ResultData *var)
Destroys a variable including the attached extra info structure.
void evaluateInterfaceResults()
Evaluate results after the configuration has changed.
std::string getImplementationName() const
Gets the name of the current implementation.
Definition ResultDataHandler.h:33
Template for linking pointers of member function to Variable instances.
Definition VariableHandler.h:38
base_type::size_type size_type
Size type of this template.
Definition TVector.h:29
EEvent
Events send to the handler set with sf::Variable::setHandler.
Definition VariableTypes.h:130
Class for creating and referencing global or local created parameters or settings called variables....
Definition Variable.h:16
Definition Application.h:10
#define _RSA_CLASS
Definition rsa/iface/global.h:35
Structure placed in the Variable's Data field for fast access to information.
Definition RsaServer.h:166
std::string _setupString
Definition RsaServer.h:172
int _flags
Definition RsaServer.h:174
unsigned _channel
Definition RsaServer.h:168
IdType _id
Definition RsaServer.h:170
Structure to hold parameter information.
Definition RsaTypes.h:122
Definition RsaTypes.h:233
Type holding all types for the RsaInterface in a single namespaced structure.
Definition RsaTypes.h:22
unsigned long long IdType
Type for gathering parameter ID's.
Definition RsaTypes.h:26