casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
casacore::ValueHolderRep Class Reference

A holder for a value of any basic type. More...

#include <ValueHolderRep.h>

Public Member Functions

 ValueHolderRep (Bool value)
 Create the object for the given value. More...
 
 ValueHolderRep (uChar value)
 
 ValueHolderRep (Short value)
 
 ValueHolderRep (uShort value)
 
 ValueHolderRep (Int value)
 
 ValueHolderRep (uInt value)
 
 ValueHolderRep (Int64 value)
 
 ValueHolderRep (Float value)
 
 ValueHolderRep (Double value)
 
 ValueHolderRep (const Complex &value)
 
 ValueHolderRep (const DComplex &value)
 
 ValueHolderRep (const Char *value)
 
 ValueHolderRep (const String &value)
 
 ValueHolderRep (const Array< Bool > &value)
 
 ValueHolderRep (const Array< uChar > &value)
 
 ValueHolderRep (const Array< Short > &value)
 
 ValueHolderRep (const Array< uShort > &value)
 
 ValueHolderRep (const Array< Int > &value)
 
 ValueHolderRep (const Array< uInt > &value)
 
 ValueHolderRep (const Array< Int64 > &value)
 
 ValueHolderRep (const Array< Float > &value)
 
 ValueHolderRep (const Array< Double > &value)
 
 ValueHolderRep (const Array< Complex > &value)
 
 ValueHolderRep (const Array< DComplex > &value)
 
 ValueHolderRep (const Array< String > &value)
 
 ValueHolderRep (const Record &value)
 
 ValueHolderRep (uInt ndim, Bool dummy)
 Create an empty N-dim array. More...
 
 ~ValueHolderRep ()
 Destructor. More...
 
DataType dataType () const
 Get the data type (as defined in DataType.h). More...
 
Bool asBool () const
 Get the value. More...
 
uChar asuChar () const
 
Short asShort () const
 
uShort asuShort () const
 
Int asInt () const
 
uInt asuInt () const
 
Int64 asInt64 () const
 
Float asFloat () const
 
Double asDouble () const
 
Complex asComplex () const
 
DComplex asDComplex () const
 
const StringasString () const
 
const Array< BoolasArrayBool () const
 
const Array< uCharasArrayuChar () const
 
const Array< ShortasArrayShort () const
 
const Array< uShortasArrayuShort () const
 
const Array< IntasArrayInt () const
 
const Array< uIntasArrayuInt () const
 
const Array< Int64asArrayInt64 () const
 
const Array< FloatasArrayFloat () const
 
const Array< DoubleasArrayDouble () const
 
const Array< Complex > asArrayComplex () const
 
const Array< DComplex > asArrayDComplex () const
 
const Array< StringasArrayString () const
 
const RecordasRecord () const
 
void toRecord (Record &, const RecordFieldId &) const
 Put the value as a field in a record. More...
 
std::ostream & write (std::ostream &os) const
 Write the ValueHolderRep to an output stream. More...
 
bool operator< (const ValueHolderRep &right) const
 Compare two ValueHolder objects. More...
 

Static Public Member Functions

static ValueHolderRepfromRecord (const Record &rec, const RecordFieldId &)
 Construct the object from the value in a record. More...
 

Private Member Functions

 ValueHolderRep (const ValueHolderRep &)
 Forbid copy ctor and assignment. More...
 
ValueHolderRepoperator= (const ValueHolderRep &)
 

Private Attributes

uInt itsNdim
 
DataType itsType
 
union {
   Bool   itsBool
 
   Int64   itsInt64
 
   Float   itsFloat
 
   Double   itsDouble
 
   void *   itsPtr
 
}; 
 

Detailed Description

A holder for a value of any basic type.

Intended use:

Internal

Review Status

Test programs:
tValueHolder

Synopsis

Class ValueHolderRep is the letter class for the envelope class ValueHolder. See that class for more information.

Motivation

Copying ValueHolders should be as cheap as possible, so a counted referenced letter class is used.

Definition at line 65 of file ValueHolderRep.h.

Constructor & Destructor Documentation

casacore::ValueHolderRep::ValueHolderRep ( Bool  value)
explicit

Create the object for the given value.

