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

Detailed Description

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

std::string specialization.

A task will create an object of this type to create an array of string parameters.

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

   class MyTaskClass : public drama::Task {
   public:
       drama::ArrayParameter<std::string> my_par; // Declare array parameter 
   ...
   // Task Constructor - creates parameter.
   MyTaskClass() : drama::Task("MYTASKNAME"), 
                   my_par(TaskPtr(), "PARNAME",  6,) {
       ...
       // 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, unsigned strLen=100, const std::string initVal="")
 Construct a parameter of a given name which is an array of scalar items.
 
virtual ~ArrayParameter ()
 Array Parameter Destructor.
 
void Fill (const std::string &filler, bool updateMonitors=true)
 Fill the array parameter value with a fixed value for all elements.
 
std::string Get (size_t index) const
 Return a single value from an array parameter.
 
virtual std::string operator[] (size_t index) const
 Return a single item from the Array parameter.
 
template<class ContainerType , typename std::enable_if< std::is_base_of< std::string, typename ContainerType::value_type >::value >::type * = nullptr>
void Set (const ContainerType &vals, bool updateMonitors=true)
 Set the value of the parameter to the specified value.
 
void Set (size_t index, const std::string &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: