casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalFocusTable.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 CalFocusTable.h
32  */
33 
34 #ifndef CalFocusTable_CLASS
35 #define CalFocusTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/Temperature.h>
45 
46 
47 
48 #include <alma/ASDM/ArrayTime.h>
49 
50 
51 
52 #include <alma/ASDM/Angle.h>
53 
54 
55 
56 #include <alma/ASDM/Length.h>
57 
58 
59 
60 #include <alma/ASDM/Frequency.h>
61 
62 
63 
64 #include <alma/ASDM/Tag.h>
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
78 
79 
80 
81 
82 
84 
85 
86 
88 
89 
90 
91 
92 
93 
94 
95 
96 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
149 #include <alma/ASDM/DuplicateKey.h>
151 #include <alma/ASDM/NoSuchRow.h>
152 #include <alma/ASDM/DuplicateKey.h>
153 
154 
155 #ifndef WITHOUT_ACS
156 #include <asdmIDLC.h>
157 #endif
158 
159 #include <alma/ASDM/Representable.h>
160 
161 #include <pthread.h>
162 
163 namespace asdm {
164 
165 //class asdm::ASDM;
166 //class asdm::CalFocusRow;
167 
168 class ASDM;
169 class CalFocusRow;
457 class CalFocusTable : public Representable {
458  friend class ASDM;
459 
460 public:
461 
462 
468  static const std::vector<std::string>& getKeyName();
469 
470 
471  virtual ~CalFocusTable();
472 
478  ASDM &getContainer() const;
479 
485  unsigned int size() const;
486 
494  std::string getName() const;
495 
503  static std::string name() ;
504 
509  std::string getVersion() const ;
510 
516  static const std::vector<std::string>& getAttributesNames();
517 
523  static const std::vector<std::string>& defaultAttributesNamesInBin();
524 
528  Entity getEntity() const;
529 
534  void setEntity(Entity e);
535 
543  std::string toXML() ;
544 
545 #ifndef WITHOUT_ACS
546  // Conversion Methods
552  asdmIDL::CalFocusTableIDL *toIDL() ;
553 
561  void toIDL(asdmIDL::CalFocusTableIDL& x) const;
562 
563 #endif
564 
565 #ifndef WITHOUT_ACS
566 
572  void fromIDL(asdmIDL::CalFocusTableIDL x) ;
573 #endif
574 
575  //
576  // ====> Row creation.
577  //
578 
583  CalFocusRow *newRow();
584 
585 
629  CalFocusRow *newRow(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, FocusMethodMod::FocusMethod focusMethod, std::vector<Frequency > frequencyRange, std::vector<Angle > pointingDirection, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<bool > wereFixed, std::vector<std::vector<Length > > offset, std::vector<std::vector<Length > > offsetError, std::vector<std::vector<bool > > offsetWasTied, std::vector<std::vector<double > > reducedChiSquared, std::vector<std::vector<Length > > position);
630 
631 
632 
646 
647  //
648  // ====> Append a row to its table.
649  //
650 
651 
664  CalFocusRow* add(CalFocusRow* x) ;
665 
666 
667 
668 
669 
670  //
671  // ====> Methods returning rows.
672  //
673 
679  std::vector<CalFocusRow *> get() ;
680 
687  const std::vector<CalFocusRow *>& get() const ;
688 
689 
690 
691 
692 
708  CalFocusRow* getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
709 
710 
711 
712 
713 
759  CalFocusRow* lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, FocusMethodMod::FocusMethod focusMethod, std::vector<Frequency > frequencyRange, std::vector<Angle > pointingDirection, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<bool > wereFixed, std::vector<std::vector<Length > > offset, std::vector<std::vector<Length > > offsetError, std::vector<std::vector<bool > > offsetWasTied, std::vector<std::vector<double > > reducedChiSquared, std::vector<std::vector<Length > > position);
760 
761 
762  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
763  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
764 
765 private:
766 
776 
778 
779  bool archiveAsBin; // If true archive binary else archive XML
780  bool fileAsBin ; // If true file binary else file XML
781 
782  std::string version ;
783 
785 
786 
787 
788 
789 
790 
798  CalFocusRow* checkAndAdd(CalFocusRow* x, bool skipCheckUniqueness=false) ;
799 
805  void append(CalFocusRow* x) ;
806 
813 
814 
815 
816 
817 
818 // A data structure to store the pointers on the table's rows.
819 
820 // In all cases we maintain a private vector of CalFocusRow s.
821  std::vector<CalFocusRow * > privateRows;
822 
823 
824 
825  std::vector<CalFocusRow *> row;
826 
827 
828  void error() ; //throw(ConversionException);
829 
830 
837  void fromXML(std::string& xmlDoc) ;
838 
839  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
840 
845  void setFromMIMEFile(const std::string& directory);
846  /*
847  void openMIMEFile(const std::string& directory);
848  */
849  void setFromXMLFile(const std::string& directory);
850 
858  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
859 
860 
867  void setFromMIME(const std::string & mimeMsg);
868 
872  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
873 
883  void toFile(std::string directory);
884 
890  if (!presentInMemory && !loadInProgress) {
891  loadInProgress = true;
892  setFromFile(getContainer().getDirectory());
893  presentInMemory = true;
894  loadInProgress = false;
895  }
896  }
905  void setFromFile(const std::string& directory);
906 
907 };
908 
909 } // End namespace asdm
910 
911 #endif /* CalFocusTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void addWithoutCheckingUnique(CalFocusRow *x)
Brutally append an CalFocusRow x to the collection of rows already stored in this table...
CalFocusRow * newRow()
====&gt; Row creation.
The CalFocusTable class is an Alma table.
void append(CalFocusRow *x)
Brutally append an CalFocusRow x to the collection of rows already stored in this table...
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...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
A class to represent byte order information.
Definition: Misc.h:115
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
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...
The ASDM class is the container for all tables.
Definition: ASDM.h:273
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.
ASDM & getContainer() const
Return the container to which this table belongs.
The CalFocusRow class is a row of a CalFocusTable.
Definition: CalFocusRow.h:188
CalFocusRow * checkAndAdd(CalFocusRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
virtual ~CalFocusTable()
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalFocusTable as those produced by the toFil...
The Temperature class implements a quantity of temperature in degrees Kelvin.
Definition: Temperature.h:53
Entity getEntity() const
Return this table&#39;s Entity.
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
std::vector< CalFocusRow * > row
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
unsigned int size() const
Return the number of rows in the table.
std::string toXML()
Produces an XML representation conform to the schema defined for CalFocus (CalFocusTable.xsd).
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
std::string getName() const
Return the name of 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 Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
CalFocusRow * lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, FocusMethodMod::FocusMethod focusMethod, std::vector< Frequency > frequencyRange, std::vector< Angle > pointingDirection, int numReceptor, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector< bool > wereFixed, std::vector< std::vector< Length > > offset, std::vector< std::vector< Length > > offsetError, std::vector< std::vector< bool > > offsetWasTied, std::vector< std::vector< double > > reducedChiSquared, std::vector< std::vector< Length > > position)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
bool loadInProgress
Load the table in memory if necessary.
void setEntity(Entity e)
Set this table&#39;s Entity.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
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
asdmIDL::CalFocusTableIDL * toIDL()
Conversion Methods.
const Double e
e and functions thereof:
CalFocusRow * getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId)
Returns a CalFocusRow* given a key.
static std::string name()
Return the name of this table.
std::vector< CalFocusRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
void setFromXMLFile(const std::string &directory)
std::string getVersion() const
Return the version information about this table.
void fromIDL(asdmIDL::CalFocusTableIDL x)
Populate this table from the content of a CalFocusTableIDL Corba structure.
CalFocusRow * add(CalFocusRow *x)
====&gt; Append a row to its table.
CalFocusTable(ASDM &container)
Create a CalFocusTable.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59