AAO DRAMA/DRAMA2 C++ Interface
Public Types | Public Member Functions | List of all members
drama::Parameter< SDS_T > Class Template Reference

Detailed Description

template<typename SDS_T>
class drama::Parameter< SDS_T >

The class Parameter is used to implement DRAMA parameters containing primitive items.

A task will create an object of this type to create a parameter. The template argument is a primitive data type supported by the SDS library, one of char, short, unsigned short, INT32, UINT32, INT64, UINT64, float or double. std::string is also supported. Complex SDS items can be created using the drama::sds::Id specialization.

An example of the user of this class is shown below.

   class MyTaskClass : public drama::Task {
   public:
       drama::Parameter<double> my_par; // Declare double parameter 
   ...
   // Task Constructor - creates parameter.
   MyTaskClass() : drama::Task("MYTASKNAME"), my_par(this, "MY_PARAM", 111.1) {
       ...
       // Read parameter
       double v = my_par;
       // Write parameter.
       my_par = 2.0;
       ...
     }
   };
Template Parameters
SDS_TThe primitive data type of the parameter.
Author
Tony Farrell, AAO
Revision
1.45
Date
22-Feb-2016 14:09:57+11
Examples:
monitor1.cpp.

#include "parameter.hh"

Public Types

typedef Parameter< SDS_T > class_type
 The type of this template instantiation. More...
 

Public Member Functions

 Parameter (std::weak_ptr< Task > task, const std::string &name, const SDS_T &initVal)
 Construct a parameter of a given name. More...
 
virtual ~Parameter ()
 Parameter Destructor. More...
 
 operator SDS_T () const
 Return the current value of the parameter. More...
 
class_typeoperator= (SDS_T val)
 Set the value of the parameter to the specified value. More...
 

Member Typedef Documentation

template<typename SDS_T>
typedef Parameter<SDS_T> drama::Parameter< SDS_T >::class_type

The type of this template instantiation.

Constructor & Destructor Documentation

template<typename SDS_T>
drama::Parameter< SDS_T >::Parameter ( std::weak_ptr< Task task,
const std::string &  name,
const SDS_T &  initVal 
)
inline

Construct a parameter of a given name.

Parameters
taskThe DRAMA Task we are part of. This is passed by pointer, but Parameter is not taking ownership of the subject object, which must continue to exist until the Parameter object is destroyed.
nameThe name of the parameter.
initValThe initial value of the parameter.
template<typename SDS_T>
virtual drama::Parameter< SDS_T >::~Parameter ( )
inlinevirtual

Parameter Destructor.

Does not actually delete the parameter, just prevents internal access via this object. Parameters are actually deleted when the DRAMA task shuts down.

Member Function Documentation

template<typename SDS_T>
drama::Parameter< SDS_T >::operator SDS_T ( ) const
inline

Return the current value of the parameter.

Returns
The current value of the parameter
template<typename SDS_T>
class_type& drama::Parameter< SDS_T >::operator= ( SDS_T  val)
inline

Set the value of the parameter to the specified value.

Any monitors of the parameter are updated.

Parameters
valThe new value for the parameter.
Returns
The new value of the parameter

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

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:52 for AAO DRAMA/DRAMA2 C++ Interface by doxygen 1.8.10