casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FreqOffsetTable.h
Go to the documentation of this file.
1 
2 /*
3  * ALMA - Atacama Large Millimeter Array
4  * (c) European Southern Observatory, 2002
5  * (c) Associated Universities Inc., 2002
6  * Copyright by ESO (in the framework of the ALMA collaboration),
7  * Copyright by AUI (in the framework of the ALMA collaboration),
8  * All rights reserved.
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY, without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  * MA 02111-1307 USA
24  *
25  * Warning!
26  * --------------------------------------------------------------------
27  * | This is generated code! Do not modify this file. |
28  * | If you do, all changes will be lost when the file is re-generated. |
29  * --------------------------------------------------------------------
30  *
31  * File FreqOffsetTable.h
32  */
33 
34 #ifndef FreqOffsetTable_CLASS
35 #define FreqOffsetTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/Frequency.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
65 #include <alma/ASDM/DuplicateKey.h>
67 #include <alma/ASDM/NoSuchRow.h>
68 #include <alma/ASDM/DuplicateKey.h>
69 
70 
71 #ifndef WITHOUT_ACS
72 #include <asdmIDLC.h>
73 #endif
74 
76 
77 #include <pthread.h>
78 
79 namespace asdm {
80 
81 //class asdm::ASDM;
82 //class asdm::FreqOffsetRow;
83 
84 class ASDM;
85 class FreqOffsetRow;
154  friend class ASDM;
155 
156 public:
157 
158 
164  static const std::vector<std::string>& getKeyName();
165 
166 
167  virtual ~FreqOffsetTable();
168 
174  ASDM &getContainer() const;
175 
181  unsigned int size() const;
182 
190  std::string getName() const;
191 
199  static std::string name() ;
200 
205  std::string getVersion() const ;
206 
212  static const std::vector<std::string>& getAttributesNames();
213 
219  static const std::vector<std::string>& defaultAttributesNamesInBin();
220 
224  Entity getEntity() const;
225 
230  void setEntity(Entity e);
231 
239  std::string toXML() ;
240 
241 #ifndef WITHOUT_ACS
242  // Conversion Methods
248  asdmIDL::FreqOffsetTableIDL *toIDL() ;
249 
257  void toIDL(asdmIDL::FreqOffsetTableIDL& x) const;
258 
259 #endif
260 
261 #ifndef WITHOUT_ACS
262 
268  void fromIDL(asdmIDL::FreqOffsetTableIDL x) ;
269 #endif
270 
271  //
272  // ====> Row creation.
273  //
274 
280 
281 
297  FreqOffsetRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset);
298 
299 
300 
314 
315  //
316  // ====> Append a row to its table.
317  //
318 
319 
337 
338 
339 
340 
341 
342  //
343  // ====> Methods returning rows.
344  //
345 
351  std::vector<FreqOffsetRow *> get() ;
352 
359  const std::vector<FreqOffsetRow *>& get() const ;
360 
361 
372  std::vector <FreqOffsetRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
373 
374 
375 
376 
377 
393  FreqOffsetRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
394 
395 
396 
397 
398 
416  FreqOffsetRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset);
417 
418 
419  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
420  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
421 
422 private:
423 
433 
435 
436  bool archiveAsBin; // If true archive binary else archive XML
437  bool fileAsBin ; // If true file binary else file XML
438 
439  std::string version ;
440 
442 
443 
444 
445 
446 
447 
455  FreqOffsetRow* checkAndAdd(FreqOffsetRow* x, bool skipCheckUniqueness=false) ;
456 
462  void append(FreqOffsetRow* x) ;
463 
470 
471 
472 
473 
474 
475 
483  FreqOffsetRow * insertByStartTime(FreqOffsetRow* x, std::vector<FreqOffsetRow* >& row);
484 
485 
486 
487 // A data structure to store the pointers on the table's rows.
488 
489 // In all cases we maintain a private vector of FreqOffsetRow s.
490  std::vector<FreqOffsetRow * > privateRows;
491 
492 
493 
494 
495 
496 
497 
498 
499  typedef std::vector <FreqOffsetRow* > TIME_ROWS;
500  std::map<std::string, TIME_ROWS > context;
501 
506  std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
507 
508 
509 
510 
516  void getByKeyNoAutoIncNoTime(std::vector <FreqOffsetRow*>& vin, std::vector <FreqOffsetRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId);
517 
518 
519 
520  void error() ; //throw(ConversionException);
521 
522 
529  void fromXML(std::string& xmlDoc) ;
530 
531  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
532 
537  void setFromMIMEFile(const std::string& directory);
538  /*
539  void openMIMEFile(const std::string& directory);
540  */
541  void setFromXMLFile(const std::string& directory);
542 
550  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
551 
552 
559  void setFromMIME(const std::string & mimeMsg);
560 
564  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
565 
575  void toFile(std::string directory);
576 
582  if (!presentInMemory && !loadInProgress) {
583  loadInProgress = true;
584  setFromFile(getContainer().getDirectory());
585  presentInMemory = true;
586  loadInProgress = false;
587  }
588  }
597  void setFromFile(const std::string& directory);
598 
599 };
600 
601 } // End namespace asdm
602 
603 #endif /* FreqOffsetTable_CLASS */
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
void fromXML(std::string &xmlDoc)
Populate this table from the content of a XML document that is required to be conform to the XML sche...
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
virtual ~FreqOffsetTable()
void setFromXMLFile(const std::string &directory)
std::string Key(Tag antennaId, Tag spectralWindowId, int feedId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
The FreqOffsetRow class is a row of a FreqOffsetTable.
The FreqOffsetTable class is an Alma table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
static std::string name()
Return the name of this table.
FreqOffsetTable(ASDM &container)
Create a FreqOffsetTable.
void setFromMIME(const std::string &mimeMsg)
Extracts the binary part of a MIME message and deserialize its content to fill this with the result o...
A class to represent byte order information.
Definition: Misc.h:115
asdmIDL::FreqOffsetTableIDL * toIDL()
Conversion Methods.
std::map< std::string, TIME_ROWS > context
FreqOffsetRow * insertByStartTime(FreqOffsetRow *x, std::vector< FreqOffsetRow * > &row)
Insert a FreqOffsetRow* in a vector of FreqOffsetRow* so that it&#39;s ordered by ascending time...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
std::vector< FreqOffsetRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
std::vector< FreqOffsetRow * > * getByContext(Tag antennaId, Tag spectralWindowId, int feedId)
Returns all the rows sorted by ascending startTime for a given context.
void setEntity(Entity e)
Set this table&#39;s Entity.
std::string getName() const
Return the name of this table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
ASDM & getContainer() const
Return the container to which this table belongs.
void fromIDL(asdmIDL::FreqOffsetTableIDL x)
Populate this table from the content of a FreqOffsetTableIDL Corba structure.
unsigned int size() const
Return the number of rows in the table.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
std::string toMIME(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void setFromMIMEFile(const std::string &directory)
Private methods involved during the build of this table out of the content of file(s) containing an e...
Entity getEntity() const
Return this table&#39;s Entity.
FreqOffsetRow * getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId)
Returns a FreqOffsetRow* given a key.
FreqOffsetRow * checkAndAdd(FreqOffsetRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
bool loadInProgress
Load the table in memory if necessary.
void append(FreqOffsetRow *x)
Brutally append an FreqOffsetRow x to the collection of rows already stored in this table...
A pure virtual class whose derived classes are expected to be functors whose behaviours will be to re...
Definition: EndianStream.h:117
The Representable interface is implemented by all tables and by the container.
Definition: Representable.h:53
std::vector< FreqOffsetRow * > TIME_ROWS
FreqOffsetRow * add(FreqOffsetRow *x)
====&gt; Append a row to its table.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a FreqOffsetTable as those produced by the toF...
const Double e
e and functions thereof:
void getByKeyNoAutoIncNoTime(std::vector< FreqOffsetRow * > &vin, std::vector< FreqOffsetRow * > &vout, Tag antennaId, Tag spectralWindowId, int feedId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
FreqOffsetRow * newRow()
====&gt; Row creation.
void addWithoutCheckingUnique(FreqOffsetRow *x)
Brutally append an FreqOffsetRow x to the collection of rows already stored in this table...
std::string getVersion() const
Return the version information about this table.
FreqOffsetRow * lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
The Frequency class implements a quantity of frequency in hertz.
Definition: Frequency.h:53
std::string toXML()
Produces an XML representation conform to the schema defined for FreqOffset (FreqOffsetTable.xsd).
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...