casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalFluxTable.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 CalFluxTable.h
32  */
33 
34 #ifndef CalFluxTable_CLASS
35 #define CalFluxTable_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/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 
76 
77 
78 
79 
80 
81 
82 
84 
85 
86 
87 
88 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
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::CalFluxRow;
127 
128 class ASDM;
129 class CalFluxRow;
303 class CalFluxTable : public Representable {
304  friend class ASDM;
305 
306 public:
307 
308 
314  static const std::vector<std::string>& getKeyName();
315 
316 
317  virtual ~CalFluxTable();
318 
324  ASDM &getContainer() const;
325 
331  unsigned int size() const;
332 
340  std::string getName() const;
341 
349  static std::string name() ;
350 
355  std::string getVersion() const ;
356 
362  static const std::vector<std::string>& getAttributesNames();
363 
369  static const std::vector<std::string>& defaultAttributesNamesInBin();
370 
374  Entity getEntity() const;
375 
380  void setEntity(Entity e);
381 
389  std::string toXML() ;
390 
391 #ifndef WITHOUT_ACS
392  // Conversion Methods
398  asdmIDL::CalFluxTableIDL *toIDL() ;
399 
407  void toIDL(asdmIDL::CalFluxTableIDL& x) const;
408 
409 #endif
410 
411 #ifndef WITHOUT_ACS
412 
418  void fromIDL(asdmIDL::CalFluxTableIDL x) ;
419 #endif
420 
421  //
422  // ====> Row creation.
423  //
424 
429  CalFluxRow *newRow();
430 
431 
461  CalFluxRow *newRow(std::string sourceName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFrequencyRanges, int numStokes, std::vector<std::vector<Frequency > > frequencyRanges, FluxCalibrationMethodMod::FluxCalibrationMethod fluxMethod, std::vector<std::vector<double > > flux, std::vector<std::vector<double > > fluxError, std::vector<StokesParameterMod::StokesParameter > stokes);
462 
463 
464 
478 
479  //
480  // ====> Append a row to its table.
481  //
482 
483 
496  CalFluxRow* add(CalFluxRow* x) ;
497 
498 
499 
500 
501 
502  //
503  // ====> Methods returning rows.
504  //
505 
511  std::vector<CalFluxRow *> get() ;
512 
519  const std::vector<CalFluxRow *>& get() const ;
520 
521 
522 
523 
524 
538  CalFluxRow* getRowByKey(std::string sourceName, Tag calDataId, Tag calReductionId);
539 
540 
541 
542 
543 
575  CalFluxRow* lookup(std::string sourceName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFrequencyRanges, int numStokes, std::vector<std::vector<Frequency > > frequencyRanges, FluxCalibrationMethodMod::FluxCalibrationMethod fluxMethod, std::vector<std::vector<double > > flux, std::vector<std::vector<double > > fluxError, std::vector<StokesParameterMod::StokesParameter > stokes);
576 
577 
578  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
579  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
580 
581 private:
582 
592 
594 
595  bool archiveAsBin; // If true archive binary else archive XML
596  bool fileAsBin ; // If true file binary else file XML
597 
598  std::string version ;
599 
601 
602 
603 
604 
605 
606 
614  CalFluxRow* checkAndAdd(CalFluxRow* x, bool skipCheckUniqueness=false) ;
615 
621  void append(CalFluxRow* x) ;
622 
629 
630 
631 
632 
633 
634 // A data structure to store the pointers on the table's rows.
635 
636 // In all cases we maintain a private vector of CalFluxRow s.
637  std::vector<CalFluxRow * > privateRows;
638 
639 
640 
641  std::vector<CalFluxRow *> row;
642 
643 
644  void error() ; //throw(ConversionException);
645 
646 
653  void fromXML(std::string& xmlDoc) ;
654 
655  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
656 
661  void setFromMIMEFile(const std::string& directory);
662  /*
663  void openMIMEFile(const std::string& directory);
664  */
665  void setFromXMLFile(const std::string& directory);
666 
674  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
675 
676 
683  void setFromMIME(const std::string & mimeMsg);
684 
688  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
689 
699  void toFile(std::string directory);
700 
706  if (!presentInMemory && !loadInProgress) {
707  loadInProgress = true;
708  setFromFile(getContainer().getDirectory());
709  presentInMemory = true;
710  loadInProgress = false;
711  }
712  }
721  void setFromFile(const std::string& directory);
722 
723 };
724 
725 } // End namespace asdm
726 
727 #endif /* CalFluxTable_CLASS */
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
CalFluxRow * lookup(std::string sourceName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFrequencyRanges, int numStokes, std::vector< std::vector< Frequency > > frequencyRanges, FluxCalibrationMethodMod::FluxCalibrationMethod fluxMethod, std::vector< std::vector< double > > flux, std::vector< std::vector< double > > fluxError, std::vector< StokesParameterMod::StokesParameter > stokes)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalFluxTable as those produced by the toFile...
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
void fromIDL(asdmIDL::CalFluxTableIDL x)
Populate this table from the content of a CalFluxTableIDL Corba structure.
Entity getEntity() const
Return this table&#39;s Entity.
void append(CalFluxRow *x)
Brutally append an CalFluxRow x to the collection of rows already stored in this table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static std::string name()
Return the name of this table.
std::string getVersion() const
Return the version information about this table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: CalFluxTable.h:655
A class to represent byte order information.
Definition: Misc.h:115
std::vector< CalFluxRow * > row
Definition: CalFluxTable.h:641
void setFromXMLFile(const std::string &directory)
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::string version
Definition: CalFluxTable.h:598
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
CalFluxRow * add(CalFluxRow *x)
====&gt; Append a row to its table.
asdmIDL::CalFluxTableIDL * toIDL()
Conversion Methods.
void checkPresenceInMemory()
Definition: CalFluxTable.h:705
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
The CalFluxRow class is a row of a CalFluxTable.
Definition: CalFluxRow.h:148
void setEntity(Entity e)
Set this table&#39;s Entity.
ASDM & getContainer() const
Return the container to which this table belongs.
std::vector< CalFluxRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: CalFluxTable.h:637
CalFluxTable(ASDM &container)
Create a CalFluxTable.
std::string toXML()
Produces an XML representation conform to the schema defined for CalFlux (CalFluxTable.xsd).
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
std::string getName() const
Return the name of this 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).
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
The CalFluxTable class is an Alma table.
Definition: CalFluxTable.h:303
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this 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 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:
unsigned int size() const
Return the number of rows in the table.
void addWithoutCheckingUnique(CalFluxRow *x)
Brutally append an CalFluxRow x to the collection of rows already stored in this table.
CalFluxRow * newRow()
====&gt; Row creation.
virtual ~CalFluxTable()
CalFluxRow * checkAndAdd(CalFluxRow *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...
bool loadInProgress
Load the table in memory if necessary.
Definition: CalFluxTable.h:704
CalFluxRow * getRowByKey(std::string sourceName, Tag calDataId, Tag calReductionId)
Returns a CalFluxRow* given a key.
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 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 Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59