casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalAmpliTable.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 CalAmpliTable.h
32  */
33 
34 #ifndef CalAmpliTable_CLASS
35 #define CalAmpliTable_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 
59 
60 
62 
63 
64 
66 
67 
68 
70 
71 
72 
73 
74 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
93 #include <alma/ASDM/DuplicateKey.h>
95 #include <alma/ASDM/NoSuchRow.h>
96 #include <alma/ASDM/DuplicateKey.h>
97 
98 
99 #ifndef WITHOUT_ACS
100 #include <asdmIDLC.h>
101 #endif
102 
103 #include <alma/ASDM/Representable.h>
104 
105 #include <pthread.h>
106 
107 namespace asdm {
108 
109 //class asdm::ASDM;
110 //class asdm::CalAmpliRow;
111 
112 class ASDM;
113 class CalAmpliRow;
251 class CalAmpliTable : public Representable {
252  friend class ASDM;
253 
254 public:
255 
256 
262  static const std::vector<std::string>& getKeyName();
263 
264 
265  virtual ~CalAmpliTable();
266 
272  ASDM &getContainer() const;
273 
279  unsigned int size() const;
280 
288  std::string getName() const;
289 
297  static std::string name() ;
298 
303  std::string getVersion() const ;
304 
310  static const std::vector<std::string>& getAttributesNames();
311 
317  static const std::vector<std::string>& defaultAttributesNamesInBin();
318 
322  Entity getEntity() const;
323 
328  void setEntity(Entity e);
329 
337  std::string toXML() ;
338 
339 #ifndef WITHOUT_ACS
340  // Conversion Methods
346  asdmIDL::CalAmpliTableIDL *toIDL() ;
347 
355  void toIDL(asdmIDL::CalAmpliTableIDL& x) const;
356 
357 #endif
358 
359 #ifndef WITHOUT_ACS
360 
366  void fromIDL(asdmIDL::CalAmpliTableIDL x) ;
367 #endif
368 
369  //
370  // ====> Row creation.
371  //
372 
377  CalAmpliRow *newRow();
378 
379 
411  CalAmpliRow *newRow(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, std::vector<float > apertureEfficiency, std::vector<float > apertureEfficiencyError);
412 
413 
414 
428 
429  //
430  // ====> Append a row to its table.
431  //
432 
433 
446  CalAmpliRow* add(CalAmpliRow* x) ;
447 
448 
449 
450 
451 
452  //
453  // ====> Methods returning rows.
454  //
455 
461  std::vector<CalAmpliRow *> get() ;
462 
469  const std::vector<CalAmpliRow *>& get() const ;
470 
471 
472 
473 
474 
494  CalAmpliRow* getRowByKey(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId);
495 
496 
497 
498 
499 
533  CalAmpliRow* lookup(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId, int numReceptor, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, ArrayTime startValidTime, ArrayTime endValidTime, std::vector<Frequency > frequencyRange, std::vector<float > apertureEfficiency, std::vector<float > apertureEfficiencyError);
534 
535 
536  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
537  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
538 
539 private:
540 
550 
552 
553  bool archiveAsBin; // If true archive binary else archive XML
554  bool fileAsBin ; // If true file binary else file XML
555 
556  std::string version ;
557 
559 
560 
561 
562 
563 
564 
572  CalAmpliRow* checkAndAdd(CalAmpliRow* x, bool skipCheckUniqueness=false) ;
573 
579  void append(CalAmpliRow* x) ;
580 
587 
588 
589 
590 
591 
592 // A data structure to store the pointers on the table's rows.
593 
594 // In all cases we maintain a private vector of CalAmpliRow s.
595  std::vector<CalAmpliRow * > privateRows;
596 
597 
598 
599  std::vector<CalAmpliRow *> row;
600 
601 
602  void error() ; //throw(ConversionException);
603 
604 
611  void fromXML(std::string& xmlDoc) ;
612 
613  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
614 
619  void setFromMIMEFile(const std::string& directory);
620  /*
621  void openMIMEFile(const std::string& directory);
622  */
623  void setFromXMLFile(const std::string& directory);
624 
632  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
633 
634 
641  void setFromMIME(const std::string & mimeMsg);
642 
646  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
647 
657  void toFile(std::string directory);
658 
664  if (!presentInMemory && !loadInProgress) {
665  loadInProgress = true;
666  setFromFile(getContainer().getDirectory());
667  presentInMemory = true;
668  loadInProgress = false;
669  }
670  }
679  void setFromFile(const std::string& directory);
680 
681 };
682 
683 } // End namespace asdm
684 
685 #endif /* CalAmpliTable_CLASS */
static std::string name()
Return the name of this table.
std::string getVersion() const
Return the version information about this table.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
CalAmpliRow * lookup(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId, int numReceptor, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, ArrayTime startValidTime, ArrayTime endValidTime, std::vector< Frequency > frequencyRange, std::vector< float > apertureEfficiency, std::vector< float > apertureEfficiencyError)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
The CalAmpliTable class is an Alma table.
ASDM & getContainer() const
Return the container to which this table belongs.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
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...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
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 setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
A class to represent byte order information.
Definition: Misc.h:115
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
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalAmpliTable as those produced by the toFil...
std::string getName() const
Return the name of this table.
CalAmpliRow * add(CalAmpliRow *x)
====&gt; Append a row to its table.
The CalAmpliRow class is a row of a CalAmpliTable.
Definition: CalAmpliRow.h:132
CalAmpliTable(ASDM &container)
Create a CalAmpliTable.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
CalAmpliRow * checkAndAdd(CalAmpliRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
virtual ~CalAmpliTable()
bool loadInProgress
Load the table in memory if necessary.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
CalAmpliRow * newRow()
====&gt; Row creation.
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 append(CalAmpliRow *x)
Brutally append an CalAmpliRow x to the collection of rows already stored in 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::vector< CalAmpliRow * > row
void setEntity(Entity e)
Set this table&#39;s Entity.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
CalAmpliRow * getRowByKey(std::string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId)
Returns a CalAmpliRow* given a key.
std::string toXML()
Produces an XML representation conform to the schema defined for CalAmpli (CalAmpliTable.xsd).
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
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 fromIDL(asdmIDL::CalAmpliTableIDL x)
Populate this table from the content of a CalAmpliTableIDL Corba structure.
const Double e
e and functions thereof:
std::vector< CalAmpliRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
asdmIDL::CalAmpliTableIDL * toIDL()
Conversion Methods.
unsigned int size() const
Return the number of rows in the table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void addWithoutCheckingUnique(CalAmpliRow *x)
Brutally append an CalAmpliRow x to the collection of rows already stored in this table...
void setFromXMLFile(const std::string &directory)
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...
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59