Loading...
Searching...
No Matches
casacore::LELCoordinates Class Reference
lattices package (libcasa_lattices) » LEL_module

More...

`#include <LELCoordinates.h>`

## Public Member Functions

| LELCoordinates ()
| Define the possible comparison results.
| LELCoordinates (LELLattCoordBase *coordinates)
| Construct the object from the given letter class.
| LELCoordinates (const LELCoordinates &that)
| Copy constructor (reference semantics).
| ~LELCoordinates ()
LELCoordinates & | operator= (const LELCoordinates &that)
| Assignment (reference semantics).
Bool | isNull () const
| Is the coordinates a null object?
Bool | hasCoordinates () const
| Does the class have true coordinates?
Int | compare (const LELCoordinates &other) const
| Check how the coordinates of this and that compare.
const LELLattCoordBase & | coordinates () const
| Return the underlying letter object.

## Private Attributes

std::shared_ptr< LELLattCoordBase > | coords_p
| The pointer to the underlying object.

## Detailed Description

Envelope class to handle Lattice Coordinates in LEL.

### Intended use:

Public interface

### Review Status

Reviewed By:
  Bob Garwood
Date Reviewed:
  2000/01/25
Test programs:
  tLatticeExpr

### Prerequisite

- Lattice
- LELLattCoordBase

### Synopsis

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 std::shared_ptr) 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 std::shared_ptr) 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 std::shared_ptrs 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).

### Example

PagedImage<Float> im("myimage");
const LELCoordinates* pLatCoord = &(im.lelCoordinates());
const LELImageCoord* pImCoord =
dynamic_cast<const LELImageCoord*>(pLatCoord);
CoordinateSystem coords = pImCoord->coordinates();
casacore::CoordinateSystem
Definition CoordinateSystem.h:215
casacore::LELCoordinates::LELCoordinates
LELCoordinates()
Define the possible comparison results.
casacore::LELImageCoord
Definition LELImageCoord.h:76
casacore::LELImageCoord::coordinates
const CoordinateSystem & coordinates() const
Get the coordinates.
Definition LELImageCoord.h:147
casacore::PagedImage
Definition PagedImage.h:134

### Motivation

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 121 of file LELCoordinates.h.

## Constructor & Destructor Documentation

## LELCoordinates() [1/3]

casacore::LELCoordinates::LELCoordinates | ( |  | ) |

Define the possible comparison results.

The default constructor creates a null object.

Referenced by compare(), LELCoordinates(), and operator=().

## LELCoordinates() [2/3]

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.

References coordinates().

## LELCoordinates() [3/3]

casacore::LELCoordinates::LELCoordinates | ( | const LELCoordinates & | that | ) |

Copy constructor (reference semantics).

References LELCoordinates().

## ~LELCoordinates()

casacore::LELCoordinates::~LELCoordinates | ( |  | ) |

## Member Function Documentation

## compare()

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)

References LELCoordinates().

## coordinates()

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.

Referenced by LELCoordinates().

## hasCoordinates()

Bool casacore::LELCoordinates::hasCoordinates | ( |  | ) | const

Does the class have true coordinates?

It returns False if this is a null object.

## isNull()

Bool casacore::LELCoordinates::isNull | ( |  | ) | const

inline

Is the coordinates a null object?

Definition at line 142 of file LELCoordinates.h.

References coords_p.

## operator=()

LELCoordinates & casacore::LELCoordinates::operator= | ( | const LELCoordinates & | that | ) |

Assignment (reference semantics).

References LELCoordinates().

## Member Data Documentation

## coords_p

std::shared_ptr<LELLattCoordBase> casacore::LELCoordinates::coords_p

private

The pointer to the underlying object.

Definition at line 164 of file LELCoordinates.h.

Referenced by isNull().

The documentation for this class was generated from the following file:

- lattices/LEL/LELCoordinates.h