AAO DRAMA/DRAMA2 C++ Interface
DRAMA C++11 and later interface
Public Member Functions | List of all members
drama::ArrayParameter< SDS_T > Class Template Reference

Detailed Description

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

The class ArrayParameter is used to implement DRAMA parameters containing arrays of primitive items (one dimension only).

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.

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

   class MyTaskClass : public drama::Task {
   public:
       drama::ArrayParameter<INT32> my_par; // Declare array parameter 
   ...
   // Task Constructor - creates parameter.
   MyTaskClass() : drama::Task("MYTASKNAME"), 
                   my_par(TaskPtr(), "PARNAME", 5, 0) {
       ...
       // Read parameter - returns an std::vector<INT32>
       auto parVal = my_par.Get();  
       // Write parameter.
       my_par.Set(parVal);
       ...
     }
   };

Template Parameters
SDS_TThe primitive data type of the parameter.
Author
Tony Farrell, AAO $Revision$ $Date$

#include "parameter.hh"

Public Member Functions

 ArrayParameter (std::weak_ptr< Task > task, const std::string &name, unsigned nElements, const SDS_T initVal)
 Construct a parameter of a given name which is an array of scalar items.
 
virtual ~ArrayParameter ()
 Array Parameter Destructor.
 
template<typename F >
void Fill (const F filler, bool updateMonitors=true)
 Fill the array parameter value with a fixed value for all elements.
 
SDS_T Get (size_t index) const
 Return a single value from an array parameter.
 
SDS_T operator[] (size_t index) const
 Return a single item from the Array parameter.
 
template<class ContainerType >
void Set (const ContainerType &vals)
 Set the value of the parameter to the specified value.
 
void Set (size_t index, SDS_T val, bool updateMonitors=true)
 Set the value of the parameter to the specified value.
 

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