casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalPositionTable.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 CalPositionTable.h
32  */
33 
34 #ifndef CalPositionTable_CLASS
35 #define CalPositionTable_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/Tag.h>
57 
58 
59 
60 
61 
62 
63 
64 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
80 
81 
82 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
109 #include <alma/ASDM/DuplicateKey.h>
111 #include <alma/ASDM/NoSuchRow.h>
112 #include <alma/ASDM/DuplicateKey.h>
113 
114 
115 #ifndef WITHOUT_ACS
116 #include <asdmIDLC.h>
117 #endif
118 
119 #include <alma/ASDM/Representable.h>
120 
121 #include <pthread.h>
122 
123 namespace asdm {
124 
125 //class asdm::ASDM;
126 //class asdm::CalPositionRow;
127 
128 class ASDM;
129 class CalPositionRow;
313  friend class ASDM;
314 
315 public:
316 
317 
323  static const std::vector<std::string>& getKeyName();
324 
325 
326  virtual ~CalPositionTable();
327 
333  ASDM &getContainer() const;
334 
340  unsigned int size() const;
341 
349  std::string getName() const;
350 
358  static std::string name() ;
359 
364  std::string getVersion() const ;
365 
371  static const std::vector<std::string>& getAttributesNames();
372 
378  static const std::vector<std::string>& defaultAttributesNamesInBin();
379 
383  Entity getEntity() const;
384 
389  void setEntity(Entity e);
390 
398  std::string toXML() ;
399 
400 #ifndef WITHOUT_ACS
401  // Conversion Methods
407  asdmIDL::CalPositionTableIDL *toIDL() ;
408 
416  void toIDL(asdmIDL::CalPositionTableIDL& x) const;
417 
418 #endif
419 
420 #ifndef WITHOUT_ACS
421 
427  void fromIDL(asdmIDL::CalPositionTableIDL x) ;
428 #endif
429 
430  //
431  // ====> Row creation.
432  //
433 
439 
440 
484  CalPositionRow *newRow(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Length > antennaPosition, std::string stationName, std::vector<Length > stationPosition, PositionMethodMod::PositionMethod positionMethod, ReceiverBandMod::ReceiverBand receiverBand, int numAntenna, std::vector<std::string > refAntennaNames, Length axesOffset, Length axesOffsetErr, bool axesOffsetFixed, std::vector<Length > positionOffset, std::vector<Length > positionErr, double reducedChiSquared);
485 
486 
487 
501 
502  //
503  // ====> Append a row to its table.
504  //
505 
506 
520 
521 
522 
523 
524 
525  //
526  // ====> Methods returning rows.
527  //
528 
534  std::vector<CalPositionRow *> get() ;
535 
542  const std::vector<CalPositionRow *>& get() const ;
543 
544 
545 
546 
547 
563  CalPositionRow* getRowByKey(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
564 
565 
566 
567 
568 
614  CalPositionRow* lookup(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Length > antennaPosition, std::string stationName, std::vector<Length > stationPosition, PositionMethodMod::PositionMethod positionMethod, ReceiverBandMod::ReceiverBand receiverBand, int numAntenna, std::vector<std::string > refAntennaNames, Length axesOffset, Length axesOffsetErr, bool axesOffsetFixed, std::vector<Length > positionOffset, std::vector<Length > positionErr, double reducedChiSquared);
615 
616 
617  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
618  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
619 
620 private:
621 
631 
633 
634  bool archiveAsBin; // If true archive binary else archive XML
635  bool fileAsBin ; // If true file binary else file XML
636 
637  std::string version ;
638 
640 
641 
642 
643 
644 
645 
653  CalPositionRow* checkAndAdd(CalPositionRow* x, bool skipCheckUniqueness=false) ;
654 
660  void append(CalPositionRow* x) ;
661 
668 
669 
670 
671 
672 
673 // A data structure to store the pointers on the table's rows.
674 
675 // In all cases we maintain a private vector of CalPositionRow s.
676  std::vector<CalPositionRow * > privateRows;
677 
678 
679 
680  std::vector<CalPositionRow *> row;
681 
682 
683  void error() ; //throw(ConversionException);
684 
685 
692  void fromXML(std::string& xmlDoc) ;
693 
694  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
695 
700  void setFromMIMEFile(const std::string& directory);
701  /*
702  void openMIMEFile(const std::string& directory);
703  */
704  void setFromXMLFile(const std::string& directory);
705 
713  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
714 
715 
722  void setFromMIME(const std::string & mimeMsg);
723 
727  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
728 
738  void toFile(std::string directory);
739 
745  if (!presentInMemory && !loadInProgress) {
746  loadInProgress = true;
747  setFromFile(getContainer().getDirectory());
748  presentInMemory = true;
749  loadInProgress = false;
750  }
751  }
760  void setFromFile(const std::string& directory);
761 
762 };
763 
764 } // End namespace asdm
765 
766 #endif /* CalPositionTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
bool loadInProgress
Load the table in memory if necessary.
void setFromXMLFile(const std::string &directory)
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
A class to represent byte order information.
Definition: Misc.h:115
CalPositionRow * getRowByKey(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId)
Returns a CalPositionRow* given a key.
CalPositionRow * add(CalPositionRow *x)
====&gt; Append a row to its table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
asdmIDL::CalPositionTableIDL * toIDL()
Conversion Methods.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
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 append(CalPositionRow *x)
Brutally append an CalPositionRow x to the collection of rows already stored in this 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::vector< CalPositionRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
void addWithoutCheckingUnique(CalPositionRow *x)
Brutally append an CalPositionRow x to the collection of rows already stored in this table...
std::vector< CalPositionRow * > row
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
The Length class implements a quantity of length in meters.
Definition: Length.h:53
std::string getName() const
Return the name of this table.
CalPositionRow * newRow()
====&gt; Row creation.
The CalPositionTable class is an Alma table.
CalPositionTable(ASDM &container)
Create a CalPositionTable.
unsigned int size() const
Return the number of rows in the 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
Entity getEntity() const
Return this table&#39;s Entity.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
void setEntity(Entity e)
Set this table&#39;s Entity.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalPositionTable as those produced by the to...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
ASDM & getContainer() const
Return the container to which this table belongs.
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:
CalPositionRow * lookup(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector< Length > antennaPosition, std::string stationName, std::vector< Length > stationPosition, PositionMethodMod::PositionMethod positionMethod, ReceiverBandMod::ReceiverBand receiverBand, int numAntenna, std::vector< std::string > refAntennaNames, Length axesOffset, Length axesOffsetErr, bool axesOffsetFixed, std::vector< Length > positionOffset, std::vector< Length > positionErr, double reducedChiSquared)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
std::string getVersion() const
Return the version information about this table.
CalPositionRow * checkAndAdd(CalPositionRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
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...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
The CalPositionRow class is a row of a CalPositionTable.
std::string toXML()
Produces an XML representation conform to the schema defined for CalPosition (CalPositionTable.xsd).
void fromIDL(asdmIDL::CalPositionTableIDL x)
Populate this table from the content of a CalPositionTableIDL Corba structure.
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 Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
static std::string name()
Return the name of this table.