casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExecBlockTable.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 ExecBlockTable.h
32  */
33 
34 #ifndef ExecBlockTable_CLASS
35 #define ExecBlockTable_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/Length.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 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
121 #include <alma/ASDM/DuplicateKey.h>
123 #include <alma/ASDM/NoSuchRow.h>
124 #include <alma/ASDM/DuplicateKey.h>
125 
126 
127 #ifndef WITHOUT_ACS
128 #include <asdmIDLC.h>
129 #endif
130 
131 #include <alma/ASDM/Representable.h>
132 
133 #include <pthread.h>
134 
135 namespace asdm {
136 
137 //class asdm::ASDM;
138 //class asdm::ExecBlockRow;
139 
140 class ASDM;
141 class ExecBlockRow;
375  friend class ASDM;
376 
377 public:
378 
379 
385  static const std::vector<std::string>& getKeyName();
386 
387 
388  virtual ~ExecBlockTable();
389 
395  ASDM &getContainer() const;
396 
402  unsigned int size() const;
403 
411  std::string getName() const;
412 
420  static std::string name() ;
421 
426  std::string getVersion() const ;
427 
433  static const std::vector<std::string>& getAttributesNames();
434 
440  static const std::vector<std::string>& defaultAttributesNamesInBin();
441 
445  Entity getEntity() const;
446 
451  void setEntity(Entity e);
452 
460  std::string toXML() ;
461 
462 #ifndef WITHOUT_ACS
463  // Conversion Methods
469  asdmIDL::ExecBlockTableIDL *toIDL() ;
470 
478  void toIDL(asdmIDL::ExecBlockTableIDL& x) const;
479 
480 #endif
481 
482 #ifndef WITHOUT_ACS
483 
489  void fromIDL(asdmIDL::ExecBlockTableIDL x) ;
490 #endif
491 
492  //
493  // ====> Row creation.
494  //
495 
500  ExecBlockRow *newRow();
501 
502 
548  ExecBlockRow *newRow(ArrayTime startTime, ArrayTime endTime, int execBlockNum, EntityRef execBlockUID, EntityRef projectUID, std::string configName, std::string telescopeName, std::string observerName, int numObservingLog, std::vector<std::string > observingLog, EntityRef sessionReference, Length baseRangeMin, Length baseRangeMax, Length baseRmsMinor, Length baseRmsMajor, Angle basePa, bool aborted, int numAntenna, std::vector<Tag> antennaId, Tag sBSummaryId);
549 
550 
551 
565 
566  //
567  // ====> Append a row to its table.
568  //
569 
570 
571 
572 
583 
584 
585 
586  //
587  // ====> Methods returning rows.
588  //
589 
595  std::vector<ExecBlockRow *> get() ;
596 
603  const std::vector<ExecBlockRow *>& get() const ;
604 
605 
606 
607 
608 
618  ExecBlockRow* getRowByKey(Tag execBlockId);
619 
620 
621 
622 
623 
671  ExecBlockRow* lookup(ArrayTime startTime, ArrayTime endTime, int execBlockNum, EntityRef execBlockUID, EntityRef projectUID, std::string configName, std::string telescopeName, std::string observerName, int numObservingLog, std::vector<std::string > observingLog, EntityRef sessionReference, Length baseRangeMin, Length baseRangeMax, Length baseRmsMinor, Length baseRmsMajor, Angle basePa, bool aborted, int numAntenna, std::vector<Tag> antennaId, Tag sBSummaryId);
672 
673 
674  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
675  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
676 
677 private:
678 
688 
690 
691  bool archiveAsBin; // If true archive binary else archive XML
692  bool fileAsBin ; // If true file binary else file XML
693 
694  std::string version ;
695 
697 
698 
699 
700 
701 
702  // A map for the autoincrementation algorithm
703  std::map<std::string,int> noAutoIncIds;
704  void autoIncrement(std::string key, ExecBlockRow* x);
705 
706 
716  ExecBlockRow* checkAndAdd(ExecBlockRow* x, bool skipCheckUniqueness=false) ;
717 
723  void append(ExecBlockRow* x) ;
724 
731 
732 
733 
734 
735 
736 // A data structure to store the pointers on the table's rows.
737 
738 // In all cases we maintain a private vector of ExecBlockRow s.
739  std::vector<ExecBlockRow * > privateRows;
740 
741 
742 
743  std::vector<ExecBlockRow *> row;
744 
745 
746  void error() ; //throw(ConversionException);
747 
748 
755  void fromXML(std::string& xmlDoc) ;
756 
757  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
758 
763  void setFromMIMEFile(const std::string& directory);
764  /*
765  void openMIMEFile(const std::string& directory);
766  */
767  void setFromXMLFile(const std::string& directory);
768 
776  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
777 
778 
785  void setFromMIME(const std::string & mimeMsg);
786 
790  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
791 
801  void toFile(std::string directory);
802 
808  if (!presentInMemory && !loadInProgress) {
809  loadInProgress = true;
810  setFromFile(getContainer().getDirectory());
811  presentInMemory = true;
812  loadInProgress = false;
813  }
814  }
823  void setFromFile(const std::string& directory);
824 
825 };
826 
827 } // End namespace asdm
828 
829 #endif /* ExecBlockTable_CLASS */
std::string getVersion() const
Return the version information about this table.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
void setEntity(Entity e)
Set this table&#39;s Entity.
void setFromXMLFile(const std::string &directory)
struct _xmlDoc xmlDoc
Definition: Misc.h:59
void autoIncrement(std::string key, ExecBlockRow *x)
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...
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 ASDM class is the container for all tables.
Definition: ASDM.h:273
std::vector< ExecBlockRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
The ExecBlockTable class is an Alma table.
The ExecBlockRow class is a row of a ExecBlockTable.
Definition: ExecBlockRow.h:163
ExecBlockTable(ASDM &container)
Create a ExecBlockTable.
The Angle class implements a quantity of angle in radians.
Definition: Angle.h:53
void fromIDL(asdmIDL::ExecBlockTableIDL x)
Populate this table from the content of a ExecBlockTableIDL Corba structure.
The EntityRef class is an identification of a persistant entity in the ALMA archive.
Definition: EntityRef.h:58
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
ExecBlockRow * add(ExecBlockRow *x)
====&gt; Append a row to its 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 toXML()
Produces an XML representation conform to the schema defined for ExecBlock (ExecBlockTable.xsd).
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.
ExecBlockRow * newRow()
====&gt; Row creation.
void addWithoutCheckingUnique(ExecBlockRow *x)
Brutally append an ExecBlockRow x to the collection of rows already stored in this table...
bool loadInProgress
Load the table in memory if necessary.
void append(ExecBlockRow *x)
Brutally append an ExecBlockRow x to the collection of rows already stored in this table...
virtual ~ExecBlockTable()
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< ExecBlockRow * > row
The Length class implements a quantity of length in meters.
Definition: Length.h:53
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
ExecBlockRow * checkAndAdd(ExecBlockRow *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
asdmIDL::ExecBlockTableIDL * toIDL()
Conversion Methods.
ExecBlockRow * lookup(ArrayTime startTime, ArrayTime endTime, int execBlockNum, EntityRef execBlockUID, EntityRef projectUID, std::string configName, std::string telescopeName, std::string observerName, int numObservingLog, std::vector< std::string > observingLog, EntityRef sessionReference, Length baseRangeMin, Length baseRangeMax, Length baseRmsMinor, Length baseRmsMajor, Angle basePa, bool aborted, int numAntenna, std::vector< Tag > antennaId, Tag sBSummaryId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
static std::string name()
Return the name of this table.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
A pure virtual class whose derived classes are expected to be functors whose behaviours will be to re...
Definition: EndianStream.h:117
unsigned int size() const
Return the number of rows in the table.
The Representable interface is implemented by all tables and by the container.
Definition: Representable.h:53
const Double e
e and functions thereof:
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a ExecBlockTable as those produced by the toFi...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
ASDM & getContainer() const
Return the container to which this table belongs.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
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...
std::string getName() const
Return the name of this table.
Entity getEntity() const
Return this table&#39;s Entity.
ExecBlockRow * getRowByKey(Tag execBlockId)
Returns a ExecBlockRow* given a key.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59