casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalPhaseTable.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 CalPhaseTable.h
32  */
33 
34 #ifndef CalPhaseTable_CLASS
35 #define CalPhaseTable_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/Angle.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 
76 
77 
78 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
129 #include <alma/ASDM/DuplicateKey.h>
131 #include <alma/ASDM/NoSuchRow.h>
132 #include <alma/ASDM/DuplicateKey.h>
133 
134 
135 #ifndef WITHOUT_ACS
136 #include <asdmIDLC.h>
137 #endif
138 
139 #include <alma/ASDM/Representable.h>
140 
141 #include <pthread.h>
142 
143 namespace asdm {
144 
145 //class asdm::ASDM;
146 //class asdm::CalPhaseRow;
147 
148 class ASDM;
149 class CalPhaseRow;
371 class CalPhaseTable : public Representable {
372  friend class ASDM;
373 
374 public:
375 
376 
382  static const std::vector<std::string>& getKeyName();
383 
384 
385  virtual ~CalPhaseTable();
386 
392  ASDM &getContainer() const;
393 
399  unsigned int size() const;
400 
408  std::string getName() const;
409 
417  static std::string name() ;
418 
423  std::string getVersion() const ;
424 
430  static const std::vector<std::string>& getAttributesNames();
431 
437  static const std::vector<std::string>& defaultAttributesNamesInBin();
438 
442  Entity getEntity() const;
443 
448  void setEntity(Entity e);
449 
457  std::string toXML() ;
458 
459 #ifndef WITHOUT_ACS
460  // Conversion Methods
466  asdmIDL::CalPhaseTableIDL *toIDL() ;
467 
475  void toIDL(asdmIDL::CalPhaseTableIDL& x) const;
476 
477 #endif
478 
479 #ifndef WITHOUT_ACS
480 
486  void fromIDL(asdmIDL::CalPhaseTableIDL x) ;
487 #endif
488 
489  //
490  // ====> Row creation.
491  //
492 
497  CalPhaseRow *newRow();
498 
499 
545  CalPhaseRow *newRow(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, std::vector<std::vector<float > > ampli, std::vector<std::vector<std::string > > antennaNames, std::vector<Length > baselineLengths, std::vector<std::vector<float > > decorrelationFactor, std::vector<Angle > direction, std::vector<Frequency > frequencyRange, Interval integrationTime, std::vector<std::vector<float > > phase, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<float > > phaseRMS, std::vector<std::vector<float > > statPhaseRMS);
546 
547 
548 
562 
563  //
564  // ====> Append a row to its table.
565  //
566 
567 
580  CalPhaseRow* add(CalPhaseRow* x) ;
581 
582 
583 
584 
585 
586  //
587  // ====> Methods returning rows.
588  //
589 
595  std::vector<CalPhaseRow *> get() ;
596 
603  const std::vector<CalPhaseRow *>& get() const ;
604 
605 
606 
607 
608 
626  CalPhaseRow* getRowByKey(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
627 
628 
629 
630 
631 
679  CalPhaseRow* lookup(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, std::vector<std::vector<float > > ampli, std::vector<std::vector<std::string > > antennaNames, std::vector<Length > baselineLengths, std::vector<std::vector<float > > decorrelationFactor, std::vector<Angle > direction, std::vector<Frequency > frequencyRange, Interval integrationTime, std::vector<std::vector<float > > phase, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<float > > phaseRMS, std::vector<std::vector<float > > statPhaseRMS);
680 
681 
682  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
683  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
684 
685 private:
686 
696 
698 
699  bool archiveAsBin; // If true archive binary else archive XML
700  bool fileAsBin ; // If true file binary else file XML
701 
702  std::string version ;
703 
705 
706 
707 
708 
709 
710 
718  CalPhaseRow* checkAndAdd(CalPhaseRow* x, bool skipCheckUniqueness=false) ;
719 
725  void append(CalPhaseRow* x) ;
726 
733 
734 
735 
736 
737 
738 // A data structure to store the pointers on the table's rows.
739 
740 // In all cases we maintain a private vector of CalPhaseRow s.
741  std::vector<CalPhaseRow * > privateRows;
742 
743 
744 
745  std::vector<CalPhaseRow *> row;
746 
747 
748  void error() ; //throw(ConversionException);
749 
750 
757  void fromXML(std::string& xmlDoc) ;
758 
759  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
760 
765  void setFromMIMEFile(const std::string& directory);
766  /*
767  void openMIMEFile(const std::string& directory);
768  */
769  void setFromXMLFile(const std::string& directory);
770 
778  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
779 
780 
787  void setFromMIME(const std::string & mimeMsg);
788 
792  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
793 
803  void toFile(std::string directory);
804 
810  if (!presentInMemory && !loadInProgress) {
811  loadInProgress = true;
812  setFromFile(getContainer().getDirectory());
813  presentInMemory = true;
814  loadInProgress = false;
815  }
816  }
825  void setFromFile(const std::string& directory);
826 
827 };
828 
829 } // End namespace asdm
830 
831 #endif /* CalPhaseTable_CLASS */
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalPhaseTable as those produced by the toFil...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
std::vector< CalPhaseRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
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
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
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 setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void addWithoutCheckingUnique(CalPhaseRow *x)
Brutally append an CalPhaseRow x to the collection of rows already stored in this table...
Entity getEntity() const
Return this table&#39;s Entity.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
asdmIDL::CalPhaseTableIDL * toIDL()
Conversion Methods.
A class to represent byte order information.
Definition: Misc.h:115
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1405
std::string toXML()
Produces an XML representation conform to the schema defined for CalPhase (CalPhaseTable.xsd).
The ASDM class is the container for all tables.
Definition: ASDM.h:273
CalPhaseTable(ASDM &container)
Create a CalPhaseTable.
std::string getName() const
Return the name of this table.
static std::string name()
Return the name of this table.
void fromIDL(asdmIDL::CalPhaseTableIDL x)
Populate this table from the content of a CalPhaseTableIDL Corba structure.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void setEntity(Entity e)
Set this table&#39;s Entity.
CalPhaseRow * add(CalPhaseRow *x)
====&gt; Append a row to its table.
The CalPhaseTable class is an Alma 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...
std::string getVersion() const
Return the version information about this table.
void setFromXMLFile(const std::string &directory)
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::vector< CalPhaseRow * > row
CalPhaseRow * newRow()
====&gt; Row creation.
CalPhaseRow * lookup(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, std::vector< std::vector< float > > ampli, std::vector< std::vector< std::string > > antennaNames, std::vector< Length > baselineLengths, std::vector< std::vector< float > > decorrelationFactor, std::vector< Angle > direction, std::vector< Frequency > frequencyRange, Interval integrationTime, std::vector< std::vector< float > > phase, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector< std::vector< float > > phaseRMS, std::vector< std::vector< float > > statPhaseRMS)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
CalPhaseRow * checkAndAdd(CalPhaseRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
The CalPhaseRow class is a row of a CalPhaseTable.
Definition: CalPhaseRow.h:168
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void append(CalPhaseRow *x)
Brutally append an CalPhaseRow x to the collection of rows already stored in this table...
virtual ~CalPhaseTable()
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
unsigned int size() const
Return the number of rows in the table.
const Double e
e and functions thereof:
CalPhaseRow * getRowByKey(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId)
Returns a CalPhaseRow* given a key.
bool loadInProgress
Load the table in memory if necessary.
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...
ASDM & getContainer() const
Return the container to which this table belongs.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors