casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalPrimaryBeamTable.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 CalPrimaryBeamTable.h
32  */
33 
34 #ifndef CalPrimaryBeamTable_CLASS
35 #define CalPrimaryBeamTable_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 #include <alma/ASDM/EntityRef.h>
61 
62 
63 
64 
65 
66 
67 
68 
70 
71 
72 
73 
74 
75 
76 
78 
79 
80 
81 
82 
83 
84 
85 
86 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
104 
105 
106 
107 
108 
109 
110 
111 
113 #include <alma/ASDM/DuplicateKey.h>
115 #include <alma/ASDM/NoSuchRow.h>
116 #include <alma/ASDM/DuplicateKey.h>
117 
118 
119 #ifndef WITHOUT_ACS
120 #include <asdmIDLC.h>
121 #endif
122 
123 #include <alma/ASDM/Representable.h>
124 
125 #include <pthread.h>
126 
127 namespace asdm {
128 
129 //class asdm::ASDM;
130 //class asdm::CalPrimaryBeamRow;
131 
132 class ASDM;
133 class CalPrimaryBeamRow;
307  friend class ASDM;
308 
309 public:
310 
311 
317  static const std::vector<std::string>& getKeyName();
318 
319 
320  virtual ~CalPrimaryBeamTable();
321 
327  ASDM &getContainer() const;
328 
334  unsigned int size() const;
335 
343  std::string getName() const;
344 
352  static std::string name() ;
353 
358  std::string getVersion() const ;
359 
365  static const std::vector<std::string>& getAttributesNames();
366 
372  static const std::vector<std::string>& defaultAttributesNamesInBin();
373 
377  Entity getEntity() const;
378 
383  void setEntity(Entity e);
384 
392  std::string toXML() ;
393 
394 #ifndef WITHOUT_ACS
395  // Conversion Methods
401  asdmIDL::CalPrimaryBeamTableIDL *toIDL() ;
402 
410  void toIDL(asdmIDL::CalPrimaryBeamTableIDL& x) const;
411 
412 #endif
413 
414 #ifndef WITHOUT_ACS
415 
421  void fromIDL(asdmIDL::CalPrimaryBeamTableIDL x) ;
422 #endif
423 
424  //
425  // ====> Row creation.
426  //
427 
433 
434 
480  CalPrimaryBeamRow *newRow(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numSubband, std::vector<std::vector<Frequency > > frequencyRange, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<double > mainBeamEfficiency, EntityRef beamDescriptionUID, float relativeAmplitudeRms, std::vector<Angle > direction, std::vector<Angle > minValidDirection, std::vector<Angle > maxValidDirection, PrimaryBeamDescriptionMod::PrimaryBeamDescription descriptionType, std::vector<int > imageChannelNumber, std::vector<Frequency > imageNominalFrequency);
481 
482 
483 
497 
498  //
499  // ====> Append a row to its table.
500  //
501 
502 
516 
517 
518 
519 
520 
521  //
522  // ====> Methods returning rows.
523  //
524 
530  std::vector<CalPrimaryBeamRow *> get() ;
531 
538  const std::vector<CalPrimaryBeamRow *>& get() const ;
539 
540 
541 
542 
543 
559  CalPrimaryBeamRow* getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
560 
561 
562 
563 
564 
612  CalPrimaryBeamRow* lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numSubband, std::vector<std::vector<Frequency > > frequencyRange, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<double > mainBeamEfficiency, EntityRef beamDescriptionUID, float relativeAmplitudeRms, std::vector<Angle > direction, std::vector<Angle > minValidDirection, std::vector<Angle > maxValidDirection, PrimaryBeamDescriptionMod::PrimaryBeamDescription descriptionType, std::vector<int > imageChannelNumber, std::vector<Frequency > imageNominalFrequency);
613 
614 
615  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
616  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
617 
618 private:
619 
629 
631 
632  bool archiveAsBin; // If true archive binary else archive XML
633  bool fileAsBin ; // If true file binary else file XML
634 
635  std::string version ;
636 
638 
639 
640 
641 
642 
643 
651  CalPrimaryBeamRow* checkAndAdd(CalPrimaryBeamRow* x, bool skipCheckUniqueness=false) ;
652 
658  void append(CalPrimaryBeamRow* x) ;
659 
666 
667 
668 
669 
670 
671 // A data structure to store the pointers on the table's rows.
672 
673 // In all cases we maintain a private vector of CalPrimaryBeamRow s.
674  std::vector<CalPrimaryBeamRow * > privateRows;
675 
676 
677 
678  std::vector<CalPrimaryBeamRow *> row;
679 
680 
681  void error() ; //throw(ConversionException);
682 
683 
690  void fromXML(std::string& xmlDoc) ;
691 
692  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
693 
698  void setFromMIMEFile(const std::string& directory);
699  /*
700  void openMIMEFile(const std::string& directory);
701  */
702  void setFromXMLFile(const std::string& directory);
703 
711  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
712 
713 
720  void setFromMIME(const std::string & mimeMsg);
721 
725  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
726 
736  void toFile(std::string directory);
737 
743  if (!presentInMemory && !loadInProgress) {
744  loadInProgress = true;
745  setFromFile(getContainer().getDirectory());
746  presentInMemory = true;
747  loadInProgress = false;
748  }
749  }
758  void setFromFile(const std::string& directory);
759 
760 };
761 
762 } // End namespace asdm
763 
764 #endif /* CalPrimaryBeamTable_CLASS */
The CalPrimaryBeamRow class is a row of a CalPrimaryBeamTable.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
CalPrimaryBeamTable(ASDM &container)
Create a CalPrimaryBeamTable.
CalPrimaryBeamRow * checkAndAdd(CalPrimaryBeamRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
void setEntity(Entity e)
Set this table&#39;s Entity.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
std::string getName() const
Return the name of this table.
The CalPrimaryBeamTable class is an Alma table.
void fromIDL(asdmIDL::CalPrimaryBeamTableIDL x)
Populate this table from the content of a CalPrimaryBeamTableIDL Corba structure. ...
std::string toXML()
Produces an XML representation conform to the schema defined for CalPrimaryBeam (CalPrimaryBeamTable...
std::vector< CalPrimaryBeamRow * > row
A class to represent byte order information.
Definition: Misc.h:115
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalPrimaryBeamTable as those produced by the...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
Entity getEntity() const
Return this table&#39;s Entity.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
unsigned int size() const
Return the number of rows in the 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...
std::vector< CalPrimaryBeamRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
CalPrimaryBeamRow * getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId)
Returns a CalPrimaryBeamRow* given a key.
The EntityRef class is an identification of a persistant entity in the ALMA archive.
Definition: EntityRef.h:58
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.
CalPrimaryBeamRow * add(CalPrimaryBeamRow *x)
====&gt; Append a row to its table.
static std::string name()
Return the name 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...
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.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
CalPrimaryBeamRow * lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numSubband, std::vector< std::vector< Frequency > > frequencyRange, int numReceptor, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector< double > mainBeamEfficiency, EntityRef beamDescriptionUID, float relativeAmplitudeRms, std::vector< Angle > direction, std::vector< Angle > minValidDirection, std::vector< Angle > maxValidDirection, PrimaryBeamDescriptionMod::PrimaryBeamDescription descriptionType, std::vector< int > imageChannelNumber, std::vector< Frequency > imageNominalFrequency)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
void setFromXMLFile(const std::string &directory)
CalPrimaryBeamRow * newRow()
====&gt; Row creation.
asdmIDL::CalPrimaryBeamTableIDL * toIDL()
Conversion Methods.
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:
bool loadInProgress
Load the table in memory if necessary.
void addWithoutCheckingUnique(CalPrimaryBeamRow *x)
Brutally append an CalPrimaryBeamRow 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.
void append(CalPrimaryBeamRow *x)
Brutally append an CalPrimaryBeamRow x to the collection of rows already stored in this table...
ASDM & getContainer() const
Return the container to which this table belongs.
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...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.