My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
PointingTelescopes.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_POINTINGTELESCOPES_H
2 #define GCP_UTIL_POINTINGTELESCOPES_H
3 
14 #include <iostream>
15 #include <map>
16 
17 #include "gcp/grabber/common/Channel.h"
18 
19 #include "gcp/util/common/Mutex.h"
20 
21 namespace gcp {
22  namespace util {
23 
25  public:
26 
27  enum Ptel {
28  PTEL_NONE = 0x0,
29  PTEL_ZERO = 0x1,
30  PTEL_ONE = 0x2,
31  PTEL_TWO = 0x4,
32  PTEL_ALL = PTEL_ZERO | PTEL_ONE | PTEL_TWO
33  };
34 
35  static const unsigned short nPtel_ = 3;
36 
37  // Constructor.
38 
40 
41  // Output Operator.
42 
43  friend std::ostream& operator<<(std::ostream& os, PointingTelescopes& obj);
44 
45  // Destructor.
46 
47  virtual ~PointingTelescopes();
48 
49  static unsigned ptelToInt(Ptel ptel);
50  static Ptel intToPtel(unsigned iPtel);
51 
52  // Return the pointing telescope that corresponds to the passed
53  // frame grabber channel ID
54 
55  static Ptel getPtels(gcp::grabber::Channel::FgChannel channel);
56  static Ptel getSinglePtel(gcp::grabber::Channel::FgChannel channel);
57 
58  // Return the pointing telescope that corresponds to the
59  // frame grabber channel number (integer from 0-2)
60 
61  static Ptel getSinglePtel(unsigned channel);
62 
63  // Return the frame grabber channel id that corresponds to the
64  // passed pointing telescope
65 
66  static gcp::grabber::Channel::FgChannel getFgChannels(Ptel ptelMask);
67 
68  static gcp::grabber::Channel::FgChannel getSingleFgChannel(Ptel ptel);
69 
70  // Return the integer frame grabber channel number that
71  // corresponds to the passed pointing telescope
72 
73  static unsigned getSingleIntChannel(Ptel ptel);
74 
75  // Set up an asoociation between a pointing telescope and a
76  // frame grabber channel
77 
78  static void assignFgChannel(Ptel ptel,
79  gcp::grabber::Channel::FgChannel chan);
80 
81  // Static utility functions
82 
83  static bool isSinglePtel(Ptel ptel);
84 
85  static std::vector<Ptel> getPtels(Ptel ptelMask);
86 
87  friend std::ostream&
88  gcp::util::operator<<(std::ostream& os,
89  PointingTelescopes::Ptel& ptel);
90 
91  static void setDefaultFgChannels(gcp::grabber::Channel::FgChannel channels);
92  static void setDefaultPtels(Ptel ptels);
93 
94  static gcp::grabber::Channel::FgChannel getDefaultFgChannels();
95 
96  static PointingTelescopes::Ptel getDefaultPtels();
97 
98  private:
99 
100  static Mutex guard_;
101 
102  // A default channel mask to use
103 
104  static gcp::grabber::Channel::FgChannel defaultChannels_;
105 
106  // A map of ptel - channel associations
107 
108  static std::map<PointingTelescopes::Ptel,
109  gcp::grabber::Channel::FgChannel> channels_;
110 
111  // A map of channel - ptel associations
112 
113  static std::map<gcp::grabber::Channel::FgChannel,
114  PointingTelescopes::Ptel> ptels_;
115 
116  }; // End class PointingTelescopes
117 
118  } // End namespace util
119 } // End namespace gcp
120 
121 #endif
static gcp::grabber::Channel::FgChannel getSingleFgChannel(Ptel ptel)
Definition: PointingTelescopes.cc:136
static Ptel getSinglePtel(gcp::grabber::Channel::FgChannel channel)
Definition: PointingTelescopes.cc:90
PointingTelescopes()
Definition: PointingTelescopes.cc:22
Definition: Mutex.h:16
static unsigned getSingleIntChannel(Ptel ptel)
Definition: PointingTelescopes.cc:154
static Ptel getPtels(gcp::grabber::Channel::FgChannel channel)
Definition: PointingTelescopes.cc:71
static gcp::grabber::Channel::FgChannel getFgChannels(Ptel ptelMask)
Definition: PointingTelescopes.cc:117
static void assignFgChannel(Ptel ptel, gcp::grabber::Channel::FgChannel chan)
Definition: PointingTelescopes.cc:163
virtual ~PointingTelescopes()
Definition: PointingTelescopes.cc:64
Definition: PointingTelescopes.h:24