28 #ifndef CASA_JSONVALUE_H 29 #define CASA_JSONVALUE_H 32 #include <casacore/casa/BasicSL/String.h> 33 #include <casacore/casa/BasicSL/Complex.h> 34 #include <casacore/casa/Utilities/DataType.h> 35 #include <casacore/casa/Utilities/Assert.h> 36 #include <casacore/casa/Exceptions/Error.h> 46 template<
typename T>
class Array;
105 JsonValue (
const std::vector<JsonValue>&);
146 DataType
vectorDataType (
const std::vector<JsonValue>& vec)
const;
180 const std::vector<JsonValue>&
getVector()
const;
208 void get (std::vector<Bool>&
value)
const 210 void get (std::vector<Int64>&
value)
const 212 void get (std::vector<double>&
value)
const 214 void get (std::vector<DComplex>&
value)
const 216 void get (std::vector<String>&
value)
const 218 void get (std::vector<JsonValue>&
value)
const 236 const std::vector<JsonValue>& vec)
const 238 for (std::vector<JsonValue>::const_iterator iter=vec.begin();
239 iter!=vec.end(); ++iter) {
240 if (iter->dataType() == TpOther) {
241 data =
fillArray (data, dataEnd, iter->getVector());
A Vector of integers, for indexing into Array<T> objects.
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
std::vector< String > getVecString() const
const std::vector< JsonValue > & getVector() const
DataType dataType() const
Get the data type of the value.
IPosition shape() const
Get the shape of an array (possibly nested vector).
const String & getString() const
void clear()
Remove the value.
const JsonKVMap & getValueMap() const
Get the value as a JsonKVMap (no conversion is possible).
Array< DComplex > getArrayDComplex() const
Array< Int64 > getArrayInt() const
std::vector< DComplex > getVecDComplex() const
JsonValue & operator=(const JsonValue &)
Assignment (copy semantics).
T * fillArray(T *data, const T *dataEnd, const std::vector< JsonValue > &vec) const
Fill an array from nested vector in a recursive way.
Array< String > getArrayString() const
DataType arrayDataType() const
Get the most common data type of the value inside a possibly nested vector.
IPosition vectorShape(const std::vector< JsonValue > &vec) const
Class to hold a collection of JSON key:value pairs.
std::complex< Double > DComplex
A holder for a value of any basic Casacore data type.
Bool getBool() const
Get the value in the given data type.
void copyValue(const JsonValue &that)
Copy the value from another one.
#define AlwaysAssert(expr, exception)
These marcos are provided for use instead of simply using the constructors of assert_ to allow additi...
bool Bool
Define the standard types used by Casacore.
Class to hold any JSON value.
DComplex getDComplex() const
Bool isValueMap() const
Is the value a value map?
size_t size() const
Return the size of a value vector or map (1 is returned for a scalar).
ValueHolder getValueHolder() const
Get the value as a ValueHolder.
std::vector< double > getVecDouble() const
Array< Bool > getArrayBool() const
Get the value as an Array.
Base class for all Casacore library errors.
std::vector< Bool > getVecBool() const
As above, but get the value as a vector.
std::vector< Int64 > getVecInt() const
String: the storage and methods of handling collections of characters.
Array< double > getArrayDouble() const
Bool isNull() const
Is the value a null value?
this file contains all the compiler specific defines
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
Bool isVector() const
Is the value a vector?
friend ostream & operator<<(ostream &, const JsonValue &)
Show value on given ostream.
DataType vectorDataType(const std::vector< JsonValue > &vec) const
JsonValue()
The default constructor results in a null value.