casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalGainTable.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 CalGainTable.h
32  */
33 
34 #ifndef CalGainTable_CLASS
35 #define CalGainTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/ArrayTime.h>
45 
46 
47 
48 #include <alma/ASDM/Tag.h>
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
75 #include <alma/ASDM/DuplicateKey.h>
77 #include <alma/ASDM/NoSuchRow.h>
78 #include <alma/ASDM/DuplicateKey.h>
79 
80 
81 #ifndef WITHOUT_ACS
82 #include <asdmIDLC.h>
83 #endif
84 
86 
87 #include <pthread.h>
88 
89 namespace asdm {
90 
91 //class asdm::ASDM;
92 //class asdm::CalGainRow;
93 
94 class ASDM;
95 class CalGainRow;
201 class CalGainTable : public Representable {
202  friend class ASDM;
203 
204 public:
205 
206 
212  static const std::vector<std::string>& getKeyName();
213 
214 
215  virtual ~CalGainTable();
216 
222  ASDM &getContainer() const;
223 
229  unsigned int size() const;
230 
238  std::string getName() const;
239 
247  static std::string name() ;
248 
253  std::string getVersion() const ;
254 
260  static const std::vector<std::string>& getAttributesNames();
261 
267  static const std::vector<std::string>& defaultAttributesNamesInBin();
268 
272  Entity getEntity() const;
273 
278  void setEntity(Entity e);
279 
287  std::string toXML() ;
288 
289 #ifndef WITHOUT_ACS
290  // Conversion Methods
296  asdmIDL::CalGainTableIDL *toIDL() ;
297 
305  void toIDL(asdmIDL::CalGainTableIDL& x) const;
306 
307 #endif
308 
309 #ifndef WITHOUT_ACS
310 
316  void fromIDL(asdmIDL::CalGainTableIDL x) ;
317 #endif
318 
319  //
320  // ====> Row creation.
321  //
322 
327  CalGainRow *newRow();
328 
329 
357  CalGainRow *newRow(Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, float gain, bool gainValid, float fit, float fitWeight, bool totalGainValid, float totalFit, float totalFitWeight);
358 
359 
360 
374 
375  //
376  // ====> Append a row to its table.
377  //
378 
379 
392  CalGainRow* add(CalGainRow* x) ;
393 
394 
395 
396 
397 
398  //
399  // ====> Methods returning rows.
400  //
401 
407  std::vector<CalGainRow *> get() ;
408 
415  const std::vector<CalGainRow *>& get() const ;
416 
417 
418 
419 
420 
432  CalGainRow* getRowByKey(Tag calDataId, Tag calReductionId);
433 
434 
435 
436 
437 
467  CalGainRow* lookup(Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, float gain, bool gainValid, float fit, float fitWeight, bool totalGainValid, float totalFit, float totalFitWeight);
468 
469 
470  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
471  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
472 
473 private:
474 
484 
486 
487  bool archiveAsBin; // If true archive binary else archive XML
488  bool fileAsBin ; // If true file binary else file XML
489 
490  std::string version ;
491 
493 
494 
495 
496 
497 
498 
506  CalGainRow* checkAndAdd(CalGainRow* x, bool skipCheckUniqueness=false) ;
507 
513  void append(CalGainRow* x) ;
514 
521 
522 
523 
524 
525 
526 // A data structure to store the pointers on the table's rows.
527 
528 // In all cases we maintain a private vector of CalGainRow s.
529  std::vector<CalGainRow * > privateRows;
530 
531 
532 
533  std::vector<CalGainRow *> row;
534 
535 
536  void error() ; //throw(ConversionException);
537 
538 
545  void fromXML(std::string& xmlDoc) ;
546 
547  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
548 
553  void setFromMIMEFile(const std::string& directory);
554  /*
555  void openMIMEFile(const std::string& directory);
556  */
557  void setFromXMLFile(const std::string& directory);
558 
566  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
567 
568 
575  void setFromMIME(const std::string & mimeMsg);
576 
580  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
581 
591  void toFile(std::string directory);
592 
598  if (!presentInMemory && !loadInProgress) {
599  loadInProgress = true;
600  setFromFile(getContainer().getDirectory());
601  presentInMemory = true;
602  loadInProgress = false;
603  }
604  }
613  void setFromFile(const std::string& directory);
614 
615 };
616 
617 } // End namespace asdm
618 
619 #endif /* CalGainTable_CLASS */
virtual ~CalGainTable()
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
CalGainTable(ASDM &container)
Create a CalGainTable.
asdmIDL::CalGainTableIDL * toIDL()
Conversion Methods.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
Entity getEntity() const
Return this table&#39;s Entity.
CalGainRow * lookup(Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, float gain, bool gainValid, float fit, float fitWeight, bool totalGainValid, float totalFit, float totalFitWeight)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
bool loadInProgress
Load the table in memory if necessary.
Definition: CalGainTable.h:596
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.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
struct _xmlDoc xmlDoc
Definition: Misc.h:59
std::string getVersion() const
Return the version information about this table.
CalGainRow * newRow()
====&gt; Row creation.
A class to represent byte order information.
Definition: Misc.h:115
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
std::string version
Definition: CalGainTable.h:490
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...
CalGainRow * getRowByKey(Tag calDataId, Tag calReductionId)
Returns a CalGainRow* given a key.
void setFromXMLFile(const std::string &directory)
The CalGainTable class is an Alma table.
Definition: CalGainTable.h:201
void fromIDL(asdmIDL::CalGainTableIDL x)
Populate this table from the content of a CalGainTableIDL Corba structure.
ASDM & getContainer() const
Return the container to which this table belongs.
CalGainRow * checkAndAdd(CalGainRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
std::vector< CalGainRow * > row
Definition: CalGainTable.h:533
void append(CalGainRow *x)
Brutally append an CalGainRow x to the collection of rows already stored in this table.
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...
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void setEntity(Entity e)
Set this table&#39;s Entity.
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...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
std::string toXML()
Produces an XML representation conform to the schema defined for CalGain (CalGainTable.xsd).
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalGainTable as those produced by the toFile...
std::vector< CalGainRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: CalGainTable.h:529
void checkPresenceInMemory()
Definition: CalGainTable.h:597
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::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: CalGainTable.h:547
const Double e
e and functions thereof:
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
The CalGainRow class is a row of a CalGainTable.
Definition: CalGainRow.h:114
static std::string name()
Return the name of this table.
CalGainRow * add(CalGainRow *x)
====&gt; Append a row to its table.
void addWithoutCheckingUnique(CalGainRow *x)
Brutally append an CalGainRow x to the collection of rows already stored in this table.
unsigned int size() const
Return the number of rows in the table.
std::string getName() const
Return the name of this table.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59