AAO DRAMA/DRAMA2 C++ Interface
|
A class implementing Monitor which invokes particular methods for parameters of given base types.
Methods are provided for each of basic SDS type - signed integers, unsigned integers, real and string.
Any other parameter type (including structured items and array types (other then strings) result in ComplexParamChanged() being invoked.
For each of these, the provided implementation will throw an exception. The user should sub-class this class and implement their own methods for each parameter type they are expecting.
If a sub-class implements the string value method, but not methods for integers, unsigned integers or real numbers, then the number will be converted to a string and passed to the string method.
Inherits the Monitor class constructors.
#include "threadmonitor.hh"
Public Member Functions | |
virtual | ~MonitorByType () |
Destructor. More... | |
![]() | |
Monitor (std::weak_ptr< Task > theTask, std::initializer_list< std::string > pars) | |
Create a Monitor object. More... | |
Monitor (const Monitor &source)=delete | |
Copy constructor - deleted. More... | |
virtual | ~Monitor () |
Destructor. More... | |
void | Cancel () |
Cancel the monitor. More... | |
int | GetMonitorId () const |
Return the monitor ID. More... | |
bool | IsCancelling () const |
Indicate if the monitor is being canceled. More... | |
bool | IsRunning () const |
Indicate if the monitor is running. More... | |
Monitor & | operator= (const Monitor &rhs)=delete |
Assignment operator - deleted. More... | |
template<typename EventProcType = MonitorMessageHandler> | |
void | Run (Path *thePath, thread::TMessHandler *action) |
Run a monitor operation - handler by type. More... | |
void | Run (Path *thePath, thread::TMessHandler *action, MonitorMessageHandler *evtProcessor) |
Run a monitor operation - handler by address. More... | |
Protected Member Functions | |
virtual void | ParamChanged (const std::string &name, long value) |
Method invoked when the value of a signed integer type parameter has been changed. More... | |
virtual void | ParamChanged (const std::string &name, unsigned long value) |
Method invoked when the value of an unsigned integer type parameter has been changed. More... | |
virtual void | ParamChanged (const std::string &name, double value) |
Method invoked when the value of a real type parameter has been changed. More... | |
virtual void | ParamChanged (const std::string &name, const std::string &value) |
Method invoked when the value of a string type parameter has been changed. More... | |
virtual void | ParamChanged (const std::string &name, const sds::IdPtr &value) |
Method invoked when the value of complex parameter has been changed. More... | |
virtual void | ParameterChanged (const sds::IdPtr &arg) override final |
Method invoked when a parameter is changed. More... | |
![]() | |
virtual std::shared_ptr< Task > | GetTask () const |
Get a reference to the task we are part of. More... | |
|
virtual |
Destructor.
|
protectedvirtual |
Method invoked when the value of a signed integer type parameter has been changed.
Invoked for any non-array parameter of SDS type SDS_BYTE, SDS_CHAR, SDS_INT, SDS_SHORT or SDS_I64.
But it will not be invoked for SDS_I64 if sizeof(long) is not at least 64 bits. Such a case suggests a design error (trying read 64 bit parameters from a 32 bit machine) so a DRAMA exception is thrown in those cases, with the DRAMA code DRAMA2__MON_INVTYPE64
The default implementation of this method will throw a DRAMA exception with the DRAMA code DRAMA2__MON_UNSUPTYPE. It is expected that the user will subclass this class to implement the required behaviors. But - if the sub-class has implemented the string version of ParamChanged(), that will be used in cases where the integer version is not implemented.
name | The name of the parameter the value of which has changed. |
value | The new value of the parameter. |
|
protectedvirtual |
Method invoked when the value of an unsigned integer type parameter has been changed.
Invoked for any non-array parameter of SDS type SDS_UBYTE, SDS_UINT, SDS_USHORT, SDS_UI64.
But it will not be invoked for SDS_UI64 if sizeof(unsigned long) is not at least 64 bits. Such a case suggests design error (trying read 64 bit parameters from a 32 bit machine) so a DRAMA exception is thrown in those cases, with the DRAMA code DRAMA2__MON_INVTYPE64
The default implementation of this method will throw a DRAMA exception with the DRAMA code DRAMA2__MON_UNSUPTYPE. It is expected that the user will subclass this class to implement the required behaviors. But - if the sub-class has implemented the string version of ParamChanged(), that will be used in cases where the unsigned integer version is not implemented.
name | The name of the parameter the value of which has changed. |
value | The new value of the parameter. |
|
protectedvirtual |
Method invoked when the value of a real type parameter has been changed.
Invoked for any non-array parameter of SDS type SDS_FLOAT or SDS_DOUBLE.
The default implementation of this method will throw a DRAMA exception with the DRAMA code DRAMA2__MON_UNSUPTYPE. It is expected that the user will subclass this class to implement the required behaviors. But - if the sub-class has implemented the string version of ParamChanged(), that will be used in cases where the real version is not implemented.
name | The name of the parameter the value of which has changed. |
value | The new value of the parameter. |
|
protectedvirtual |
Method invoked when the value of a string type parameter has been changed.
Invoked for parameter, the value of which is a single dimensional array of type SDS_CHAR.
The default implementation of this method will throw a DRAMA exception with the DRAMA code DRAMA2__MON_UNSUPTYPE. It is expected that the user will subclass this class to implement the required behaviors.
name | The name of the parameter the value of which has changed. |
value | The new value of the parameter. |
|
protectedvirtual |
Method invoked when the value of complex parameter has been changed.
This method is invoked for any parameter the type of which is not a simple integer, unsigned integer, real number or string.
The default implementation of this method will throw a DRAMA exception with the DRAMA code DRAMA2__MON_UNSUPTYPE. It is expected that the user will subclass this class to implement the required behaviors.
name | The name of the parameter the value of which has changed. |
value | SDS reference to the new value of the parameter. |
|
finaloverrideprotectedvirtual |
Method invoked when a parameter is changed.
This method is invoked each time a parameter changes. This is the MonitorToParam class implementation of the abstract method in the Monitor class.
This method is not normally invoked by user code and is not overridden by sub-classes. If you want to override this, it is suggested you implement an alternative sub-class of Monitor.
arg | A pointer to the SDS structure with the new parameter value. |
Implements drama::thread::Monitor.
Click here for the DRAMA home page and here for the AAO home page.
For more information, contact tjf@aao.gov.au Generated on Mon Feb 22 2016 15:57:53 for AAO DRAMA/DRAMA2 C++ Interface by