casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WVMCalTable.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 WVMCalTable.h
32  */
33 
34 #ifndef WVMCalTable_CLASS
35 #define WVMCalTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/Temperature.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 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
83 #include <alma/ASDM/DuplicateKey.h>
85 #include <alma/ASDM/NoSuchRow.h>
86 #include <alma/ASDM/DuplicateKey.h>
87 
88 
89 #ifndef WITHOUT_ACS
90 #include <asdmIDLC.h>
91 #endif
92 
94 
95 #include <pthread.h>
96 
97 namespace asdm {
98 
99 //class asdm::ASDM;
100 //class asdm::WVMCalRow;
101 
102 class ASDM;
103 class WVMCalRow;
211 class WVMCalTable : public Representable {
212  friend class ASDM;
213 
214 public:
215 
216 
222  static const std::vector<std::string>& getKeyName();
223 
224 
225  virtual ~WVMCalTable();
226 
232  ASDM &getContainer() const;
233 
239  unsigned int size() const;
240 
248  std::string getName() const;
249 
257  static std::string name() ;
258 
263  std::string getVersion() const ;
264 
270  static const std::vector<std::string>& getAttributesNames();
271 
277  static const std::vector<std::string>& defaultAttributesNamesInBin();
278 
282  Entity getEntity() const;
283 
288  void setEntity(Entity e);
289 
297  std::string toXML() ;
298 
299 #ifndef WITHOUT_ACS
300  // Conversion Methods
306  asdmIDL::WVMCalTableIDL *toIDL() ;
307 
315  void toIDL(asdmIDL::WVMCalTableIDL& x) const;
316 
317 #endif
318 
319 #ifndef WITHOUT_ACS
320 
326  void fromIDL(asdmIDL::WVMCalTableIDL x) ;
327 #endif
328 
329  //
330  // ====> Row creation.
331  //
332 
337  WVMCalRow *newRow();
338 
339 
367  WVMCalRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, WVRMethodMod::WVRMethod wvrMethod, std::vector<Frequency > polyFreqLimits, int numInputAntenna, int numChan, int numPoly, std::vector<std::vector<std::vector<float > > > pathCoeff, std::vector<std::vector<Temperature > > refTemp, std::vector<Tag> inputAntennaId);
368 
369 
370 
383  WVMCalRow *newRow(WVMCalRow *row);
384 
385  //
386  // ====> Append a row to its table.
387  //
388 
389 
406  WVMCalRow* add(WVMCalRow* x) ;
407 
408 
409 
410 
411 
412  //
413  // ====> Methods returning rows.
414  //
415 
421  std::vector<WVMCalRow *> get() ;
422 
429  const std::vector<WVMCalRow *>& get() const ;
430 
431 
442  std::vector <WVMCalRow*> *getByContext(Tag antennaId, Tag spectralWindowId);
443 
444 
445 
446 
447 
461  WVMCalRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
462 
463 
464 
465 
466 
496  WVMCalRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, WVRMethodMod::WVRMethod wvrMethod, std::vector<Frequency > polyFreqLimits, int numInputAntenna, int numChan, int numPoly, std::vector<std::vector<std::vector<float > > > pathCoeff, std::vector<std::vector<Temperature > > refTemp, std::vector<Tag> inputAntennaId);
497 
498 
499  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
500  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
501 
502 private:
503 
513 
515 
516  bool archiveAsBin; // If true archive binary else archive XML
517  bool fileAsBin ; // If true file binary else file XML
518 
519  std::string version ;
520 
522 
523 
524 
525 
526 
527 
535  WVMCalRow* checkAndAdd(WVMCalRow* x, bool skipCheckUniqueness=false) ;
536 
542  void append(WVMCalRow* x) ;
543 
550 
551 
552 
553 
554 
555 
563  WVMCalRow * insertByStartTime(WVMCalRow* x, std::vector<WVMCalRow* >& row);
564 
565 
566 
567 // A data structure to store the pointers on the table's rows.
568 
569 // In all cases we maintain a private vector of WVMCalRow s.
570  std::vector<WVMCalRow * > privateRows;
571 
572 
573 
574 
575 
576 
577 
578 
579  typedef std::vector <WVMCalRow* > TIME_ROWS;
580  std::map<std::string, TIME_ROWS > context;
581 
586  std::string Key(Tag antennaId, Tag spectralWindowId) ;
587 
588 
589 
590 
596  void getByKeyNoAutoIncNoTime(std::vector <WVMCalRow*>& vin, std::vector <WVMCalRow*>& vout, Tag antennaId, Tag spectralWindowId);
597 
598 
599 
600  void error() ; //throw(ConversionException);
601 
602 
609  void fromXML(std::string& xmlDoc) ;
610 
611  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
612 
617  void setFromMIMEFile(const std::string& directory);
618  /*
619  void openMIMEFile(const std::string& directory);
620  */
621  void setFromXMLFile(const std::string& directory);
622 
630  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
631 
632 
639  void setFromMIME(const std::string & mimeMsg);
640 
644  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
645 
655  void toFile(std::string directory);
656 
662  if (!presentInMemory && !loadInProgress) {
663  loadInProgress = true;
664  setFromFile(getContainer().getDirectory());
665  presentInMemory = true;
666  loadInProgress = false;
667  }
668  }
677  void setFromFile(const std::string& directory);
678 
679 };
680 
681 } // End namespace asdm
682 
683 #endif /* WVMCalTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
Entity getEntity() const
Return this table&#39;s Entity.
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...
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...
std::vector< WVMCalRow * > * getByContext(Tag antennaId, Tag spectralWindowId)
Returns all the rows sorted by ascending startTime for a given context.
std::map< std::string, TIME_ROWS > context
Definition: WVMCalTable.h:580
std::string getName() const
Return the name of this table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
WVMCalTable(ASDM &container)
Create a WVMCalTable.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
A class to represent byte order information.
Definition: Misc.h:115
WVMCalRow * lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, WVRMethodMod::WVRMethod wvrMethod, std::vector< Frequency > polyFreqLimits, int numInputAntenna, int numChan, int numPoly, std::vector< std::vector< std::vector< float > > > pathCoeff, std::vector< std::vector< Temperature > > refTemp, std::vector< Tag > inputAntennaId)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
void fromIDL(asdmIDL::WVMCalTableIDL x)
Populate this table from the content of a WVMCalTableIDL Corba structure.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
static std::string name()
Return the name of this table.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::vector< WVMCalRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: WVMCalTable.h:570
std::string Key(Tag antennaId, Tag spectralWindowId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
void checkPresenceInMemory()
Definition: WVMCalTable.h:661
The WVMCalRow class is a row of a WVMCalTable.
Definition: WVMCalRow.h:125
ASDM & getContainer() const
Return the container to which this table belongs.
std::string version
Definition: WVMCalTable.h:519
std::string toXML()
Produces an XML representation conform to the schema defined for WVMCal (WVMCalTable.xsd).
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a WVMCalTable as those produced by the toFile ...
The WVMCalTable class is an Alma table.
Definition: WVMCalTable.h:211
WVMCalRow * add(WVMCalRow *x)
====&gt; Append a row to its table.
WVMCalRow * newRow()
====&gt; Row creation.
bool loadInProgress
Load the table in memory if necessary.
Definition: WVMCalTable.h:660
void setFromXMLFile(const std::string &directory)
WVMCalRow * getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval)
Returns a WVMCalRow* given a key.
void addWithoutCheckingUnique(WVMCalRow *x)
Brutally append an WVMCalRow x to the collection of rows already stored in 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...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
WVMCalRow * insertByStartTime(WVMCalRow *x, std::vector< WVMCalRow * > &row)
Insert a WVMCalRow* in a vector of WVMCalRow* so that it&#39;s ordered by ascending time.
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 getVersion() const
Return the version information about this table.
void getByKeyNoAutoIncNoTime(std::vector< WVMCalRow * > &vin, std::vector< WVMCalRow * > &vout, Tag antennaId, Tag spectralWindowId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
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
void append(WVMCalRow *x)
Brutally append an WVMCalRow x to the collection of rows already stored in this table.
const Double e
e and functions thereof:
WVMCalRow * checkAndAdd(WVMCalRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
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.
virtual ~WVMCalTable()
asdmIDL::WVMCalTableIDL * toIDL()
Conversion Methods.
std::vector< WVMCalRow * > TIME_ROWS
Definition: WVMCalTable.h:579
void setEntity(Entity e)
Set this table&#39;s Entity.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: WVMCalTable.h:611
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.
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
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.