casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
casa::ValueHolderRep Class Reference

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

#include <ValueHolderRep.h>

List of all members.

Public Member Functions

 ValueHolderRep (Bool value)
 Create the object for the given value.
 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.
 ~ValueHolderRep ()
 Destructor.
void link ()
DataType dataType () const
 Get the data type (as defined in DataType.h).
Bool asBool () const
 Get the value.
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.
std::ostream & write (std::ostream &os) const
 Write the ValueHolderRep to an output stream.

Static Public Member Functions

static void unlink (ValueHolderRep *rep)
static ValueHolderRepfromRecord (const Record &rec, const RecordFieldId &)
 Construct the object from the value in a record.

Private Member Functions

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

Private Attributes

Int itsCount
 
    

uInt itsNdim
DataType itsType
union {
   Bool   itsBool
   uChar   itsUChar
   Short   itsShort
   Int   itsInt
   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

Create the object for the given value.

casa::ValueHolderRep::ValueHolderRep ( const Complex &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const DComplex &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Char value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const String value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Bool > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< uChar > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Short > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< uShort > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Int > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< uInt > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Int64 > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Float > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Double > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< Complex > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< DComplex > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Array< String > &  value) [explicit]
casa::ValueHolderRep::ValueHolderRep ( const Record value) [explicit]

Create an empty N-dim array.

Destructor.

Forbid copy ctor and assignment.


Member Function Documentation

const Array<Complex> casa::ValueHolderRep::asArrayComplex ( ) const
const Array<DComplex> casa::ValueHolderRep::asArrayDComplex ( ) const

Get the value.

It throws an exception if the data type is incorrect.

Referenced by casa::ValueHolder::asBool().

DataType casa::ValueHolderRep::dataType ( ) const [inline]

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

Definition at line 179 of file ValueHolderRep.h.

References itsType.

Referenced by casa::ValueHolder::dataType().

static ValueHolderRep* casa::ValueHolderRep::fromRecord ( const Record rec,
const RecordFieldId  
) [static]

Construct the object from the value in a record.

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

void casa::ValueHolderRep::link ( ) [inline]

Definition at line 104 of file ValueHolderRep.h.

References itsCount.

ValueHolderRep& casa::ValueHolderRep::operator= ( const ValueHolderRep ) [private]
void casa::ValueHolderRep::toRecord ( Record ,
const RecordFieldId  
) const

Put the value as a field in a record.

Referenced by casa::ValueHolder::toRecord().

static void casa::ValueHolderRep::unlink ( ValueHolderRep rep) [inline, static]

Definition at line 107 of file ValueHolderRep.h.

References itsCount.

std::ostream& casa::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 { ... } [private]

Definition at line 167 of file ValueHolderRep.h.

    

Definition at line 163 of file ValueHolderRep.h.

Referenced by link(), and unlink().

Definition at line 173 of file ValueHolderRep.h.

Definition at line 172 of file ValueHolderRep.h.

Definition at line 170 of file ValueHolderRep.h.

Definition at line 171 of file ValueHolderRep.h.

Definition at line 164 of file ValueHolderRep.h.

Definition at line 174 of file ValueHolderRep.h.

Definition at line 169 of file ValueHolderRep.h.

DataType casa::ValueHolderRep::itsType [private]

Definition at line 165 of file ValueHolderRep.h.

Referenced by dataType().

Definition at line 168 of file ValueHolderRep.h.


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