lsst.astshim
master-g139ee105a0+1
|
#include <KeyMap.h>
Public Member Functions | |
KeyMap (std::string const &options="") | |
KeyMap (KeyMap const &)=delete | |
KeyMap (KeyMap &&)=default | |
KeyMap & | operator= (KeyMap const &)=delete |
KeyMap & | operator= (KeyMap &&)=default |
std::shared_ptr< KeyMap > | copy () const |
Return a deep copy of this object. | |
bool | defined (std::string const &key) const |
std::string | key (int ind) const |
Get the key at the specified index. | |
bool | hasKey (std::string const &key) const |
int | length (std::string const &key) const |
Get the size of the vector for the specified key; return 0 if key not found or value is undefined. | |
int | size () const |
Get the number of keys. | |
double | getD (std::string const &key, int ind) const |
Get one double value for a given key. | |
std::vector< double > | getD (std::string const &key) const |
Get all double values for a given key. | |
float | getF (std::string const &key, int ind) const |
Get one float value for a given key. | |
std::vector< float > | getF (std::string const &key) const |
Get all float values for a given key. | |
int | getI (std::string const &key, int ind) const |
Get one int value for a given key. | |
std::vector< int > | getI (std::string const &key) const |
Get all int values for a given key. | |
short int | getS (std::string const &key, int ind) const |
Get one short int value for a given key. | |
std::vector< short int > | getS (std::string const &key) const |
Get all short int values for a given key. | |
char unsigned | getB (std::string const &key, int ind) const |
Get one char value for a given key. | |
std::vector< char unsigned > | getB (std::string const &key) const |
Get all char values for a given key. | |
std::string | getC (std::string const &key, int ind) const |
Get one std::string value for a given key. | |
std::vector< std::string > | getC (std::string const &key) const |
Get all std::string values for a given key. | |
std::shared_ptr< Object > | getA (std::string const &key, int ind) const |
Get one Object for a given key; the object is deep copied. | |
std::vector< std::shared_ptr< Object > > | getA (std::string const &key) const |
Get all Objects for a given key; each object is deep copied. | |
void | putD (std::string const &key, double value, std::string const &comment="") |
Add a double value. | |
void | putD (std::string const &key, std::vector< double > const &vec, std::string const &comment="") |
Add a vector of double. | |
void | putF (std::string const &key, float value, std::string const &comment="") |
Add a float. | |
void | putF (std::string const &key, std::vector< float > const &vec, std::string const &comment="") |
Add a vector of floats. | |
void | putI (std::string const &key, int value, std::string const &comment="") |
Add an int. | |
void | putI (std::string const &key, std::vector< int > const &vec, std::string const &comment="") |
Add a vector of ints. | |
void | putS (std::string const &key, short int value, std::string const &comment="") |
Add a short int. | |
void | putS (std::string const &key, std::vector< short int > const &vec, std::string const &comment="") |
Add a vector of short int. | |
void | putB (std::string const &key, char unsigned value, std::string const &comment="") |
Add a char. | |
void | putB (std::string const &key, std::vector< char unsigned > const &vec, std::string const &comment="") |
Add a vector of chars. | |
void | putC (std::string const &key, std::string const &value, std::string const &comment="") |
Add a string. | |
void | putC (std::string const &key, std::vector< std::string > const &vec, std::string const &comment="") |
Add a vector of strings. | |
void | putA (std::string const &key, Object const &obj, std::string const &comment="") |
Add an Object, which is deep copied. | |
void | putA (std::string const &key, std::vector< std::shared_ptr< Object const >> const &vec, std::string const &comment="") |
Add a vector of shared pointer to Object; the objects are deep copied. | |
void | putU (std::string const &key, std::string const &comment="") |
void | append (std::string const &key, double value) |
Append an element to a vector of doubles in a KeyMap. | |
void | append (std::string const &key, float value) |
Append an element to a vector of floats in a KeyMap. | |
void | append (std::string const &key, int value) |
Append an element to a vector of ints in a KeyMap. | |
void | append (std::string const &key, short int value) |
Append an element to a vector of short int in a KeyMap. | |
void | append (std::string const &key, char unsigned value) |
Append an element to a vector of char in a KeyMap. | |
void | append (std::string const &key, std::string const &value) |
Append an element to a vector of strings in a KeyMap. | |
void | append (std::string const &key, Object const &value) |
Append an element to a vector of Objects in a KeyMap. | |
void | replace (std::string const &key, int i, double value) |
Replace an element of a vector of doubles in a KeyMap. | |
void | replace (std::string const &key, int i, float value) |
Replace an element of a vector of floats in a KeyMap. | |
void | replace (std::string const &key, int i, int value) |
Replace an element of a vector of ints in a KeyMap. | |
void | replace (std::string const &key, int i, short int value) |
Replace an element of a vector of short int in a KeyMap. | |
void | replace (std::string const &key, int i, char unsigned value) |
Replace an element of a vector of char in a KeyMap. | |
void | replace (std::string const &key, int i, std::string const &value) |
Replace an element of a vector of strings in a KeyMap. | |
void | replace (std::string const &key, int i, Object const &value) |
Replace an element of a vector of Objects in a KeyMap. | |
void | remove (std::string const &key) |
void | rename (std::string const &oldKey, std::string const &newKey) |
DataType | type (std::string const &key) |
![]() | |
Object (Object const &)=delete | |
Object (Object &&)=default | |
Object & | operator= (Object const &)=delete |
Object & | operator= (Object &&)=default |
bool | operator== (Object const &rhs) const |
bool | operator!= (Object const &rhs) const |
std::shared_ptr< Object > | copy () const |
Return a deep copy of this object. | |
void | clear (std::string const &attrib) |
bool | hasAttribute (std::string const &attrib) const |
std::string | getClassName () const |
std::string | getID () const |
Get ID: object identification string that is not copied. | |
std::string | getIdent () const |
Get Ident: object identification string that is copied. | |
int | getNObject () const |
int | getObjSize () const |
Get ObjSize: the in-memory size of the AST object in bytes. | |
int | getRefCount () const |
bool | getUseDefs () const |
Get UseDefs: allow use of default values for Object attributes? | |
void | lock (bool wait) |
bool | same (Object const &other) const |
void | setID (std::string const &id) |
Set ID: object identification string that is not copied. | |
void | setIdent (std::string const &ident) |
Set Ident: object identification string that is copied. | |
void | setUseDefs (bool usedefs) |
Set UseDefs: allow use of default values for Object attributes? | |
void | show (std::ostream &os, bool showComments=true) const |
std::string | show (bool showComments=true) const |
bool | test (std::string const &attrib) |
void | unlock (bool report=false) |
AstObject const * | getRawPtr () const |
AstObject * | getRawPtr () |
Protected Member Functions | |
virtual std::shared_ptr< Object > | copyPolymorphic () const override |
KeyMap (AstKeyMap *rawKeyMap) | |
![]() | |
Object (AstObject *object) | |
template<typename T , typename AstT > | |
std::shared_ptr< T > | copyImpl () const |
bool | getB (std::string const &attrib) const |
std::string const | getC (std::string const &attrib) const |
double | getD (std::string const &attrib) const |
float | getF (std::string const &attrib) const |
int | getI (std::string const &attrib) const |
long int | getL (std::string const &attrib) const |
void | set (std::string const &setting) |
void | setB (std::string const &attrib, bool value) |
void | setC (std::string const &attrib, std::string const &value) |
void | setD (std::string const &attrib, double value) |
void | setF (std::string const &attrib, float value) |
void | setI (std::string const &attrib, int value) |
void | setL (std::string const &attrib, long int value) |
Friends | |
class | Object |
class | Channel |
Additional Inherited Members | |
![]() | |
using | ObjectPtr = std::unique_ptr< AstObject, Deleter > |
unique pointer holding an AST raw pointer | |
![]() | |
static std::shared_ptr< Object > | fromString (std::string const &str) |
template<typename Class > | |
static std::shared_ptr< Class > | fromAstObject (AstObject *rawObj, bool copy) |
![]() | |
template<typename ShimT , typename AstT > | |
static std::shared_ptr< ShimT > | makeShim (AstObject *p) |
KeyMap is used to store a set of values with associated keys which identify the values.
The keys are strings. These may be case sensitive or insensitive as selected by the KeyCase attribute, and trailing spaces are ignored. Each key is associated a vector of values of a particular type, which is one of the following, where the single letter is the suffix for the associated setter or getter, such as getD, putD or replaceD:
Despite the name, KeyMap is not a Mapping.
The getters will attempt to cast the data into the requested form. The setters come in three forms:
astMapPutElem<X>
astMapPutElem<X>
)KeyMap has the following attributes, in addition to those inherited from Object
|
inlineexplicit |
Construct an empty KeyMap
[in] | options | Comma-separated list of attribute assignments. |
|
inlineexplicitprotected |
Construct a KeyMap from a raw AstKeyMap
|
inlineoverrideprotectedvirtual |
Return a deep copy of this object. This is called by copy.
Each subclass must override this method. The standard implementation is:
for example Frame implements this as:
Implements ast::Object.
|
inline |
Does this map contain the specified key, and if so, does it have a defined value?
See also hasKey, which does not check if the value is defined
|
inline |
Does this map contain the specified key?
See also defined, which also checks that the value is defined
|
inline |
Add a new entry, but no value is stored with the entry.
The entry has a special data type represented by symbolic constant AST__UNDEFTYPE. Such entries can act as placeholders for values that can be added to the KeyMap later.
|
inline |
Remove the specified entry.
Silently do nothing if this KeyMap does not contain the specified key.
|
inline |
Rename the specified entry.
Silently do nothing if this KeyMap does not contain the old key.
|
inline |
Get the type suffix for a given key