Template Class StarList

Inheritance Relationships

Base Type

  • public std::list< std::shared_ptr< Star > >

Class Documentation

template<class Star>
class StarList : public std::list<std::shared_ptr<Star>>

std::lists of Stars.

It is a template class, which means that the Star type remains undefined until a user defines it. The std::list related operations (insertion, sort, traversal) are to be carried out using STL list operations. Most of the Star operations rely on routines to be provided in the Star class, usually user defined. The instanciation of this class for BaseStar (i.e. the replacement of the formal parameter ‘Star’ by ‘BaseStar’) is called BaseStarList. Take care: what is stored is pointers on Star’s and NOT Star’s. This implies that Stars being inserted in the std::list have to be obtained using ‘new’.

Public Types

typedef std::shared_ptr<Star> Element
typedef std::list<Element>::const_iterator StarCIterator
typedef std::list<Element>::iterator StarIterator

Public Functions

StarList()

: default constructor (empty std::list).

virtual ~StarList()
void dump(std::ostream &stream = std::cout) const

invokes dump(stream) for all Stars in the std::list.

void fluxSort()

a model routine to sort the std::list

see decreasingFlux() to see what it is, if you want another sorting criterion)

void cutTail(const int nKeep)

cuts the end of the std::list

void extractInFrame(StarList<Star> &out, const Frame &frame) const

copy the part of the std::list which is included in the frame at the end of another std::list

void copyTo(StarList<Star> &copy) const

clears copy and makes a copy of the std::list to copy

void clearList()

Clears the std::list.

template<class Operator>
void applyTransform(const Operator &op)

enables to apply a geometrical transform if Star is Basestar or derives from it.

could be extended to other type of transformations.