CXXR (C++ R)
Public Member Functions | Static Public Member Functions
CXXR::NAAugment< T > Class Template Reference

Class template to augment a type with 'not available'. More...

#include <NAAugment.hpp>

List of all members.

Public Member Functions

 NAAugment ()
 Default constructor.
template<typename U >
 NAAugment (const U &value)
 Construct from compatible value.
template<typename U >
NAAugment< T > & operator= (const U &value)
 Assignment from compatible value.
 operator T & ()
 operator const T & () const
bool isNA () const
 Is the value 'not available'?
template<class Archive >
void serialize (Archive &ar, const unsigned int file_version)
 boost::serialization function.
T & value ()
 Data value.
const T & value () const
 Data value (const variant).

Static Public Member Functions

static const NAAugment< T > & NA ()
 Exemplar object representing 'not available'.

Detailed Description

template<typename T>
class CXXR::NAAugment< T >

Class template to augment a type with 'not available'.

This class template is used to combine a value of type T with an indication of whether or not the actual value is 'not available' (NA).

Template Parameters:
Tan arbitrary data type, intended to serve as an element type in R data vectors. (Presumably this type will not already have the capability of representing 'not available' status, e.g. by a specially designated value within its range.)

Constructor & Destructor Documentation

template<typename T>
CXXR::NAAugment< T >::NAAugment ( )
inline

Default constructor.

The constructed object will be flagged as NA.

For this constructor to be used, T must have a default constructor (possibly trivial).

template<typename T>
template<typename U >
CXXR::NAAugment< T >::NAAugment ( const U &  value)
inlineexplicit

Construct from compatible value.

Template Parameters:
Ua type assignable to T.
Parameters:
valueThe value to be given to the constructed object.

Member Function Documentation

template<typename T>
bool CXXR::NAAugment< T >::isNA ( ) const
inline

Is the value 'not available'?

Returns:
true iff this object's value is flagged as 'not available'.
template<typename T>
static const NAAugment<T>& CXXR::NAAugment< T >::NA ( )
inlinestatic

Exemplar object representing 'not available'.

Returns:
const reference to an instance of this type in which the value is flagged as 'not available'.
template<typename T>
template<typename U >
NAAugment<T>& CXXR::NAAugment< T >::operator= ( const U &  value)
inline

Assignment from compatible value.

Template Parameters:
Ua type assignable to T.
Parameters:
valueThe value to be given to the constructed object.
template<class T >
template<class Archive >
void CXXR::NAAugment< T >::serialize ( Archive &  ar,
const unsigned int  file_version 
)

boost::serialization function.

Template Parameters:
Archivearchive class compatible with boost::serialization. Serialization or deserialization will be performed according to whether this is an output or an input archive.
Parameters:
arThe archive to be read/written.
file_versionIgnored.
template<typename T>
T& CXXR::NAAugment< T >::value ( )
inline

Data value.

Returns:
The data value embedded within the object.
Note:
This function (like the corresponding implicit conversion operator) ignores the 'not available' status of the object. Perhaps there would be a case for it throwing an exception or reporting an error if the value is 'not available'.
template<typename T>
const T& CXXR::NAAugment< T >::value ( ) const
inline

Data value (const variant).

Returns:
The data value embedded within the object.
Note:
This function (like the corresponding implicit conversion operator) ignores the 'not available' status of the object. Perhaps there would be a case for it throwing an exception or reporting an error if the value is 'not available'.

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