|
| KeyMap (std::string const &options="") |
| Construct an empty KeyMap. More...
|
|
virtual | ~KeyMap () |
|
| KeyMap (KeyMap const &)=default |
| Copy constructor: make a deep copy. More...
|
|
| 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. More...
|
|
bool | defined (std::string const &key) const |
| Does this map contain the specified key, and if so, does it have a defined value? More...
|
|
std::string | key (int ind) const |
| Get the key at the specified index. More...
|
|
bool | hasKey (std::string const &key) const |
| Does this map contain the specified key? More...
|
|
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. More...
|
|
int | size () const |
| Get the number of keys. More...
|
|
double | getD (std::string const &key, int ind) const |
| Get one double value for a given key. More...
|
|
std::vector< double > | getD (std::string const &key) const |
| Get all double values for a given key. More...
|
|
float | getF (std::string const &key, int ind) const |
| Get one float value for a given key. More...
|
|
std::vector< float > | getF (std::string const &key) const |
| Get all float values for a given key. More...
|
|
int | getI (std::string const &key, int ind) const |
| Get one int value for a given key. More...
|
|
std::vector< int > | getI (std::string const &key) const |
| Get all int values for a given key. More...
|
|
short int | getS (std::string const &key, int ind) const |
| Get one short int value for a given key. More...
|
|
std::vector< short int > | getS (std::string const &key) const |
| Get all short int values for a given key. More...
|
|
char unsigned | getB (std::string const &key, int ind) const |
| Get one char value for a given key. More...
|
|
std::vector< char unsigned > | getB (std::string const &key) const |
| Get all char values for a given key. More...
|
|
std::string | getC (std::string const &key, int ind) const |
| Get one std::string value for a given key. More...
|
|
std::vector< std::string > | getC (std::string const &key) const |
| Get all std::string values for a given key. More...
|
|
std::shared_ptr< Object > | getA (std::string const &key, int ind) const |
| Get one Object for a given key; the object is deep copied. More...
|
|
std::vector< std::shared_ptr< Object > > | getA (std::string const &key) const |
| Get all Objects for a given key; each object is deep copied. More...
|
|
void | putD (std::string const &key, double value, std::string const &comment="") |
| Add a double value. More...
|
|
void | putD (std::string const &key, std::vector< double > const &vec, std::string const &comment="") |
| Add a vector of double. More...
|
|
void | putF (std::string const &key, float value, std::string const &comment="") |
| Add a float. More...
|
|
void | putF (std::string const &key, std::vector< float > const &vec, std::string const &comment="") |
| Add a vector of floats. More...
|
|
void | putI (std::string const &key, int value, std::string const &comment="") |
| Add an int. More...
|
|
void | putI (std::string const &key, std::vector< int > const &vec, std::string const &comment="") |
| Add a vector of ints. More...
|
|
void | putS (std::string const &key, short int value, std::string const &comment="") |
| Add a short int. More...
|
|
void | putS (std::string const &key, std::vector< short int > const &vec, std::string const &comment="") |
| Add a vector of short int. More...
|
|
void | putB (std::string const &key, char unsigned value, std::string const &comment="") |
| Add a char. More...
|
|
void | putB (std::string const &key, std::vector< char unsigned > const &vec, std::string const &comment="") |
| Add a vector of chars. More...
|
|
void | putC (std::string const &key, std::string const &value, std::string const &comment="") |
| Add a string. More...
|
|
void | putC (std::string const &key, std::vector< std::string > const &vec, std::string const &comment="") |
| Add a vector of strings. More...
|
|
void | putA (std::string const &key, Object const &obj, std::string const &comment="") |
| Add an Object, which is deep copied. More...
|
|
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. More...
|
|
void | putU (std::string const &key, std::string const &comment="") |
| Add a new entry, but no value is stored with the entry. More...
|
|
void | append (std::string const &key, double value) |
| Append an element to a vector of doubles in a KeyMap. More...
|
|
void | append (std::string const &key, float value) |
| Append an element to a vector of floats in a KeyMap. More...
|
|
void | append (std::string const &key, int value) |
| Append an element to a vector of ints in a KeyMap. More...
|
|
void | append (std::string const &key, short int value) |
| Append an element to a vector of short int in a KeyMap. More...
|
|
void | append (std::string const &key, char unsigned value) |
| Append an element to a vector of char in a KeyMap. More...
|
|
void | append (std::string const &key, std::string const &value) |
| Append an element to a vector of strings in a KeyMap. More...
|
|
void | append (std::string const &key, Object const &value) |
| Append an element to a vector of Objects in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, double value) |
| Replace an element of a vector of doubles in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, float value) |
| Replace an element of a vector of floats in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, int value) |
| Replace an element of a vector of ints in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, short int value) |
| Replace an element of a vector of short int in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, char unsigned value) |
| Replace an element of a vector of char in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, std::string const &value) |
| Replace an element of a vector of strings in a KeyMap. More...
|
|
void | replace (std::string const &key, int i, Object const &value) |
| Replace an element of a vector of Objects in a KeyMap. More...
|
|
void | remove (std::string const &key) |
| Remove the specified entry. More...
|
|
void | rename (std::string const &oldKey, std::string const &newKey) |
| Rename the specified entry. More...
|
|
DataType | type (std::string const &key) |
| Get the type suffix for a given key. More...
|
|
bool | operator== (Object const &rhs) const |
| Return True if this and rhs are the equal. More...
|
|
bool | operator!= (Object const &rhs) const |
| Return True if this and rhs are not equal. More...
|
|
void | clear (std::string const &attrib) |
| Clear the values of a specified set of attributes for an Object. More...
|
|
bool | hasAttribute (std::string const &attrib) const |
| Does this object have an attribute with the specified name? More...
|
|
std::string | getClassName () const |
| Get Class: the name of the class (e.g. More...
|
|
std::string | getID () const |
| Get ID: object identification string that is not copied. More...
|
|
std::string | getIdent () const |
| Get Ident: object identification string that is copied. More...
|
|
int | getNObject () const |
| Get NObject: number of AST objects in existence of the same type as the underlying AST class. More...
|
|
int | getObjSize () const |
| Get ObjSize: the in-memory size of the AST object in bytes. More...
|
|
int | getRefCount () const |
| Get RefCount: number of active pointers to the underlying AST object. More...
|
|
bool | getUseDefs () const |
| Get UseDefs: allow use of default values for Object attributes? More...
|
|
void | lock (bool wait) |
| Lock this object for exclusive use by the calling thread. More...
|
|
bool | same (Object const &other) const |
| Does this contain the same AST object as another? More...
|
|
void | setID (std::string const &id) |
| Set ID: object identification string that is not copied. More...
|
|
void | setIdent (std::string const &ident) |
| Set Ident: object identification string that is copied. More...
|
|
void | setUseDefs (bool usedefs) |
| Set UseDefs: allow use of default values for Object attributes? More...
|
|
void | show (std::ostream &os, bool showComments=true) const |
| Print a textual description the object to an ostream. More...
|
|
std::string | show (bool showComments=true) const |
| Return a textual description the object as a string. More...
|
|
bool | test (std::string const &attrib) const |
| Has this attribute been explicitly set (and not subsequently cleared)? More...
|
|
void | unlock (bool report=false) |
| Unlock this object previously locked using lock, so that other threads can use this object. More...
|
|
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:
- D: double
- F: float
- I: int
- S: short int
- B: char
- C: string (internally: char *)
- A: astshim Object (internally: AstObject *)
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:
- put<X> that takes a scalar will and a key with one value
- put<X> that takes a vector will add a key with a vector of values
- append will append one value to a key (in AST this is one of two functions handled by
astMapPutElem<X>
- replace will replace one value in a key (in AST this is one of two functions handled by
astMapPutElem<X>
)
Attributes
KeyMap has the following attributes, in addition to those inherited from Object
KeyCase
: Sets the case in which keys are stored
KeyError
: Report an error if the requested key does not exist?
SizeGuess
: The expected size of the KeyMap.
SortBy
: Determines how keys are sorted in a KeyMap.
MapLocked
: Prevent new entries being added to the KeyMap?
Definition at line 83 of file KeyMap.h.