casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalWVRTable.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 CalWVRTable.h
32  */
33 
34 #ifndef CalWVRTable_CLASS
35 #define CalWVRTable_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/Length.h>
53 
54 
55 
56 #include <alma/ASDM/Frequency.h>
57 
58 
59 
60 #include <alma/ASDM/Tag.h>
61 
62 
63 
64 
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 
100 
101 
103 #include <alma/ASDM/DuplicateKey.h>
105 #include <alma/ASDM/NoSuchRow.h>
106 #include <alma/ASDM/DuplicateKey.h>
107 
108 
109 #ifndef WITHOUT_ACS
110 #include <asdmIDLC.h>
111 #endif
112 
113 #include <alma/ASDM/Representable.h>
114 
115 #include <pthread.h>
116 
117 namespace asdm {
118 
119 //class asdm::ASDM;
120 //class asdm::CalWVRRow;
121 
122 class ASDM;
123 class CalWVRRow;
280 class CalWVRTable : public Representable {
281  friend class ASDM;
282 
283 public:
284 
285 
291  static const std::vector<std::string>& getKeyName();
292 
293 
294  virtual ~CalWVRTable();
295 
301  ASDM &getContainer() const;
302 
308  unsigned int size() const;
309 
317  std::string getName() const;
318 
326  static std::string name() ;
327 
332  std::string getVersion() const ;
333 
339  static const std::vector<std::string>& getAttributesNames();
340 
346  static const std::vector<std::string>& defaultAttributesNamesInBin();
347 
351  Entity getEntity() const;
352 
357  void setEntity(Entity e);
358 
366  std::string toXML() ;
367 
368 #ifndef WITHOUT_ACS
369  // Conversion Methods
375  asdmIDL::CalWVRTableIDL *toIDL() ;
376 
384  void toIDL(asdmIDL::CalWVRTableIDL& x) const;
385 
386 #endif
387 
388 #ifndef WITHOUT_ACS
389 
395  void fromIDL(asdmIDL::CalWVRTableIDL x) ;
396 #endif
397 
398  //
399  // ====> Row creation.
400  //
401 
406  CalWVRRow *newRow();
407 
408 
450  CalWVRRow *newRow(std::string antennaName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, WVRMethodMod::WVRMethod wvrMethod, int numInputAntennas, std::vector<std::string > inputAntennaNames, int numChan, std::vector<Frequency > chanFreq, std::vector<Frequency > chanWidth, std::vector<std::vector<Temperature > > refTemp, int numPoly, std::vector<std::vector<std::vector<float > > > pathCoeff, std::vector<Frequency > polyFreqLimits, std::vector<float > wetPath, std::vector<float > dryPath, Length water);
451 
452 
453 
467 
468  //
469  // ====> Append a row to its table.
470  //
471 
472 
485  CalWVRRow* add(CalWVRRow* x) ;
486 
487 
488 
489 
490 
491  //
492  // ====> Methods returning rows.
493  //
494 
500  std::vector<CalWVRRow *> get() ;
501 
508  const std::vector<CalWVRRow *>& get() const ;
509 
510 
511 
512 
513 
527  CalWVRRow* getRowByKey(std::string antennaName, Tag calDataId, Tag calReductionId);
528 
529 
530 
531 
532 
576  CalWVRRow* lookup(std::string antennaName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, WVRMethodMod::WVRMethod wvrMethod, int numInputAntennas, std::vector<std::string > inputAntennaNames, int numChan, std::vector<Frequency > chanFreq, std::vector<Frequency > chanWidth, std::vector<std::vector<Temperature > > refTemp, int numPoly, std::vector<std::vector<std::vector<float > > > pathCoeff, std::vector<Frequency > polyFreqLimits, std::vector<float > wetPath, std::vector<float > dryPath, Length water);
577 
578 
579  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
580  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
581 
582 private:
583 
593 
595 
596  bool archiveAsBin; // If true archive binary else archive XML
597  bool fileAsBin ; // If true file binary else file XML
598 
599  std::string version ;
600 
602 
603 
604 
605 
606 
607 
615  CalWVRRow* checkAndAdd(CalWVRRow* x, bool skipCheckUniqueness=false) ;
616 
622  void append(CalWVRRow* x) ;
623 
630 
631 
632 
633 
634 
635 // A data structure to store the pointers on the table's rows.
636 
637 // In all cases we maintain a private vector of CalWVRRow s.
638  std::vector<CalWVRRow * > privateRows;
639 
640 
641 
642  std::vector<CalWVRRow *> row;
643 
644 
645  void error() ; //throw(ConversionException);
646 
647 
654  void fromXML(std::string& xmlDoc) ;
655 
656  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
657 
662  void setFromMIMEFile(const std::string& directory);
663  /*
664  void openMIMEFile(const std::string& directory);
665  */
666  void setFromXMLFile(const std::string& directory);
667 
675  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
676 
677 
684  void setFromMIME(const std::string & mimeMsg);
685 
689  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
690 
700  void toFile(std::string directory);
701 
707  if (!presentInMemory && !loadInProgress) {
708  loadInProgress = true;
709  setFromFile(getContainer().getDirectory());
710  presentInMemory = true;
711  loadInProgress = false;
712  }
713  }
722  void setFromFile(const std::string& directory);
723 
724 };
725 
726 } // End namespace asdm
727 
728 #endif /* CalWVRTable_CLASS */
void fromIDL(asdmIDL::CalWVRTableIDL x)
Populate this table from the content of a CalWVRTableIDL Corba structure.
void setFromXMLFile(const std::string &directory)
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
CalWVRTable(ASDM &container)
Create a CalWVRTable.
std::vector< CalWVRRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: CalWVRTable.h:638
CalWVRRow * lookup(std::string antennaName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, WVRMethodMod::WVRMethod wvrMethod, int numInputAntennas, std::vector< std::string > inputAntennaNames, int numChan, std::vector< Frequency > chanFreq, std::vector< Frequency > chanWidth, std::vector< std::vector< Temperature > > refTemp, int numPoly, std::vector< std::vector< std::vector< float > > > pathCoeff, std::vector< Frequency > polyFreqLimits, std::vector< float > wetPath, std::vector< float > dryPath, Length water)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the 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...
A class to represent byte order information.
Definition: Misc.h:115
unsigned int size() const
Return the number of rows in the table.
Entity getEntity() const
Return this table&#39;s Entity.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
std::string version
Definition: CalWVRTable.h:599
void addWithoutCheckingUnique(CalWVRRow *x)
Brutally append an CalWVRRow x to the collection of rows already stored in this table.
std::string getVersion() const
Return the version information about this table.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
ASDM & getContainer() const
Return the container to which this table belongs.
bool loadInProgress
Load the table in memory if necessary.
Definition: CalWVRTable.h:705
static std::string name()
Return the name of this table.
The CalWVRRow class is a row of a CalWVRTable.
Definition: CalWVRRow.h:142
CalWVRRow * checkAndAdd(CalWVRRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
The Length class implements a quantity of length in meters.
Definition: Length.h:53
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
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 ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void checkPresenceInMemory()
Definition: CalWVRTable.h:706
std::vector< CalWVRRow * > row
Definition: CalWVRTable.h:642
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...
virtual ~CalWVRTable()
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void append(CalWVRRow *x)
Brutally append an CalWVRRow x to the collection of rows already stored in this table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
CalWVRRow * newRow()
====&gt; Row creation.
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 toXML()
Produces an XML representation conform to the schema defined for CalWVR (CalWVRTable.xsd).
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:
std::string getName() const
Return the name of this table.
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...
asdmIDL::CalWVRTableIDL * toIDL()
Conversion Methods.
CalWVRRow * add(CalWVRRow *x)
====&gt; Append a row to its table.
The CalWVRTable class is an Alma table.
Definition: CalWVRTable.h:280
void setEntity(Entity e)
Set this table&#39;s Entity.
CalWVRRow * getRowByKey(std::string antennaName, Tag calDataId, Tag calReductionId)
Returns a CalWVRRow* given a key.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalWVRTable as those produced by the toFile ...
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: CalWVRTable.h:656