CARMA C++
CorrelatorHeader.h
Go to the documentation of this file.
1 #ifndef CORRELATORHEADER_H
2 #define CORRELATORHEADER_H
3 
5 
11 namespace carma {
12 namespace correlator {
13 namespace lib {
14 
19  public:
20 
24  explicit CorrelatorHeader();
25 
29  CorrelatorHeader( const CorrelatorHeader & rhs );
30 
35 
39  virtual ~CorrelatorHeader();
40 
44  void swap( CorrelatorHeader & rhs );
45 
49  void setMJD(double mjd);
50 
56  double getMJD() const;
57 
69  void setAssembledMJD(double mjd);
70 
74  double getAssembledMJD() const;
75 
79  void setTransmissionMJD(double mjd);
80 
84  double getTransmissionMJD() const;
85 
89  void setReceivedMJD(double mjd);
90 
94  double getReceivedMJD() const;
95 
99  void setSequenceNumber(long seqNumber);
100 
104  long getSequenceNumber() const;
105 
109  void mySerialize( char * byteArray, int * offset ) const;
110 
114  void deserializeVer0( const char * byteArray,
115  int * offset,
116  int byteArraySize );
117 
118  void deserializeVer1( const char * byteArray,
119  int * offset,
120  int byteArraySize );
121 
125  void deserializeSwapVer0( const char * byteArray,
126  int * offset,
127  int byteArraySize );
128 
129  void deserializeSwapVer1( const char * byteArray,
130  int * offset,
131  int byteArraySize );
132 
136  int getSizeInBytes() const;
137 
138  void setVersionNumber( int32_t ver );
139 
140  static int32_t getVersionNumber();
141 
142  std::string getSummary() const;
143 
144  private:
145  double mjd_; // Start time of packet (integral 1/2 sec)
146  double asmmjd_; // Time packet was assembled
147  double txmjd_; // Time packet was transmitted by CORBA
148  double rxmjd_; // Time packet was received by CORBA
149  long seq_; // Sequence number
150  static int32_t version_;
151  }; // End class CorrelatorHeader
152 
153 } // End namespace lib
154 } // End namespace correlator
155 } // End namespace carma
156 
157 
158 inline
160 mjd_( 0.0 ),
161 asmmjd_( 0.0 ),
162 txmjd_( 0.0 ),
163 rxmjd_( 0.0 ),
164 seq_( 0L )
165 {
166 }
167 
168 
169 inline
171  const CorrelatorHeader & rhs ) :
172 mjd_( rhs.mjd_ ),
173 asmmjd_( rhs.asmmjd_ ),
174 txmjd_( rhs.txmjd_ ),
175 rxmjd_( rhs.rxmjd_ ),
176 seq_( rhs.seq_ )
177 {
178 }
179 
180 
181 inline
183 {
184 }
185 
186 
187 inline void
189 {
190  ::std::swap( mjd_, rhs.mjd_ );
191  ::std::swap( asmmjd_, rhs.asmmjd_ );
192  ::std::swap( txmjd_, rhs.txmjd_ );
193  ::std::swap( rxmjd_, rhs.rxmjd_ );
194  ::std::swap( seq_, rhs.seq_ );
195 }
196 
197 
201 {
202  mjd_ = rhs.mjd_;
203  asmmjd_ = rhs.asmmjd_;
204  txmjd_ = rhs.txmjd_;
205  rxmjd_ = rhs.rxmjd_;
206  seq_ = rhs.seq_;
207 
208  return *this;
209 }
210 
211 
212 inline double
214 {
215  return mjd_;
216 }
217 
218 
219 inline double
221 {
222  return asmmjd_;
223 }
224 
225 
226 inline double
228 {
229  return txmjd_;
230 }
231 
232 
233 inline double
235 {
236  return rxmjd_;
237 }
238 
239 
240 inline long
242 {
243  return seq_;
244 }
245 
246 
247 inline void
249 {
250  mjd_ = mjd;
251 }
252 
253 
254 inline void
256 {
257  asmmjd_ = mjd;
258 }
259 
260 
261 inline void
263 {
264  txmjd_ = m;
265 }
266 
267 
268 inline void
270 {
271  rxmjd_ = mjd;
272 }
273 
274 
275 inline void
277 {
278  seq_ = seqNo;
279 }
280 
281 inline void
282 carma::correlator::lib::CorrelatorHeader::setVersionNumber( const int32_t ver )
283 {
284  version_ = ver;
285 }
286 
287 #endif
void setMJD(double mjd)
Set the start time of the packet (integral 1/2 second)
void setAssembledMJD(double mjd)
Set the time the packet was assembled.
Abstract Class used to allow object to serialize themselves into a byte array.
Definition: Serializable.h:32
void mySerialize(char *byteArray, int *offset) const
Used to serialize data.
double getMJD() const
Get the start time of the sample packet (integral 1/2 second) Note this is the beginning time of the ...
double getAssembledMJD() const
Get the time the packet was assembled.
void swap(CorrelatorHeader &rhs)
Swap this instance with another CorrelatorHeader instance.
void deserializeVer0(const char *byteArray, int *offset, int byteArraySize)
Used to reconstruct object.
CorrelatorHeader & operator=(const CorrelatorHeader &rhs)
Assignment.
void setTransmissionMJD(double mjd)
Set the time the packet was serialized for transmission.
Class containing header information for Correlator Data.
double getReceivedMJD() const
Get the time the packet was received and deserialized.
double getTransmissionMJD() const
Get the time the packet was serialized for transmission.
void deserializeSwapVer0(const char *byteArray, int *offset, int byteArraySize)
Used to reconstruct object.
long getSequenceNumber() const
Get the sequence number.
int getSizeInBytes() const
Return size in bytes.
void setReceivedMJD(double mjd)
Set the time the packet was received and deserialized.
void setSequenceNumber(long seqNumber)
Set the sequence number.