casacore
|
A holder for a value of any basic Casacore data type. More...
#include <ValueHolder.h>
Public Member Functions | |
ValueHolder () | |
Construct a null object. More... | |
ValueHolder (Bool value) | |
Create the object for the given value. More... | |
ValueHolder (uChar value) | |
ValueHolder (Short value) | |
ValueHolder (uShort value) | |
ValueHolder (Int value) | |
ValueHolder (uInt value) | |
ValueHolder (Int64 value) | |
ValueHolder (Float value) | |
ValueHolder (Double value) | |
ValueHolder (const Complex &value) | |
ValueHolder (const DComplex &value) | |
ValueHolder (const Char *value) | |
ValueHolder (const String &value) | |
ValueHolder (const Array< Bool > &value) | |
ValueHolder (const Array< uChar > &value) | |
ValueHolder (const Array< Short > &value) | |
ValueHolder (const Array< uShort > &value) | |
ValueHolder (const Array< Int > &value) | |
ValueHolder (const Array< uInt > &value) | |
ValueHolder (const Array< Int64 > &value) | |
ValueHolder (const Array< Float > &value) | |
ValueHolder (const Array< Double > &value) | |
ValueHolder (const Array< Complex > &value) | |
ValueHolder (const Array< DComplex > &value) | |
ValueHolder (const Array< String > &value) | |
ValueHolder (const Record &value) | |
ValueHolder (uInt ndim, Bool dummy) | |
Create an empty N-dim array (gets type TpOther). More... | |
ValueHolder (ValueHolderRep *rep) | |
Create a ValueHolder from a ValueHolderRep. More... | |
ValueHolder (const ValueHolder &) | |
Copy constructor (reference semantics). More... | |
~ValueHolder () | |
Destructor. More... | |
ValueHolder & | operator= (const ValueHolder &) |
Assignment (reference semantics). More... | |
Bool | isNull () const |
Is this a null object? 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 String & | asString () const |
const Array< Bool > | asArrayBool () const |
const Array< uChar > | asArrayuChar () const |
const Array< Short > | asArrayShort () const |
const Array< uShort > | asArrayuShort () const |
const Array< Int > | asArrayInt () const |
const Array< uInt > | asArrayuInt () const |
const Array< Int64 > | asArrayInt64 () const |
const Array< Float > | asArrayFloat () const |
const Array< Double > | asArrayDouble () const |
const Array< Complex > | asArrayComplex () const |
const Array< DComplex > | asArrayDComplex () const |
const Array< String > | asArrayString () const |
const Record & | asRecord () const |
void | getValue (Bool &value) const |
Get the data in a way useful for templates. More... | |
void | getValue (uChar &value) const |
void | getValue (Short &value) const |
void | getValue (uShort &value) const |
void | getValue (Int &value) const |
void | getValue (uInt &value) const |
void | getValue (Int64 &value) const |
void | getValue (Float &value) const |
void | getValue (Double &value) const |
void | getValue (Complex &value) const |
void | getValue (DComplex &value) const |
void | getValue (String &value) const |
void | getValue (Array< Bool > &value) const |
void | getValue (Array< uChar > &value) const |
void | getValue (Array< Short > &value) const |
void | getValue (Array< uShort > &value) const |
void | getValue (Array< Int > &value) const |
void | getValue (Array< uInt > &value) const |
void | getValue (Array< Int64 > &value) const |
void | getValue (Array< Float > &value) const |
void | getValue (Array< Double > &value) const |
void | getValue (Array< Complex > &value) const |
void | getValue (Array< DComplex > &value) const |
void | getValue (Array< String > &value) const |
void | toRecord (Record &, const RecordFieldId &) const |
Put the value as a field in a record. More... | |
bool | operator< (const ValueHolder &right) const |
Compare two ValueHolder objects. More... | |
Static Public Member Functions | |
static ValueHolder | fromRecord (const Record &, const RecordFieldId &) |
Construct the object from the value in a record. More... | |
Private Attributes | |
CountedPtr< ValueHolderRep > | itsRep |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ValueHolder &vh) |
Write the ValueHolder to an output stream. More... | |
A holder for a value of any basic Casacore data type.
Public interface
Class ValueHolder is meant to be used for holding a single Casacore value. The value can be scalar or an array of any basic type (including complex and string). Also a Record value is possible. In this way varying typed data (e.g. the result of getCell in the table DO) can be packed in a strongly typed variable.
All unsigned integer type values are kept as signed 32-bit integers because scripting languages usually only support those types.
ValueHolder is an envelope class that holds a counted-referenced letter object ValueHolderRep.
This class comes handy in passing arbitrary values from a DO to its environment.
Definition at line 68 of file ValueHolder.h.
|
inline |
|
explicit |
Create the object for the given value.
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
|
explicit |
Create an empty N-dim array (gets type TpOther).
|
inlineexplicit |
Create a ValueHolder from a ValueHolderRep.
It takes over the pointer and deletes it in the destructor.
Definition at line 110 of file ValueHolder.h.
casacore::ValueHolder::ValueHolder | ( | const ValueHolder & | ) |
Copy constructor (reference semantics).
|
inline |
Destructor.
Definition at line 118 of file ValueHolder.h.
|
inline |
|
inline |
|
inline |
Get the value.
If possible, it converts the data as needed.
Definition at line 232 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 250 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 252 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 248 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 246 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 240 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
|
inline |
Definition at line 280 of file ValueHolder.h.
References itsRep.
|
inline |
Definition at line 236 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
|
inline |
Definition at line 234 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 242 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Definition at line 238 of file ValueHolder.h.
References itsRep.
Referenced by casacore::python::numpy::getScalar(), and getValue().
|
inline |
Get the data type (as defined in DataType.h).
Note that TpOther is returned for an empty untyped array.
Definition at line 225 of file ValueHolder.h.
References itsRep.
|
inlinestatic |
Construct the object from the value in a record.
Definition at line 229 of file ValueHolder.h.
References casacore::ValueHolderRep::fromRecord(), and ValueHolder().
|
inline |
Get the data in a way useful for templates.
If possible, it converts the the data as needed.
Definition at line 165 of file ValueHolder.h.
References asBool().
|
inline |
Definition at line 166 of file ValueHolder.h.
References asuChar().
|
inline |
Definition at line 167 of file ValueHolder.h.
References asShort().
|
inline |
Definition at line 168 of file ValueHolder.h.
References asuShort().
|
inline |
Definition at line 169 of file ValueHolder.h.
References asInt().
|
inline |
Definition at line 170 of file ValueHolder.h.
References asuInt().
|
inline |
Definition at line 171 of file ValueHolder.h.
References asInt64().
|
inline |
Definition at line 172 of file ValueHolder.h.
References asFloat().
|
inline |
Definition at line 173 of file ValueHolder.h.
References asDouble().
|
inline |
Definition at line 174 of file ValueHolder.h.
References asComplex().
|
inline |
Definition at line 175 of file ValueHolder.h.
References asDComplex().
|
inline |
Definition at line 176 of file ValueHolder.h.
References asString().
Definition at line 177 of file ValueHolder.h.
References asArrayBool(), and casacore::Array< T, Alloc >::reference().
Definition at line 179 of file ValueHolder.h.
References asArrayuChar(), and casacore::Array< T, Alloc >::reference().
Definition at line 181 of file ValueHolder.h.
References asArrayShort(), and casacore::Array< T, Alloc >::reference().
Definition at line 183 of file ValueHolder.h.
References asArrayuShort(), and casacore::Array< T, Alloc >::reference().
Definition at line 185 of file ValueHolder.h.
References asArrayInt(), and casacore::Array< T, Alloc >::reference().
Definition at line 187 of file ValueHolder.h.
References asArrayuInt(), and casacore::Array< T, Alloc >::reference().
Definition at line 189 of file ValueHolder.h.
References asArrayInt64(), and casacore::Array< T, Alloc >::reference().
Definition at line 191 of file ValueHolder.h.
References asArrayFloat(), and casacore::Array< T, Alloc >::reference().
Definition at line 193 of file ValueHolder.h.
References asArrayDouble(), and casacore::Array< T, Alloc >::reference().
|
inline |
Definition at line 195 of file ValueHolder.h.
References asArrayComplex(), and casacore::Array< T, Alloc >::reference().
|
inline |
Definition at line 197 of file ValueHolder.h.
References asArrayDComplex(), and casacore::Array< T, Alloc >::reference().
Definition at line 199 of file ValueHolder.h.
References asArrayString(), and casacore::Array< T, Alloc >::reference().
|
inline |
|
inline |
Compare two ValueHolder objects.
They must have the same data type.
Definition at line 211 of file ValueHolder.h.
References itsRep.
ValueHolder& casacore::ValueHolder::operator= | ( | const ValueHolder & | ) |
Assignment (reference semantics).
|
inline |
Put the value as a field in a record.
Definition at line 227 of file ValueHolder.h.
References itsRep.
|
friend |
Write the ValueHolder to an output stream.
Arrays are written as normal arrays using ArrayIO.h.
Definition at line 216 of file ValueHolder.h.
|
private |
Definition at line 221 of file ValueHolder.h.
Referenced by asArrayBool(), asArrayComplex(), asArrayDComplex(), asArrayDouble(), asArrayFloat(), asArrayInt(), asArrayInt64(), asArrayShort(), asArrayString(), asArrayuChar(), asArrayuInt(), asArrayuShort(), asBool(), asComplex(), asDComplex(), asDouble(), asFloat(), asInt(), asInt64(), asRecord(), asShort(), asString(), asuChar(), asuInt(), asuShort(), dataType(), isNull(), operator<(), and toRecord().