casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalSeeingTable.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 CalSeeingTable.h
32  */
33 
34 #ifndef CalSeeingTable_CLASS
35 #define CalSeeingTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/Angle.h>
45 
46 
47 
48 #include <alma/ASDM/ArrayTime.h>
49 
50 
51 
52 #include <alma/ASDM/Length.h>
53 
54 
55 
56 #include <alma/ASDM/Frequency.h>
57 
58 
59 
60 #include <alma/ASDM/Tag.h>
61 
62 
63 
64 #include <alma/ASDM/Interval.h>
65 
66 
67 
68 
69 
70 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
101 #include <alma/ASDM/DuplicateKey.h>
103 #include <alma/ASDM/NoSuchRow.h>
104 #include <alma/ASDM/DuplicateKey.h>
105 
106 
107 #ifndef WITHOUT_ACS
108 #include <asdmIDLC.h>
109 #endif
110 
111 #include <alma/ASDM/Representable.h>
112 
113 #include <pthread.h>
114 
115 namespace asdm {
116 
117 //class asdm::ASDM;
118 //class asdm::CalSeeingRow;
119 
120 class ASDM;
121 class CalSeeingRow;
261  friend class ASDM;
262 
263 public:
264 
265 
271  static const std::vector<std::string>& getKeyName();
272 
273 
274  virtual ~CalSeeingTable();
275 
281  ASDM &getContainer() const;
282 
288  unsigned int size() const;
289 
297  std::string getName() const;
298 
306  static std::string name() ;
307 
312  std::string getVersion() const ;
313 
319  static const std::vector<std::string>& getAttributesNames();
320 
326  static const std::vector<std::string>& defaultAttributesNamesInBin();
327 
331  Entity getEntity() const;
332 
337  void setEntity(Entity e);
338 
346  std::string toXML() ;
347 
348 #ifndef WITHOUT_ACS
349  // Conversion Methods
355  asdmIDL::CalSeeingTableIDL *toIDL() ;
356 
364  void toIDL(asdmIDL::CalSeeingTableIDL& x) const;
365 
366 #endif
367 
368 #ifndef WITHOUT_ACS
369 
375  void fromIDL(asdmIDL::CalSeeingTableIDL x) ;
376 #endif
377 
378  //
379  // ====> Row creation.
380  //
381 
386  CalSeeingRow *newRow();
387 
388 
418  CalSeeingRow *newRow(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, Interval integrationTime, int numBaseLengths, std::vector<Length > baselineLengths, std::vector<Angle > phaseRMS, Angle seeing, Angle seeingError);
419 
420 
421 
435 
436  //
437  // ====> Append a row to its table.
438  //
439 
440 
454 
455 
456 
457 
458 
459  //
460  // ====> Methods returning rows.
461  //
462 
468  std::vector<CalSeeingRow *> get() ;
469 
476  const std::vector<CalSeeingRow *>& get() const ;
477 
478 
479 
480 
481 
495  CalSeeingRow* getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
496 
497 
498 
499 
500 
532  CalSeeingRow* lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, Interval integrationTime, int numBaseLengths, std::vector<Length > baselineLengths, std::vector<Angle > phaseRMS, Angle seeing, Angle seeingError);
533 
534 
535  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
536  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
537 
538 private:
539 
549 
551 
552  bool archiveAsBin; // If true archive binary else archive XML
553  bool fileAsBin ; // If true file binary else file XML
554 
555  std::string version ;
556 
558 
559 
560 
561 
562 
563 
571  CalSeeingRow* checkAndAdd(CalSeeingRow* x, bool skipCheckUniqueness=false) ;
572 
578  void append(CalSeeingRow* x) ;
579 
586 
587 
588 
589 
590 
591 // A data structure to store the pointers on the table's rows.
592 
593 // In all cases we maintain a private vector of CalSeeingRow s.
594  std::vector<CalSeeingRow * > privateRows;
595 
596 
597 
598  std::vector<CalSeeingRow *> row;
599 
600 
601  void error() ; //throw(ConversionException);
602 
603 
610  void fromXML(std::string& xmlDoc) ;
611 
612  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
613 
618  void setFromMIMEFile(const std::string& directory);
619  /*
620  void openMIMEFile(const std::string& directory);
621  */
622  void setFromXMLFile(const std::string& directory);
623 
631  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
632 
633 
640  void setFromMIME(const std::string & mimeMsg);
641 
645  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
646 
656  void toFile(std::string directory);
657 
663  if (!presentInMemory && !loadInProgress) {
664  loadInProgress = true;
665  setFromFile(getContainer().getDirectory());
666  presentInMemory = true;
667  loadInProgress = false;
668  }
669  }
678  void setFromFile(const std::string& directory);
679 
680 };
681 
682 } // End namespace asdm
683 
684 #endif /* CalSeeingTable_CLASS */
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
unsigned int size() const
Return the number of rows in the table.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
The Interval class implements an interval of time in units of nanoseconds.
Definition: Interval.h:58
static std::string name()
Return the name of this table.
CalSeeingRow * lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector< Frequency > frequencyRange, Interval integrationTime, int numBaseLengths, std::vector< Length > baselineLengths, std::vector< Angle > phaseRMS, Angle seeing, Angle seeingError)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
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 getName() const
Return the name of this table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
A class to represent byte order information.
Definition: Misc.h:115
void fromIDL(asdmIDL::CalSeeingTableIDL x)
Populate this table from the content of a CalSeeingTableIDL Corba structure.
std::string toXML()
Produces an XML representation conform to the schema defined for CalSeeing (CalSeeingTable.xsd).
ASDM & getContainer() const
Return the container to which this table belongs.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
CalSeeingRow * checkAndAdd(CalSeeingRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
bool loadInProgress
Load the table in memory if necessary.
void append(CalSeeingRow *x)
Brutally append an CalSeeingRow x to the collection of rows already stored in this table...
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.
The Angle class implements a quantity of angle in radians.
Definition: Angle.h:53
std::vector< CalSeeingRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
CalSeeingTable(ASDM &container)
Create a CalSeeingTable.
std::vector< CalSeeingRow * > row
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
The CalSeeingRow class is a row of a CalSeeingTable.
Definition: CalSeeingRow.h:140
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
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...
CalSeeingRow * add(CalSeeingRow *x)
====&gt; Append a row to its table.
asdmIDL::CalSeeingTableIDL * toIDL()
Conversion Methods.
std::string getVersion() const
Return the version information about this table.
virtual ~CalSeeingTable()
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void addWithoutCheckingUnique(CalSeeingRow *x)
Brutally append an CalSeeingRow 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
const Double e
e and functions thereof:
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...
void setFromXMLFile(const std::string &directory)
CalSeeingRow * newRow()
====&gt; Row creation.
void setEntity(Entity e)
Set this table&#39;s Entity.
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...
CalSeeingRow * getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId)
Returns a CalSeeingRow* given a key.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
Entity getEntity() const
Return this table&#39;s Entity.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalSeeingTable as those produced by the toFi...
The CalSeeingTable class is an Alma table.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59