casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SBSummaryTable.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 SBSummaryTable.h
32  */
33 
34 #ifndef SBSummaryTable_CLASS
35 #define SBSummaryTable_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/Tag.h>
53 
54 
55 
56 #include <alma/ASDM/EntityRef.h>
57 
58 
59 
60 #include <alma/ASDM/Interval.h>
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
78 
79 
80 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
104 
105 
106 
107 
108 
109 
111 #include <alma/ASDM/DuplicateKey.h>
113 #include <alma/ASDM/NoSuchRow.h>
114 #include <alma/ASDM/DuplicateKey.h>
115 
116 
117 #ifndef WITHOUT_ACS
118 #include <asdmIDLC.h>
119 #endif
120 
121 #include <alma/ASDM/Representable.h>
122 
123 #include <pthread.h>
124 
125 namespace asdm {
126 
127 //class asdm::ASDM;
128 //class asdm::SBSummaryRow;
129 
130 class ASDM;
131 class SBSummaryRow;
288  friend class ASDM;
289 
290 public:
291 
292 
298  static const std::vector<std::string>& getKeyName();
299 
300 
301  virtual ~SBSummaryTable();
302 
308  ASDM &getContainer() const;
309 
315  unsigned int size() const;
316 
324  std::string getName() const;
325 
333  static std::string name() ;
334 
339  std::string getVersion() const ;
340 
346  static const std::vector<std::string>& getAttributesNames();
347 
353  static const std::vector<std::string>& defaultAttributesNamesInBin();
354 
358  Entity getEntity() const;
359 
364  void setEntity(Entity e);
365 
373  std::string toXML() ;
374 
375 #ifndef WITHOUT_ACS
376  // Conversion Methods
382  asdmIDL::SBSummaryTableIDL *toIDL() ;
383 
391  void toIDL(asdmIDL::SBSummaryTableIDL& x) const;
392 
393 #endif
394 
395 #ifndef WITHOUT_ACS
396 
402  void fromIDL(asdmIDL::SBSummaryTableIDL x) ;
403 #endif
404 
405  //
406  // ====> Row creation.
407  //
408 
413  SBSummaryRow *newRow();
414 
415 
449  SBSummaryRow *newRow(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetUID, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, int numObservingMode, std::vector<std::string > observingMode, int numberRepeats, int numScienceGoal, std::vector<std::string > scienceGoal, int numWeatherConstraint, std::vector<std::string > weatherConstraint);
450 
451 
452 
466 
467  //
468  // ====> Append a row to its table.
469  //
470 
471 
472 
473 
484 
485 
486 
487  //
488  // ====> Methods returning rows.
489  //
490 
496  std::vector<SBSummaryRow *> get() ;
497 
504  const std::vector<SBSummaryRow *>& get() const ;
505 
506 
507 
508 
509 
519  SBSummaryRow* getRowByKey(Tag sBSummaryId);
520 
521 
522 
523 
524 
560  SBSummaryRow* lookup(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetUID, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, int numObservingMode, std::vector<std::string > observingMode, int numberRepeats, int numScienceGoal, std::vector<std::string > scienceGoal, int numWeatherConstraint, std::vector<std::string > weatherConstraint);
561 
562 
563  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
564  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
565 
566 private:
567 
577 
579 
580  bool archiveAsBin; // If true archive binary else archive XML
581  bool fileAsBin ; // If true file binary else file XML
582 
583  std::string version ;
584 
586 
587 
588 
589 
590 
591  // A map for the autoincrementation algorithm
592  std::map<std::string,int> noAutoIncIds;
593  void autoIncrement(std::string key, SBSummaryRow* x);
594 
595 
605  SBSummaryRow* checkAndAdd(SBSummaryRow* x, bool skipCheckUniqueness=false) ;
606 
612  void append(SBSummaryRow* x) ;
613 
620 
621 
622 
623 
624 
625 // A data structure to store the pointers on the table's rows.
626 
627 // In all cases we maintain a private vector of SBSummaryRow s.
628  std::vector<SBSummaryRow * > privateRows;
629 
630 
631 
632  std::vector<SBSummaryRow *> row;
633 
634 
635  void error() ; //throw(ConversionException);
636 
637 
644  void fromXML(std::string& xmlDoc) ;
645 
646  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
647 
652  void setFromMIMEFile(const std::string& directory);
653  /*
654  void openMIMEFile(const std::string& directory);
655  */
656  void setFromXMLFile(const std::string& directory);
657 
665  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
666 
667 
674  void setFromMIME(const std::string & mimeMsg);
675 
679  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
680 
690  void toFile(std::string directory);
691 
697  if (!presentInMemory && !loadInProgress) {
698  loadInProgress = true;
699  setFromFile(getContainer().getDirectory());
700  presentInMemory = true;
701  loadInProgress = false;
702  }
703  }
712  void setFromFile(const std::string& directory);
713 
714 };
715 
716 } // End namespace asdm
717 
718 #endif /* SBSummaryTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
The Interval class implements an interval of time in units of nanoseconds.
Definition: Interval.h:58
asdmIDL::SBSummaryTableIDL * toIDL()
Conversion Methods.
SBSummaryRow * newRow()
====&gt; Row creation.
std::vector< SBSummaryRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
std::string getVersion() const
Return the version information about 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...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static std::string name()
Return the name of this table.
ASDM & getContainer() const
Return the container to which this table belongs.
void autoIncrement(std::string key, SBSummaryRow *x)
A class to represent byte order information.
Definition: Misc.h:115
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.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void append(SBSummaryRow *x)
Brutally append an SBSummaryRow x to the collection of rows already stored in this table...
SBSummaryTable(ASDM &container)
Create a SBSummaryTable.
SBSummaryRow * add(SBSummaryRow *x)
====&gt; Append a row to its table.
SBSummaryRow * checkAndAdd(SBSummaryRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
virtual ~SBSummaryTable()
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
unsigned int size() const
Return the number of rows in the 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 EntityRef class is an identification of a persistant entity in the ALMA archive.
Definition: EntityRef.h:58
void addWithoutCheckingUnique(SBSummaryRow *x)
Brutally append an SBSummaryRow x to the collection of rows already stored in this table...
std::string toXML()
Produces an XML representation conform to the schema defined for SBSummary (SBSummaryTable.xsd).
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
void setFromXMLFile(const std::string &directory)
void setEntity(Entity e)
Set this table&#39;s Entity.
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 getName() const
Return the name of this table.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void fromIDL(asdmIDL::SBSummaryTableIDL x)
Populate this table from the content of a SBSummaryTableIDL Corba structure.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
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:
The SBSummaryTable class is an Alma table.
bool loadInProgress
Load the table in memory if necessary.
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 SBSummaryRow class is a row of a SBSummaryTable.
Definition: SBSummaryRow.h:144
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
SBSummaryRow * lookup(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetUID, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, int numObservingMode, std::vector< std::string > observingMode, int numberRepeats, int numScienceGoal, std::vector< std::string > scienceGoal, int numWeatherConstraint, std::vector< std::string > weatherConstraint)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
std::vector< SBSummaryRow * > row
SBSummaryRow * getRowByKey(Tag sBSummaryId)
Returns a SBSummaryRow* given a key.
Entity getEntity() const
Return this table&#39;s Entity.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a SBSummaryTable as those produced by the toFi...