AAO DRAMA/DRAMA2 C++ Interface
Public Member Functions | List of all members
drama::gitarg::Real< MinVal, MaxVal, DefaultVal > Class Template Reference

Detailed Description

template<long int MinVal, long int MaxVal, long int DefaultVal = 0>
class drama::gitarg::Real< MinVal, MaxVal, DefaultVal >

A class which reads real values from an SDS argument structure.

A C++ class which provides an interface to GitArgGetD() . It Implements a double type which includes the method Get(), to fetch its value from an SDS structure. There is also a constructor which does the Get operation.

It should be noted that as templates don't allow double arguments, the template parameters which specify the range must be long ints, limiting the range you can use to that of long ints. If you need a greater range or non-integer range limits, you must use another approach, but in many cases this class will probably suffice.

See also
GitArgGetD()
Template Parameters
MinValueThe minimum value acceptable in a Get operation.
MaxValueThe maximum value acceptable in a Get operation.
DefaultValThe default value for the item. This is NOT validated against the range and hence can be used to set it to a identifiable particular value, if desired. Defaults to zero.

#include "gitarg.hh"

Public Member Functions

 Real (const double def=(double) DefaultVal)
 Simple constructor with a default value specified. More...
 
 Real (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const double Default=(double) DefaultVal, const Flags flags=Flags::KeepErr)
 Constructor which constructs the value from an item in an SDS structure. More...
 
virtual void Get (const sds::Id &Id, const std::string &Name="Argument1", const int Position=1, const double Default=0.0, const Flags flags=Flags::KeepErr)
 Get the value of the object from an SDS structure. More...
 
 operator double () const
 Conversion operators - given git:Real, return a double. More...
 

Constructor & Destructor Documentation

template<long int MinVal, long int MaxVal, long int DefaultVal = 0>
drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::Real ( const double  def = (double)DefaultVal)
inline

Simple constructor with a default value specified.

Parameters
defThe default value to use. If not specified, uses template argument "DefaultVal"
template<long int MinVal, long int MaxVal, long int DefaultVal = 0>
drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::Real ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const double  Default = (double)DefaultVal,
const Flags  flags = Flags::KeepErr 
)
inline

Constructor which constructs the value from an item in an SDS structure.

The value is fetched from the named item (arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value. If not specified, uses template argument "DefaultVal".
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

References drama::Default, and drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::Get().

Member Function Documentation

template<long int MinVal, long int MaxVal, long int DefaultVal = 0>
virtual void drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::Get ( const sds::Id Id,
const std::string &  Name = "Argument1",
const int  Position = 1,
const double  Default = 0.0,
const Flags  flags = Flags::KeepErr 
)
inlinevirtual

Get the value of the object from an SDS structure.

The value is fetched from the named item (arg #2) within the SDS structure specified. or the Position (constructor arg #3) item in the structure if the item named does not exist.

Parameters
IdThe SDS structure.
NameThe name of the item within the structure.
PositionIf the item does not exist by the name, then presume this position.
DefaultThe default value.
flagsWhich GIT Flags to apply. If you specify KeepErr, then an exception is throw if the value in the SDS structure is invalid. If you don't specify KeepErr and and the SDS structure does not contain a value item, then the value is set to the supplied default.

References drama::Default, and DramaTHROW.

Referenced by drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::Real().

template<long int MinVal, long int MaxVal, long int DefaultVal = 0>
drama::gitarg::Real< MinVal, MaxVal, DefaultVal >::operator double ( ) const
inline

Conversion operators - given git:Real, return a double.


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