casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DelayModelTable.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 DelayModelTable.h
32  */
33 
34 #ifndef DelayModelTable_CLASS
35 #define DelayModelTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/ArrayTime.h>
49 
50 
51 
52 #include <alma/ASDM/Frequency.h>
53 
54 
55 
56 #include <alma/ASDM/Tag.h>
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
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 
100 
101 
102 
103 
104 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
123 #include <alma/ASDM/DuplicateKey.h>
125 #include <alma/ASDM/NoSuchRow.h>
126 #include <alma/ASDM/DuplicateKey.h>
127 
128 
129 #ifndef WITHOUT_ACS
130 #include <asdmIDLC.h>
131 #endif
132 
133 #include <alma/ASDM/Representable.h>
134 
135 #include <pthread.h>
136 
137 namespace asdm {
138 
139 //class asdm::ASDM;
140 //class asdm::DelayModelRow;
141 
142 class ASDM;
143 class DelayModelRow;
395  friend class ASDM;
396 
397 public:
398 
399 
405  static const std::vector<std::string>& getKeyName();
406 
407 
408  virtual ~DelayModelTable();
409 
415  ASDM &getContainer() const;
416 
422  unsigned int size() const;
423 
431  std::string getName() const;
432 
440  static std::string name() ;
441 
446  std::string getVersion() const ;
447 
453  static const std::vector<std::string>& getAttributesNames();
454 
460  static const std::vector<std::string>& defaultAttributesNamesInBin();
461 
465  Entity getEntity() const;
466 
471  void setEntity(Entity e);
472 
480  std::string toXML() ;
481 
482 #ifndef WITHOUT_ACS
483  // Conversion Methods
489  asdmIDL::DelayModelTableIDL *toIDL() ;
490 
498  void toIDL(asdmIDL::DelayModelTableIDL& x) const;
499 
500 #endif
501 
502 #ifndef WITHOUT_ACS
503 
509  void fromIDL(asdmIDL::DelayModelTableIDL x) ;
510 #endif
511 
512  //
513  // ====> Row creation.
514  //
515 
521 
522 
546  DelayModelRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, std::vector<double > phaseDelay, std::vector<double > phaseDelayRate, std::vector<double > groupDelay, std::vector<double > groupDelayRate, Tag fieldId);
547 
548 
549 
563 
564  //
565  // ====> Append a row to its table.
566  //
567 
568 
586 
587 
588 
589 
590 
591  //
592  // ====> Methods returning rows.
593  //
594 
600  std::vector<DelayModelRow *> get() ;
601 
608  const std::vector<DelayModelRow *>& get() const ;
609 
610 
621  std::vector <DelayModelRow*> *getByContext(Tag antennaId, Tag spectralWindowId);
622 
623 
624 
625 
626 
640  DelayModelRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
641 
642 
643 
644 
645 
671  DelayModelRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, std::vector<double > phaseDelay, std::vector<double > phaseDelayRate, std::vector<double > groupDelay, std::vector<double > groupDelayRate, Tag fieldId);
672 
673 
674  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
675  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
676 
677 private:
678 
688 
690 
691  bool archiveAsBin; // If true archive binary else archive XML
692  bool fileAsBin ; // If true file binary else file XML
693 
694  std::string version ;
695 
697 
698 
699 
700 
701 
702 
710  DelayModelRow* checkAndAdd(DelayModelRow* x, bool skipCheckUniqueness=false) ;
711 
717  void append(DelayModelRow* x) ;
718 
725 
726 
727 
728 
729 
730 
738  DelayModelRow * insertByStartTime(DelayModelRow* x, std::vector<DelayModelRow* >& row);
739 
740 
741 
742 // A data structure to store the pointers on the table's rows.
743 
744 // In all cases we maintain a private vector of DelayModelRow s.
745  std::vector<DelayModelRow * > privateRows;
746 
747 
748 
749 
750 
751 
752 
753 
754  typedef std::vector <DelayModelRow* > TIME_ROWS;
755  std::map<std::string, TIME_ROWS > context;
756 
761  std::string Key(Tag antennaId, Tag spectralWindowId) ;
762 
763 
764 
765 
771  void getByKeyNoAutoIncNoTime(std::vector <DelayModelRow*>& vin, std::vector <DelayModelRow*>& vout, Tag antennaId, Tag spectralWindowId);
772 
773 
774 
775  void error() ; //throw(ConversionException);
776 
777 
784  void fromXML(std::string& xmlDoc) ;
785 
786  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
787 
792  void setFromMIMEFile(const std::string& directory);
793  /*
794  void openMIMEFile(const std::string& directory);
795  */
796  void setFromXMLFile(const std::string& directory);
797 
805  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
806 
807 
814  void setFromMIME(const std::string & mimeMsg);
815 
819  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
820 
830  void toFile(std::string directory);
831 
837  if (!presentInMemory && !loadInProgress) {
838  loadInProgress = true;
839  setFromFile(getContainer().getDirectory());
840  presentInMemory = true;
841  loadInProgress = false;
842  }
843  }
852  void setFromFile(const std::string& directory);
853 
854 };
855 
856 } // End namespace asdm
857 
858 #endif /* DelayModelTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void append(DelayModelRow *x)
Brutally append an DelayModelRow x to the collection of rows already stored in this table...
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a DelayModelTable as those produced by the toF...
The DelayModelTable class is an Alma table.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
The DelayModelRow class is a row of a DelayModelTable.
std::string getVersion() const
Return the version information about this table.
DelayModelRow * lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, std::vector< double > phaseDelay, std::vector< double > phaseDelayRate, std::vector< double > groupDelay, std::vector< double > groupDelayRate, Tag fieldId)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
A class to represent byte order information.
Definition: Misc.h:115
void setFromXMLFile(const std::string &directory)
The ASDM class is the container for all tables.
Definition: ASDM.h:273
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...
unsigned int size() const
Return the number of rows in the table.
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 Key(Tag antennaId, Tag spectralWindowId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
DelayModelRow * checkAndAdd(DelayModelRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
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...
Entity getEntity() const
Return this table&#39;s Entity.
DelayModelRow * add(DelayModelRow *x)
====&gt; Append a row to its table.
std::map< std::string, TIME_ROWS > context
DelayModelRow * getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval)
Returns a DelayModelRow* given a key.
void setEntity(Entity e)
Set this table&#39;s Entity.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
void getByKeyNoAutoIncNoTime(std::vector< DelayModelRow * > &vin, std::vector< DelayModelRow * > &vout, Tag antennaId, Tag spectralWindowId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
std::vector< DelayModelRow * > * getByContext(Tag antennaId, Tag spectralWindowId)
Returns all the rows sorted by ascending startTime for a given context.
std::vector< DelayModelRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
DelayModelRow * insertByStartTime(DelayModelRow *x, std::vector< DelayModelRow * > &row)
Insert a DelayModelRow* in a vector of DelayModelRow* so that it&#39;s ordered by ascending time...
std::string toXML()
Produces an XML representation conform to the schema defined for DelayModel (DelayModelTable.xsd).
virtual ~DelayModelTable()
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
asdmIDL::DelayModelTableIDL * toIDL()
Conversion Methods.
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...
DelayModelTable(ASDM &container)
Create a DelayModelTable.
void addWithoutCheckingUnique(DelayModelRow *x)
Brutally append an DelayModelRow x to the collection of rows already stored in this table...
ASDM & getContainer() const
Return the container to which this table belongs.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
std::string getName() const
Return the name of 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 fromIDL(asdmIDL::DelayModelTableIDL x)
Populate this table from the content of a DelayModelTableIDL Corba structure.
DelayModelRow * newRow()
====&gt; Row creation.
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.
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...
std::vector< DelayModelRow * > TIME_ROWS
static std::string name()
Return the name of this table.
bool loadInProgress
Load the table in memory if necessary.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59