LSSTApplications
17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
LSSTDataManagementBasePackage
|
Abstract base class for all AST objects. More...
#include <Object.h>
Public Types | |
using | ObjectPtr = std::unique_ptr< AstObject, Deleter > |
unique pointer holding an AST raw pointer More... | |
Public Member Functions | |
virtual | ~Object () |
Object (Object const &object) | |
Copy constructor: make a deep copy. More... | |
Object (Object &&)=default | |
Object & | operator= (Object const &)=delete |
Object & | operator= (Object &&)=default |
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... | |
std::shared_ptr< Object > | copy () const |
Return a deep copy of this object. 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... | |
AstObject const * | getRawPtr () const |
Get the raw AST pointer. More... | |
AstObject * | getRawPtr () |
Get the raw AST pointer. More... | |
Static Public Member Functions | |
static std::shared_ptr< Object > | fromString (std::string const &str) |
Construct an Object from a string, using astFromString. More... | |
template<typename Class > | |
static std::shared_ptr< Class > | fromAstObject (AstObject *rawObj, bool copy) |
Given a bare AST object pointer return a shared pointer to an ast::Object of the correct type. More... | |
Protected Member Functions | |
Object (AstObject *object) | |
Construct an Object from a pointer to a raw AstObject. More... | |
template<typename T , typename AstT > | |
std::shared_ptr< T > | copyImpl () const |
Implementation of deep copy. More... | |
virtual std::shared_ptr< Object > | copyPolymorphic () const =0 |
Return a deep copy of this object. More... | |
bool | getB (std::string const &attrib) const |
Get the value of an attribute as a bool. More... | |
std::string const | getC (std::string const &attrib) const |
Get the value of an attribute as a string. More... | |
double | getD (std::string const &attrib) const |
Get the value of an attribute as a double. More... | |
float | getF (std::string const &attrib) const |
Get the value of an attribute as a float. More... | |
int | getI (std::string const &attrib) const |
Get the value of an attribute as an int. More... | |
long int | getL (std::string const &attrib) const |
Get the value of an attribute as a long int. More... | |
void | set (std::string const &setting) |
Assign a set of attribute values, over-riding any previous values. More... | |
void | setB (std::string const &attrib, bool value) |
Set the value of an attribute as a bool. More... | |
void | setC (std::string const &attrib, std::string const &value) |
Set the value of an attribute as a string. More... | |
void | setD (std::string const &attrib, double value) |
Set the value of an attribute as a double. More... | |
void | setF (std::string const &attrib, float value) |
Set the value of an attribute as a float. More... | |
void | setI (std::string const &attrib, int value) |
Set the value of an attribute as an int. More... | |
void | setL (std::string const &attrib, long int value) |
Set the value of an attribute as a long int. More... | |
Static Protected Member Functions | |
template<typename ShimT , typename AstT > | |
static std::shared_ptr< ShimT > | makeShim (AstObject *p) |
Functor to make an astshim instance from a raw AST pointer of the corresponding type. More... | |
Friends | |
class | MapSplit |
class | FrameDict |
Abstract base class for all AST objects.
Object provides the following attributes:
using ast::Object::ObjectPtr = std::unique_ptr<AstObject, Deleter> |
|
inline |
Copy constructor: make a deep copy.
Definition at line 64 of file Object.h.
|
default |
|
explicitprotected |
Construct an Object from a pointer to a raw AstObject.
Definition at line 165 of file Object.cc.
|
inline |
Clear the values of a specified set of attributes for an Object.
Clearing an attribute cancels any value that has previously been explicitly set for it, so that the standard default attribute value will subsequently be used instead. This also causes the astTest function to return the value zero for the attribute, indicating that no value has been set.
Definition at line 119 of file Object.h.
|
inline |
Return a deep copy of this object.
Definition at line 109 of file Object.h.
|
inlineprotected |
Implementation of deep copy.
Should be called to implement copyPolymorphic by all derived classes.
Definition at line 320 of file Object.h.
|
protectedpure virtual |
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:
Implemented in ast::Frame, ast::KeyMap, ast::FrameSet, ast::Mapping, ast::MathMap, ast::ChebyMap, ast::SpecFrame, ast::WcsMap, ast::FrameDict, ast::SkyFrame, ast::PolyMap, ast::TimeMap, ast::SlaMap, ast::Channel, ast::TimeFrame, ast::PcdMap, ast::CmpMap, ast::LutMap, ast::CmpFrame, ast::PermMap, ast::MatrixMap, ast::RateMap, ast::TranMap, ast::ParallelMap, ast::SeriesMap, ast::SphMap, ast::UnitNormMap, ast::ZoomMap, ast::NormMap, ast::WinMap, ast::UnitMap, and ast::ShiftMap.
|
static |
Given a bare AST object pointer return a shared pointer to an ast::Object of the correct type.
The returned object takes ownership of the pointer. This is almost always what you want, for instance astDecompose returns shallow copies of the internal pointers.
Class | The class of the returned shared pointer. (The actual class will be the correct class of rawPtr.) |
[in] | rawObj | A bare AST object pointer |
[in] | copy | If True then make a deep copy of the pointer (and free the original) |
Definition at line 132 of file Object.cc.
|
inlinestatic |
Construct an Object from a string, using astFromString.
Definition at line 88 of file Object.h.
|
inlineprotected |
Get the value of an attribute as a bool.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 348 of file Object.h.
|
inlineprotected |
Get the value of an attribute as a string.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 361 of file Object.h.
|
inline |
Get Class: the name of the class (e.g.
Note: if AST returns "CmpMap" then the name will be changed to "SeriesMap" or "ParallelMap", as appropriate.
Definition at line 139 of file Object.h.
|
inlineprotected |
Get the value of an attribute as a double.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 374 of file Object.h.
|
inlineprotected |
Get the value of an attribute as a float.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 387 of file Object.h.
|
inlineprotected |
Get the value of an attribute as an int.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 400 of file Object.h.
|
inline |
Get ID: object identification string that is not copied.
Definition at line 142 of file Object.h.
|
inline |
Get Ident: object identification string that is copied.
Definition at line 145 of file Object.h.
|
inlineprotected |
Get the value of an attribute as a long int.
If possible, the attribute value is converted to the type you request.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 413 of file Object.h.
|
inline |
Get NObject: number of AST objects in existence of the same type as the underlying AST class.
Definition at line 153 of file Object.h.
|
inline |
Get ObjSize: the in-memory size of the AST object in bytes.
Definition at line 156 of file Object.h.
|
inline |
|
inline |
|
inline |
Get RefCount: number of active pointers to the underlying AST object.
Definition at line 163 of file Object.h.
|
inline |
Get UseDefs: allow use of default values for Object attributes?
Definition at line 166 of file Object.h.
|
inline |
Does this object have an attribute with the specified name?
Definition at line 127 of file Object.h.
|
inline |
Lock this object for exclusive use by the calling thread.
The thread-safe public interface to AST is designed so that an error is reported if any thread attempts to use an Object that it has not previously locked for its own exclusive use using this function. When an Object is created, it is initially locked by the thread that creates it, so newly created objects do not need to be explicitly locked. However, if an Object pointer is passed to another thread, the original thread must first unlock it (using astUnlock) and the new thread must then lock it (using astLock) before the new thread can use the Object.
[in] | wait | If the Object is curently locked by another thread then this function will either report an error or block. If a non-zero value is supplied for "wait", the calling thread waits until the object is available for it to use. Otherwise, an error is reported and the function returns immediately without locking the Object. |
Definition at line 202 of file Object.h.
|
inlinestaticprotected |
Functor to make an astshim instance from a raw AST pointer of the corresponding type.
ShimT | Output astshim class |
AstT | Output AST class |
|
inline |
bool ast::Object::operator== | ( | Object const & | rhs | ) | const |
Return True if this and rhs
are the equal.
For two objects be equal, they both must have the same attributes and all contained objects must be equal.
Definition at line 82 of file Object.cc.
|
inline |
Does this contain the same AST object as another?
This is a test of identity, not of equality.
Definition at line 212 of file Object.h.
|
inlineprotected |
Assign a set of attribute values, over-riding any previous values.
The attributes and their new values are specified via a character string, which should contain a comma-separated list of the form: "attribute_1 = value_1, attribute_2 = value_2, ... " where "attribute_n" specifies an attribute name, and the value to the right of each " =" sign should be a suitable textual representation of the value to be assigned. This value will be interpreted according to the attribute's data type.
std::runtime_error | if the attribute is read-only |
Definition at line 440 of file Object.h.
|
inlineprotected |
Set the value of an attribute as a bool.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 452 of file Object.h.
|
inlineprotected |
Set the value of an attribute as a string.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 464 of file Object.h.
|
inlineprotected |
Set the value of an attribute as a double.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 476 of file Object.h.
|
inlineprotected |
Set the value of an attribute as a float.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 488 of file Object.h.
|
inlineprotected |
Set the value of an attribute as an int.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 500 of file Object.h.
|
inline |
Set ID: object identification string that is not copied.
Definition at line 215 of file Object.h.
|
inline |
Set Ident: object identification string that is copied.
Definition at line 218 of file Object.h.
|
inlineprotected |
Set the value of an attribute as a long int.
If possible, the type you provide is converted to the actual type of the attribute.
std::runtime_error | if the attribute does not exist or the value cannot be converted |
Definition at line 512 of file Object.h.
|
inline |
Set UseDefs: allow use of default values for Object attributes?
Definition at line 221 of file Object.h.
void ast::Object::show | ( | std::ostream & | os, |
bool | showComments = true |
||
) | const |
Print a textual description the object to an ostream.
[in,out] | os | The stream to which to write the string representation. |
[in] | showComments | Show comments? |
Definition at line 152 of file Object.cc.
std::string ast::Object::show | ( | bool | showComments = true | ) | const |
Return a textual description the object as a string.
[in] | showComments | Show comments? |
Definition at line 159 of file Object.cc.
|
inline |
Has this attribute been explicitly set (and not subsequently cleared)?
false
.std::runtime_error | if an error results. |
Definition at line 250 of file Object.h.
|
inline |
Unlock this object previously locked using lock, so that other threads can use this object.
See lock for further details.
[in] | report | If true, an error will be reported if the supplied Object, or any Object contained within the supplied Object, is not currently locked by the running thread. If false, such Objects will be left unchanged, and no error will be reported. |
Definition at line 280 of file Object.h.