casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalCurveTable.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 CalCurveTable.h
32  */
33 
34 #ifndef CalCurveTable_CLASS
35 #define CalCurveTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/ArrayTime.h>
45 
46 
47 
48 #include <alma/ASDM/Frequency.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 
57 
58 
60 
61 
62 
64 
65 
66 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
101 #include <alma/ASDM/DuplicateKey.h>
103 #include <alma/ASDM/NoSuchRow.h>
104 #include <alma/ASDM/DuplicateKey.h>
105 
106 
107 #ifndef WITHOUT_ACS
108 #include <asdmIDLC.h>
109 #endif
110 
111 #include <alma/ASDM/Representable.h>
112 
113 #include <pthread.h>
114 
115 namespace asdm {
116 
117 //class asdm::ASDM;
118 //class asdm::CalCurveRow;
119 
120 class ASDM;
121 class CalCurveRow;
285 class CalCurveTable : public Representable {
286  friend class ASDM;
287 
288 public:
289 
290 
296  static const std::vector<std::string>& getKeyName();
297 
298 
299  virtual ~CalCurveTable();
300 
306  ASDM &getContainer() const;
307 
313  unsigned int size() const;
314 
322  std::string getName() const;
323 
331  static std::string name() ;
332 
337  std::string getVersion() const ;
338 
344  static const std::vector<std::string>& getAttributesNames();
345 
351  static const std::vector<std::string>& defaultAttributesNamesInBin();
352 
356  Entity getEntity() const;
357 
362  void setEntity(Entity e);
363 
371  std::string toXML() ;
372 
373 #ifndef WITHOUT_ACS
374  // Conversion Methods
380  asdmIDL::CalCurveTableIDL *toIDL() ;
381 
389  void toIDL(asdmIDL::CalCurveTableIDL& x) const;
390 
391 #endif
392 
393 #ifndef WITHOUT_ACS
394 
400  void fromIDL(asdmIDL::CalCurveTableIDL x) ;
401 #endif
402 
403  //
404  // ====> Row creation.
405  //
406 
411  CalCurveRow *newRow();
412 
413 
451  CalCurveRow *newRow(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, int numAntenna, int numPoly, int numReceptor, std::vector<std::string > antennaNames, std::string refAntennaName, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<std::vector<float > > > curve, std::vector<double > reducedChiSquared);
452 
453 
454 
468 
469  //
470  // ====> Append a row to its table.
471  //
472 
473 
486  CalCurveRow* add(CalCurveRow* x) ;
487 
488 
489 
490 
491 
492  //
493  // ====> Methods returning rows.
494  //
495 
501  std::vector<CalCurveRow *> get() ;
502 
509  const std::vector<CalCurveRow *>& get() const ;
510 
511 
512 
513 
514 
532  CalCurveRow* getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
533 
534 
535 
536 
537 
577  CalCurveRow* lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, int numAntenna, int numPoly, int numReceptor, std::vector<std::string > antennaNames, std::string refAntennaName, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<std::vector<float > > > curve, std::vector<double > reducedChiSquared);
578 
579 
580  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
581  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
582 
583 private:
584 
594 
596 
597  bool archiveAsBin; // If true archive binary else archive XML
598  bool fileAsBin ; // If true file binary else file XML
599 
600  std::string version ;
601 
603 
604 
605 
606 
607 
608 
616  CalCurveRow* checkAndAdd(CalCurveRow* x, bool skipCheckUniqueness=false) ;
617 
623  void append(CalCurveRow* x) ;
624 
631 
632 
633 
634 
635 
636 // A data structure to store the pointers on the table's rows.
637 
638 // In all cases we maintain a private vector of CalCurveRow s.
639  std::vector<CalCurveRow * > privateRows;
640 
641 
642 
643  std::vector<CalCurveRow *> row;
644 
645 
646  void error() ; //throw(ConversionException);
647 
648 
655  void fromXML(std::string& xmlDoc) ;
656 
657  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
658 
663  void setFromMIMEFile(const std::string& directory);
664  /*
665  void openMIMEFile(const std::string& directory);
666  */
667  void setFromXMLFile(const std::string& directory);
668 
676  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
677 
678 
685  void setFromMIME(const std::string & mimeMsg);
686 
690  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
691 
701  void toFile(std::string directory);
702 
708  if (!presentInMemory && !loadInProgress) {
709  loadInProgress = true;
710  setFromFile(getContainer().getDirectory());
711  presentInMemory = true;
712  loadInProgress = false;
713  }
714  }
723  void setFromFile(const std::string& directory);
724 
725 };
726 
727 } // End namespace asdm
728 
729 #endif /* CalCurveTable_CLASS */
CalCurveRow * checkAndAdd(CalCurveRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
virtual ~CalCurveTable()
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
bool loadInProgress
Load the table in memory if necessary.
asdmIDL::CalCurveTableIDL * toIDL()
Conversion Methods.
void setFromXMLFile(const std::string &directory)
struct _xmlDoc xmlDoc
Definition: Misc.h:59
std::string getName() const
Return the name of this table.
A class to represent byte order information.
Definition: Misc.h:115
void addWithoutCheckingUnique(CalCurveRow *x)
Brutally append an CalCurveRow x to the collection of rows already stored in this table...
ASDM & getContainer() const
Return the container to which this table belongs.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::vector< CalCurveRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
CalCurveTable(ASDM &container)
Create a CalCurveTable.
std::string toXML()
Produces an XML representation conform to the schema defined for CalCurve (CalCurveTable.xsd).
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
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.
Entity getEntity() const
Return this table&#39;s Entity.
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...
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void setEntity(Entity e)
Set this table&#39;s Entity.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
static std::string name()
Return the name of this table.
void append(CalCurveRow *x)
Brutally append an CalCurveRow x to the collection of rows already stored in this table...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
std::vector< CalCurveRow * > row
std::string getVersion() const
Return the version information about 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...
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 fromIDL(asdmIDL::CalCurveTableIDL x)
Populate this table from the content of a CalCurveTableIDL Corba structure.
CalCurveRow * newRow()
====&gt; Row creation.
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
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
const Double e
e and functions thereof:
unsigned int size() const
Return the number of rows in the table.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
CalCurveRow * lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, std::vector< Frequency > frequencyRange, int numAntenna, int numPoly, int numReceptor, std::vector< std::string > antennaNames, std::string refAntennaName, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector< std::vector< std::vector< float > > > curve, std::vector< double > reducedChiSquared)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
CalCurveRow * add(CalCurveRow *x)
====&gt; Append a row to its table.
The CalCurveTable class is an Alma table.
The CalCurveRow class is a row of a CalCurveTable.
Definition: CalCurveRow.h:140
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalCurveTable as those produced by the toFil...
CalCurveRow * getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId)
Returns a CalCurveRow* given a key.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59