|
lsst.astshim gf5dcc679e7+7aca86229d
|
A FrameSet whose frames can be referenced by domain name. More...
#include <FrameDict.h>
Public Member Functions | |
| FrameDict (Frame const &frame, std::string const &options="") | |
| Construct a FrameDict from a single Frame. | |
| FrameDict (Frame const &baseFrame, Mapping const &mapping, Frame const ¤tFrame, std::string const &options="") | |
| Construct a FrameDict from two frames and a mapping that connects them. | |
| FrameDict (FrameSet const &frameSet) | |
| Construct a FrameDict from a FrameSet. | |
| virtual | ~FrameDict () |
| FrameDict (FrameDict const &)=default | |
| Copy constructor: make a deep copy. | |
| FrameDict (FrameDict &&)=default | |
| FrameDict & | operator= (FrameDict const &)=delete |
| FrameDict & | operator= (FrameDict &&)=default |
| std::shared_ptr< FrameDict > | copy () const |
| Return a deep copy of this object. | |
| void | addFrame (int iframe, Mapping const &map, Frame const &frame) override |
| Add a new Frame and an associated Mapping to this FrameSet so as to define a new coordinate system, derived from one which already exists within this FrameSet. | |
| void | addFrame (std::string const &domain, Mapping const &map, Frame const &frame) |
| Variant of addFrame(int, ...) where the initial frame is specified by domain. | |
| std::set< std::string > | getAllDomains () const |
| Get the domain names for all contained Frames (excluding frames with empty or defaulted domain names). | |
| std::shared_ptr< Frame > | getFrame (std::string const &domain, bool copy=true) const |
| Variant of getFrame(int, bool) where the frame is specified by domain name. | |
| std::shared_ptr< Mapping > | getMapping (int from, std::string const &to) const |
| Variant of FrameSet::getMapping with the second frame specified by domain. | |
| std::shared_ptr< Mapping > | getMapping (std::string const &from, int to) const |
| Variant of FrameSet::getMapping with the first frame specified by domain. | |
| std::shared_ptr< Mapping > | getMapping (std::string const &from, std::string const &to) const |
| Variant of FrameSet::getMapping with the both frames specified by domain. | |
| int | getIndex (std::string const &domain) const |
| Get the index of a frame specified by domain. | |
| bool | hasDomain (std::string const &domain) const |
| Return True if a frame in this FrameDict has the specified domain. | |
| void | mirrorVariants (std::string const &domain) |
| Variant of mirrorVariants(int) with the frame specified by domain. | |
| void | remapFrame (std::string const &domain, Mapping &map) |
| Variant of remapFrame(int, Mapping&) with the frame specified by domain. | |
| void | removeFrame (int iframe) override |
| Remove a Frame from a FrameSet. | |
| void | removeFrame (std::string const &domain) |
| Variant of removeFrame(int) with the frame specified by domain. | |
| void | setBase (std::string const &domain) |
| Variant of setBase(int) with the frame specified by domain. | |
| void | setCurrent (std::string const &domain) |
| Variant of setCurrent(int) with the frame specified by domain. | |
| void | setDomain (std::string const &domain) override |
| Set the domain of the current frame (and update the internal dict). | |
| std::shared_ptr< Frame > | getFrame (int iframe, bool copy=true) const |
| Obtain a deep copy of the specified Frame. | |
| std::shared_ptr< Mapping > | getMapping (int from=BASE, int to=CURRENT) const |
| Obtain a Mapping that converts between two Frames in a FrameSet. | |
| void | mirrorVariants (int iframe) |
| Indicates that all access to the Variant attribute of the current Frame should should be forwarded to some other nominated Frame in the FrameSet. | |
| void | remapFrame (int iframe, Mapping &map) |
| Modify the relationship (i.e. | |
| void | setBase (int ind) |
| Set Base: index of base Frame. | |
| void | setCurrent (int ind) |
| Set Current: index of current Frame, starting from 1. | |
| void | addAxes (Frame const &frame) |
| Append the axes from a specified Frame to every existing Frame in this FrameSet. | |
| void | addVariant (Mapping const &map, std::string const &name) |
| Store a new variant Mapping with the current Frame. | |
| std::string | getAllVariants () const |
| Get AllVariants: a list of all variant mappings stored with the current Frame. | |
| int | getBase () const |
| Get Base: index of base Frame. | |
| int | getCurrent () const |
| Get Current: index of current Frame, starting from 1. | |
| int | getNFrame () const |
| Get FrameSet_NFrame "NFrame": number of Frames in the FrameSet, starting from 1. | |
| std::string | getVariant () const |
| Variant: name of variant mapping in use by current Frame | |
| void | renameVariant (std::string const &name) |
| Rename the current Variant of the current Mapping. | |
Static Public Attributes | |
| static int constexpr | BASE = AST__BASE |
| index of base frame | |
| static int constexpr | CURRENT = AST__CURRENT |
| index of current frame | |
| static int constexpr | NOFRAME = AST__NOFRAME |
| an invalid frame index | |
Protected Member Functions | |
| virtual std::shared_ptr< Object > | copyPolymorphic () const override |
| std::shared_ptr< FrameSet > | getFrameSet () const |
| Return a deep copy as a FrameSet. | |
| FrameDict (AstFrameSet *rawptr) | |
| Construct a FrameDict from a raw AST pointer. | |
Friends | |
| class | Object |
A FrameSet whose frames can be referenced by domain name.
For every FrameSet method that takes a frame index, the same method in FrameDict may take a (case blind) domain name or a frame index.
This has several useful applications:
All contained Frames with explicitly set, non-empty domains must have unique domains (where the comparison ignores case). Use FrameSet if you want a collection of Frames that may have matching domains.
All those of FrameSet.
Definition at line 67 of file FrameDict.h.
|
inlineexplicit |
Construct a FrameDict from a single Frame.
The frame is deep copied.
| [in] | frame | the first Frame to be inserted into the FrameDict. This initially becomes both the base and the current Frame. Further Frames may be added using addFrame |
| [in] | options | Comma-separated list of attribute assignments. |
Definition at line 81 of file FrameDict.h.
|
inlineexplicit |
Construct a FrameDict from two frames and a mapping that connects them.
Both frames and the mapping are deep copied.
| [in] | baseFrame | base Frame. |
| [in] | mapping | mapping connecting baseFrame to currentFrame. |
| [in] | currentFrame | current Frame. |
| [in] | options | Comma-separated list of attribute assignments. |
| std::invalid_argument | if both Frames have the same non-empty domain. |
Definition at line 97 of file FrameDict.h.
|
inlineexplicit |
|
inlinevirtual |
Definition at line 114 of file FrameDict.h.
|
default |
Copy constructor: make a deep copy.
|
default |
|
explicitprotected |
Construct a FrameDict from a raw AST pointer.
Definition at line 74 of file FrameDict.cc.
|
inlineinherited |
Append the axes from a specified Frame to every existing Frame in this FrameSet.
In detail, each Frame in this FrameSet is replaced by a CmpFrame containing the original Frame and the Frame specified by parameter frame. In addition, each Mapping in the FrameSet is replaced by a CmpMap containing the original Mapping and a UnitMap in parallel. The NIn and NOut attributes of the UnitMap are set equal to the number of axes in the supplied Frame. Each new CmpMap is simplified before being stored in the FrameSet.
| [in] | frame | Frame whose axes are to be appended to each Frame in this FrameSet. |
Definition at line 160 of file FrameSet.h.
|
overridevirtual |
Add a new Frame and an associated Mapping to this FrameSet so as to define a new coordinate system, derived from one which already exists within this FrameSet.
If frame is a Frame then it becomes the current frame and its index is the new number of frames. If frame is a FrameSet then its current frame becomes the new current frame and the indices of all its frames are increased by the number of frames originally in this FrameSet. In both cases the indices of the Frames already in this FrameSet are left unchanged.
| [in] | iframe | The index of the Frame within the FrameSet which describes the coordinate system upon which the new one is to be based. This value should lie in the range from 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame respectively. A value of AST__ALLFRAMES is not permitted; call addAllFrames instead. |
| [in] | map | A Mapping which describes how to convert coordinates from the old coordinate system (described by the Frame with index iframe ) into coordinates in the new system. The Mapping's forward transformation should perform this conversion, and its inverse transformation should convert in the opposite direction. |
| [in] | frame | A Frame that describes the new coordinate system. Any type of Frame may be supplied (including Regions and FrameSets). This function may also be used to merge two FrameSets by supplying a pointer to a second FrameSet for this parameter (see the Notes section for details). |
| std::invalid_argument | if frame has a non-empty domain and this FrameDict already contains a Frame with that domain |
Reimplemented from ast::FrameSet.
Definition at line 32 of file FrameDict.cc.
| void ast::FrameDict::addFrame | ( | std::string const & | domain, |
| Mapping const & | map, | ||
| Frame const & | frame ) |
Variant of addFrame(int, ...) where the initial frame is specified by domain.
Definition at line 41 of file FrameDict.cc.
|
inlineinherited |
Store a new variant Mapping with the current Frame.
The newly added variant becomes the current variant (attribute the Variant is set to name).
See the Variant attribute for more details. See also getVariant, renameVariant and mirrorVariants
| [in] | map | A Mapping which describes how to convert coordinates from the current frame to the new variant of the current Frame. |
| [in] | name | The name to associate with the new variant Mapping. |
| std::runtime_error | if:
|
Definition at line 234 of file FrameSet.h.
|
inline |
Return a deep copy of this object.
Definition at line 123 of file FrameDict.h.
|
inlineoverrideprotectedvirtual |
Reimplemented from ast::FrameSet.
Definition at line 257 of file FrameDict.h.
| std::set< std::string > ast::FrameDict::getAllDomains | ( | ) | const |
Get the domain names for all contained Frames (excluding frames with empty or defaulted domain names).
Definition at line 45 of file FrameDict.cc.
|
inlineinherited |
Get AllVariants: a list of all variant mappings stored with the current Frame.
Definition at line 243 of file FrameSet.h.
|
inlineinherited |
Get Base: index of base Frame.
Definition at line 248 of file FrameSet.h.
|
inlineinherited |
Get Current: index of current Frame, starting from 1.
Definition at line 253 of file FrameSet.h.
|
inline |
Obtain a deep copy of the specified Frame.
| [in] | iframe | The index of the required Frame within this FrameSet. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::Base or FrameSet::CURRENT may be given to specify the base Frame or the current Frame, respectively. |
| [in] | copy | If true return a deep copy, else a shallow copy. |
Definition at line 270 of file FrameSet.h.
|
inline |
Variant of getFrame(int, bool) where the frame is specified by domain name.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 151 of file FrameDict.h.
|
inlineprotected |
Return a deep copy as a FrameSet.
This is used internally for operations that modify the contents:
This could be a public member function, but wait until a need is identified.
Warning: this must return a FrameSet, not a FrameDict in order to avoid an infinite loop.
Definition at line 273 of file FrameDict.h.
|
inline |
Get the index of a frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 189 of file FrameDict.h.
|
inline |
Variant of FrameSet::getMapping with the second frame specified by domain.
| std::out_of_range | if no frame found with the specified from or to domain |
Definition at line 162 of file FrameDict.h.
|
inline |
Obtain a Mapping that converts between two Frames in a FrameSet.
| [in] | from | The index of the first Frame in the FrameSet, the frame describing the coordinate system for the "input" end of the Mapping. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). |
| [in] | to | The index of the second Frame in the FrameSet, the frame describing the coordinate system for the "output" end of the Mapping. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). |
Definition at line 304 of file FrameSet.h.
|
inline |
Variant of FrameSet::getMapping with the first frame specified by domain.
| std::out_of_range | if no frame found with the specified from or to domain |
Definition at line 171 of file FrameDict.h.
|
inline |
Variant of FrameSet::getMapping with the both frames specified by domain.
| std::out_of_range | if no frame found with the specified from or to domain |
Definition at line 180 of file FrameDict.h.
|
inlineinherited |
Get FrameSet_NFrame "NFrame": number of Frames in the FrameSet, starting from 1.
Definition at line 316 of file FrameSet.h.
|
inlineinherited |
Variant: name of variant mapping in use by current Frame
See also addVariant, mirrorVariants and renameVariant
Definition at line 323 of file FrameSet.h.
|
inline |
Return True if a frame in this FrameDict has the specified domain.
Definition at line 201 of file FrameDict.h.
|
inline |
Indicates that all access to the Variant attribute of the current Frame should should be forwarded to some other nominated Frame in the FrameSet.
For instance, if a value is set subsequently for the Variant attribute of the current Frame, the current Frame will be left unchanged and the setting is instead applied to the nominated Frame. Likewise, if the value of the Variant attribute is requested, the value returned is the value stored for the nominated Frame rather than the current Frame itself.
This provides a mechanism for propagating the effects of variant Mappings around a FrameSet. If a new Frame is added to a FrameSet by connecting it to an pre-existing Frame that has two or more variant Mappings, then it may be appropriate to set the new Frame so that it mirrors the variants Mappings of the pre-existing Frame. If this is done, then it will be possible to select a specific variant Mapping using either the pre-existing Frame or the new Frame.
See also addVariant, getVariant and renameVariant.
| [in] | iframe | The index of the Frame within the FrameSet which is to be mirrored by the current Frame. This value should lie in the range from 1 to the number of Frames in the FrameSet (as given by getNFrame). If AST__NOFRAME is supplied (or the current Frame is specified), then any mirroring established by a previous call to this function is disabled. A value of FrameSet::BASE may be given to specify the base frame. |
Definition at line 367 of file FrameSet.h.
|
inline |
Variant of mirrorVariants(int) with the frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 210 of file FrameDict.h.
|
inline |
Modify the relationship (i.e.
Mapping) between a specified Frame in a FrameSet and the other Frames in that FrameSet.
Typically, this might be required if the FrameSet has been used to calibrate (say) an image, and that image is re-binned. The Frame describing the image will then have undergone a coordinate transformation, and this should be communicated to the associated FrameSet using this function.
See also addVariant, getVariant and mirrorVariants.
| [in] | iframe | The index within the FrameSet of the Frame to be modified. This value should lie in the range 1 to the number of frames already in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame respectively. |
| [in] | map | A Mapping whose forward transformation converts coordinate values from the original coordinate system described by the Frame to the new one, and whose inverse transformation converts in the opposite direction. |
Definition at line 410 of file FrameSet.h.
|
inline |
Variant of remapFrame(int, Mapping&) with the frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 219 of file FrameDict.h.
|
overridevirtual |
Remove a Frame from a FrameSet.
Other Frame indices in the FrameSet are re-numbered as follows: Frame indices greater than iframe are decremented by one; other Frame indeces retain the same index.
| [in] | iframe | The index of the required Frame within this FrameSet. This value should lie in the range 1 to the number of Frames in this FrameSet (as given by getNFrame). A value of FrameSet::BASE or FrameSet::CURRENT may be given to specify the base Frame or the current Frame, respectively. |
| std::runtime_error | if you attempt to remove the last frame |
Reimplemented from ast::FrameSet.
Definition at line 53 of file FrameDict.cc.
| void ast::FrameDict::removeFrame | ( | std::string const & | domain | ) |
Variant of removeFrame(int) with the frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 59 of file FrameDict.cc.
|
inlineinherited |
Rename the current Variant of the current Mapping.
The Variant attribute is updated to name.
See the Variant attribute for more details. See also addVariant, getVariant and mirrorVariants.
| [in] | name | The new name of the current variant Mapping. |
| std::runtime_error | if:
|
Definition at line 463 of file FrameSet.h.
|
inline |
Set Base: index of base Frame.
Definition at line 471 of file FrameSet.h.
|
inline |
Variant of setBase(int) with the frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 238 of file FrameDict.h.
|
inline |
Set Current: index of current Frame, starting from 1.
Definition at line 476 of file FrameSet.h.
|
inline |
Variant of setCurrent(int) with the frame specified by domain.
| std::out_of_range | if no frame found with the specified domain |
Definition at line 247 of file FrameDict.h.
|
override |
Set the domain of the current frame (and update the internal dict).
| std::invalid_argument | if another frame already has this domain |
Definition at line 61 of file FrameDict.cc.
|
friend |
Definition at line 68 of file FrameDict.h.
|
staticconstexprinherited |
index of base frame
Definition at line 104 of file FrameSet.h.
|
staticconstexprinherited |
index of current frame
Definition at line 105 of file FrameSet.h.
|
staticconstexprinherited |
an invalid frame index
Definition at line 106 of file FrameSet.h.