casacore
|
Envelope class to handle Lattice Coordinates in LEL. More...
#include <LELCoordinates.h>
Public Member Functions | |
LELCoordinates () | |
Define the possible comparison results. More... | |
LELCoordinates (LELLattCoordBase *coordinates) | |
Construct the object from the given letter class. More... | |
LELCoordinates (const LELCoordinates &that) | |
Copy constructor (reference semantics). More... | |
~LELCoordinates () | |
LELCoordinates & | operator= (const LELCoordinates &that) |
Assignment (reference semantics). More... | |
Bool | isNull () const |
Is the coordinates a null object? More... | |
Bool | hasCoordinates () const |
Does the class have true coordinates? It returns False if this is a null object. More... | |
Int | compare (const LELCoordinates &other) const |
Check how the coordinates of this and that compare. More... | |
const LELLattCoordBase & | coordinates () const |
Return the underlying letter object. More... | |
Private Attributes | |
CountedPtr< LELLattCoordBase > | coords_p |
The pointer to the underlying object. More... | |
Envelope class to handle Lattice Coordinates in LEL.
Public interface
The LatticeExpression classes (LatticeExpr, LatticeExprNode, LEL*) exist so that the C++ programmer can manipulate mathematical expressions involving Lattices. A further usage of these classes is to manipulate ImageInterface objects (which inherit from Lattice) such as PagedImages. These objects have Coordinates as well as the Lattice pixels. In order that Coordinate conformance be enforcable, we must give the LatticeExpression classes access to the Coordinates of the ImageInterface objects.
This is done through the interface of the LELCoordinates class. It is actually an envelope class which holds letter classes which are the actual implementation of the objects which hold the Lattice CoordinateSystems. Lattice objects have a member function called lelCoordinates
. This returns a LELCoordinates object. This object contains a pointer (actually a CountedPtr) of type LELLattCoordBase. This is the base class of the letter classes. For Lattices such as ImageInterface, this pointer actually points at the derived letter class LELImageCoord. This class in turn contains a pointer (a CountedPtr) to the actual CoordinateSystem object.
Note that every time the lelCoordinates
function is called, the LELLattCoord and LELImageCoord (or whatever the letter class actually being invoked is) objects are constructed. For example the internals of ImageInterface::lelCoordinates
are
return LELCoordinates (new LELImageCoord (coords_p));
so that the LELCoordinates constructor invokes the LELImageCoord constructor with the CoordinateSystem as its argument. However, the internal use of CountedPtrs makes subsequent constructions inexpensive.
Having a LELCoordinates object in hand, the programmer then has access to the CoordinateSystem that it ultimately contains. This is via the LELCoordinates member function coordinates
which returns a reference to the letter base class LELLattCoordBase. For example, if the actual letter class object was LELImageCoord, one has to then cast the reference returned by LELCoordinates::coordinates()
to an LELImageCoord. This is because the LELImageCoord class functions that actually deal with the CoordinateSystem are not virtual (otherwise LELLattCoordBase needs to know about Coordinates).
We needed access to CoordinateSystems in the Lattice Expression classes without making the Lattices module dependent on the Images or Coordinates module.
Definition at line 123 of file LELCoordinates.h.
casacore::LELCoordinates::LELCoordinates | ( | ) |
Define the possible comparison results.
The default constructor creates a null object.
casacore::LELCoordinates::LELCoordinates | ( | LELLattCoordBase * | coordinates | ) |
Construct the object from the given letter class.
It takes over the pointer and takes care of destructing the LELLattCoordBase object.
casacore::LELCoordinates::LELCoordinates | ( | const LELCoordinates & | that | ) |
Copy constructor (reference semantics).
casacore::LELCoordinates::~LELCoordinates | ( | ) |
Int casacore::LELCoordinates::compare | ( | const LELCoordinates & | other | ) | const |
Check how the coordinates of this and that compare.
The return value tells how they compare.
-1: this is subset
0: equal
1: this is superset
9: invalid (mismatch)
const LELLattCoordBase& casacore::LELCoordinates::coordinates | ( | ) | const |
Return the underlying letter object.
This should in general not be used, but for specific (Image) cases it might be needed.
Bool casacore::LELCoordinates::hasCoordinates | ( | ) | const |
Does the class have true coordinates? It returns False if this is a null object.
|
inline |
Is the coordinates a null object?
Definition at line 144 of file LELCoordinates.h.
References coords_p.
LELCoordinates& casacore::LELCoordinates::operator= | ( | const LELCoordinates & | that | ) |
Assignment (reference semantics).
|
private |
The pointer to the underlying object.
Definition at line 166 of file LELCoordinates.h.
Referenced by isNull().