lsst.jointcal  14.0-25-g01ea59d
StarList.h
Go to the documentation of this file.
1 // -*- LSST-C++ -*-
2 #ifndef LSST_JOINTCAL_STAR_LIST_H
3 #define LSST_JOINTCAL_STAR_LIST_H
4 
5 #include <string>
6 #include <list>
7 #include <iostream>
8 #include <memory>
9 
10 #include "lsst/jointcal/Point.h"
11 
12 namespace lsst {
13 namespace jointcal {
14 
15 class Frame;
16 
18 
34 template <class Star>
35 class StarList : public std::list<std::shared_ptr<Star>> {
36 public:
40 
41  /* constructors */
43  StarList(){};
44 
45  /* destructor */
46  virtual ~StarList(){};
47 
49  void dump(std::ostream &stream = std::cout) const {
50  for (auto &p : *this) p->dump(stream);
51  }
52 
54 
56  // le premier de la std::liste a le plus grand flux
57  void fluxSort();
58 
60  void cutTail(const int nKeep);
61 
63  void extractInFrame(StarList<Star> &out, const Frame &frame) const;
64 
66  void copyTo(StarList<Star> &copy) const;
67 
69  void clearList() { cutTail(0); };
70 
72 
74  template <class Operator>
75  void applyTransfo(const Operator &op) {
76  for (auto &p : *this) op.transformStar(*(p));
77  }
78 };
79 
81 template <class Star>
82 std::ostream &operator<<(std::ostream &stream, const StarList<Star> &list) {
83  list.dump(stream);
84  return stream;
85 }
86 } // namespace jointcal
87 } // namespace lsst
88 
89 #endif // LSST_JOINTCAL_STAR_LIST_H
T copy(T... args)
std::shared_ptr< Star > Element
Definition: StarList.h:37
StarList()
: default constructor (empty std::list).
Definition: StarList.h:43
void dump(std::ostream &stream=std::cout) const
invokes dump(stream) for all Stars in the std::list.
Definition: StarList.h:49
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 ...
Definition: StarList.cc:35
void cutTail(const int nKeep)
cuts the end of the std::list
Definition: StarList.cc:24
std::lists of Stars.
Definition: StarList.h:35
rectangle with sides parallel to axes.
Definition: Frame.h:19
Class for a simple mapping implementing a generic Gtransfo.
std::list< Element >::const_iterator StarCIterator
Definition: StarList.h:38
STL class.
void clearList()
Clears the std::list.
Definition: StarList.h:69
void copyTo(StarList< Star > &copy) const
clears copy and makes a copy of the std::list to copy
Definition: StarList.cc:44
void fluxSort()
a model routine to sort the std::list
Definition: StarList.cc:18
std::list< Element >::iterator StarIterator
Definition: StarList.h:39
STL class.
void applyTransfo(const Operator &op)
enables to apply a geometrical transfo if Star is Basestar or derives from it.
Definition: StarList.h:75