casacore::ValueHolderRep::ValueHolderRep ( uChar  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( Short  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( uShort  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( Int  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( uInt  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( Int64  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( Float  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( Double  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Complex &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const DComplex &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Char value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const String value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Bool > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< uChar > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Short > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< uShort > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Int > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< uInt > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Int64 > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Float > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Double > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< Complex > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< DComplex > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Array< String > &  value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( const Record value)
explicit
casacore::ValueHolderRep::ValueHolderRep ( uInt  ndim,
Bool  dummy 
)

Create an empty N-dim array.

casacore::ValueHolderRep::~ValueHolderRep ( )

Destructor.

casacore::ValueHolderRep::ValueHolderRep ( const ValueHolderRep )
private

Forbid copy ctor and assignment.

Member Function Documentation

const Array<Bool> casacore::ValueHolderRep::asArrayBool ( ) const
const Array<Complex> casacore::ValueHolderRep::asArrayComplex ( ) const
const Array<DComplex> casacore::ValueHolderRep::asArrayDComplex ( ) const
const Array<Double> casacore::ValueHolderRep::asArrayDouble ( ) const
const Array<Float> casacore::ValueHolderRep::asArrayFloat ( ) const
const Array<Int> casacore::ValueHolderRep::asArrayInt ( ) const
const Array<Int64> casacore::ValueHolderRep::asArrayInt64 ( ) const
const Array<Short> casacore::ValueHolderRep::asArrayShort ( ) const
const Array<String> casacore::ValueHolderRep::asArrayString ( ) const
const Array<uChar> casacore::ValueHolderRep::asArrayuChar ( ) const
const Array<uInt> casacore::ValueHolderRep::asArrayuInt ( ) const
const Array<uShort> casacore::ValueHolderRep::asArrayuShort ( ) const
Bool casacore::ValueHolderRep::asBool ( ) const

Get the value.

If possible, it converts the data as needed.

Complex casacore::ValueHolderRep::asComplex ( ) const
DComplex casacore::ValueHolderRep::asDComplex ( ) const
Double casacore::ValueHolderRep::asDouble ( ) const
Float casacore::ValueHolderRep::asFloat ( ) const
Int casacore::ValueHolderRep::asInt ( ) const
Int64 casacore::ValueHolderRep::asInt64 ( ) const
const Record& casacore::ValueHolderRep::asRecord ( ) const
Short casacore::ValueHolderRep::asShort ( ) const
const String& casacore::ValueHolderRep::asString ( ) const
uChar casacore::ValueHolderRep::asuChar ( ) const
uInt casacore::ValueHolderRep::asuInt ( ) const
uShort casacore::ValueHolderRep::asuShort ( ) const
DataType casacore::ValueHolderRep::dataType ( ) const
inline

Get the data type (as defined in DataType.h).

Definition at line 178 of file ValueHolderRep.h.

References itsType.

static ValueHolderRep* casacore::ValueHolderRep::fromRecord ( const Record rec,
const RecordFieldId  
)
static

Construct the object from the value in a record.

Referenced by casacore::ValueHolder::fromRecord().

bool casacore::ValueHolderRep::operator< ( const ValueHolderRep right) const

Compare two ValueHolder objects.

They must have the same data type.

ValueHolderRep& casacore::ValueHolderRep::operator= ( const ValueHolderRep )
private
void casacore::ValueHolderRep::toRecord ( Record ,
const RecordFieldId  
) const

Put the value as a field in a record.

std::ostream& casacore::ValueHolderRep::write ( std::ostream &  os) const

Write the ValueHolderRep to an output stream.

Arrays are written as normal arrays using ArrayIO.h.

Member Data Documentation

union { ... }
Bool casacore::ValueHolderRep::itsBool

Definition at line 169 of file ValueHolderRep.h.

Double casacore::ValueHolderRep::itsDouble

Definition at line 172 of file ValueHolderRep.h.

Float casacore::ValueHolderRep::itsFloat

Definition at line 171 of file ValueHolderRep.h.

Int64 casacore::ValueHolderRep::itsInt64

Definition at line 170 of file ValueHolderRep.h.

uInt casacore::ValueHolderRep::itsNdim
private

Definition at line 166 of file ValueHolderRep.h.

void* casacore::ValueHolderRep::itsPtr

Definition at line 173 of file ValueHolderRep.h.

DataType casacore::ValueHolderRep::itsType
private

Definition at line 167 of file ValueHolderRep.h.

Referenced by dataType().


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