casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalFocusModelTable.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 CalFocusModelTable.h
32  */
33 
34 #ifndef CalFocusModelTable_CLASS
35 #define CalFocusModelTable_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/Length.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 
57 
58 
59 
60 
62 
63 
64 
66 
67 
68 
69 
70 
71 
72 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
99 #include <alma/ASDM/DuplicateKey.h>
101 #include <alma/ASDM/NoSuchRow.h>
102 #include <alma/ASDM/DuplicateKey.h>
103 
104 
105 #ifndef WITHOUT_ACS
106 #include <asdmIDLC.h>
107 #endif
108 
109 #include <alma/ASDM/Representable.h>
110 
111 #include <pthread.h>
112 
113 namespace asdm {
114 
115 //class asdm::ASDM;
116 //class asdm::CalFocusModelRow;
117 
118 class ASDM;
119 class CalFocusModelRow;
281  friend class ASDM;
282 
283 public:
284 
285 
291  static const std::vector<std::string>& getKeyName();
292 
293 
294  virtual ~CalFocusModelTable();
295 
301  ASDM &getContainer() const;
302 
308  unsigned int size() const;
309 
317  std::string getName() const;
318 
326  static std::string name() ;
327 
332  std::string getVersion() const ;
333 
339  static const std::vector<std::string>& getAttributesNames();
340 
346  static const std::vector<std::string>& defaultAttributesNamesInBin();
347 
351  Entity getEntity() const;
352 
357  void setEntity(Entity e);
358 
366  std::string toXML() ;
367 
368 #ifndef WITHOUT_ACS
369  // Conversion Methods
375  asdmIDL::CalFocusModelTableIDL *toIDL() ;
376 
384  void toIDL(asdmIDL::CalFocusModelTableIDL& x) const;
385 
386 #endif
387 
388 #ifndef WITHOUT_ACS
389 
395  void fromIDL(asdmIDL::CalFocusModelTableIDL x) ;
396 #endif
397 
398  //
399  // ====> Row creation.
400  //
401 
407 
408 
450  CalFocusModelRow *newRow(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numCoeff, int numSourceObs, std::vector<std::string > coeffName, std::vector<std::string > coeffFormula, std::vector<float > coeffValue, std::vector<float > coeffError, std::vector<bool > coeffFixed, std::string focusModel, std::vector<Length > focusRMS, double reducedChiSquared);
451 
452 
453 
467 
468  //
469  // ====> Append a row to its table.
470  //
471 
472 
486 
487 
488 
489 
490 
491  //
492  // ====> Methods returning rows.
493  //
494 
500  std::vector<CalFocusModelRow *> get() ;
501 
508  const std::vector<CalFocusModelRow *>& get() const ;
509 
510 
511 
512 
513 
531  CalFocusModelRow* getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId);
532 
533 
534 
535 
536 
580  CalFocusModelRow* lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numCoeff, int numSourceObs, std::vector<std::string > coeffName, std::vector<std::string > coeffFormula, std::vector<float > coeffValue, std::vector<float > coeffError, std::vector<bool > coeffFixed, std::string focusModel, std::vector<Length > focusRMS, double reducedChiSquared);
581 
582 
583  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
584  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
585 
586 private:
587 
597 
599 
600  bool archiveAsBin; // If true archive binary else archive XML
601  bool fileAsBin ; // If true file binary else file XML
602 
603  std::string version ;
604 
606 
607 
608 
609 
610 
611 
619  CalFocusModelRow* checkAndAdd(CalFocusModelRow* x, bool skipCheckUniqueness=false) ;
620 
626  void append(CalFocusModelRow* x) ;
627 
634 
635 
636 
637 
638 
639 // A data structure to store the pointers on the table's rows.
640 
641 // In all cases we maintain a private vector of CalFocusModelRow s.
642  std::vector<CalFocusModelRow * > privateRows;
643 
644 
645 
646  std::vector<CalFocusModelRow *> row;
647 
648 
649  void error() ; //throw(ConversionException);
650 
651 
658  void fromXML(std::string& xmlDoc) ;
659 
660  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
661 
666  void setFromMIMEFile(const std::string& directory);
667  /*
668  void openMIMEFile(const std::string& directory);
669  */
670  void setFromXMLFile(const std::string& directory);
671 
679  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
680 
681 
688  void setFromMIME(const std::string & mimeMsg);
689 
693  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
694 
704  void toFile(std::string directory);
705 
711  if (!presentInMemory && !loadInProgress) {
712  loadInProgress = true;
713  setFromFile(getContainer().getDirectory());
714  presentInMemory = true;
715  loadInProgress = false;
716  }
717  }
726  void setFromFile(const std::string& directory);
727 
728 };
729 
730 } // End namespace asdm
731 
732 #endif /* CalFocusModelTable_CLASS */
CalFocusModelTable(ASDM &container)
Create a CalFocusModelTable.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
struct _xmlDoc xmlDoc
Definition: Misc.h:59
void addWithoutCheckingUnique(CalFocusModelRow *x)
Brutally append an CalFocusModelRow x to the collection of rows already stored in this table...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
A class to represent byte order information.
Definition: Misc.h:115
The CalFocusModelTable class is an Alma table.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
CalFocusModelRow * add(CalFocusModelRow *x)
====&gt; Append a row to its table.
void fromIDL(asdmIDL::CalFocusModelTableIDL x)
Populate this table from the content of a CalFocusModelTableIDL Corba structure.
ASDM & getContainer() const
Return the container to which this table belongs.
std::string toXML()
Produces an XML representation conform to the schema defined for CalFocusModel (CalFocusModelTable.xsd).
bool loadInProgress
Load the table in memory if necessary.
The CalFocusModelRow class is a row of a CalFocusModelTable.
std::vector< CalFocusModelRow * > row
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
asdmIDL::CalFocusModelTableIDL * toIDL()
Conversion Methods.
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...
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void setEntity(Entity e)
Set this table&#39;s Entity.
std::string getName() const
Return the name of this table.
void append(CalFocusModelRow *x)
Brutally append an CalFocusModelRow x to the collection of rows already stored in this table...
std::vector< CalFocusModelRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
unsigned int size() const
Return the number of rows in the table.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
CalFocusModelRow * checkAndAdd(CalFocusModelRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
static std::string name()
Return the name of 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...
std::string getVersion() const
Return the version information about this table.
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:
CalFocusModelRow * getRowByKey(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId)
Returns a CalFocusModelRow* given a key.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
CalFocusModelRow * newRow()
====&gt; Row creation.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CalFocusModelTable 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...
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
void setFromXMLFile(const std::string &directory)
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...
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
CalFocusModelRow * lookup(std::string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numCoeff, int numSourceObs, std::vector< std::string > coeffName, std::vector< std::string > coeffFormula, std::vector< float > coeffValue, std::vector< float > coeffError, std::vector< bool > coeffFixed, std::string focusModel, std::vector< Length > focusRMS, double reducedChiSquared)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
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.