casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlmaRadiometerTable.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 AlmaRadiometerTable.h
32  */
33 
34 #ifndef AlmaRadiometerTable_CLASS
35 #define AlmaRadiometerTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/Tag.h>
45 
46 
47 
48 
49 
50 
51 
52 
53 
54 
55 
57 #include <alma/ASDM/DuplicateKey.h>
59 #include <alma/ASDM/NoSuchRow.h>
60 #include <alma/ASDM/DuplicateKey.h>
61 
62 
63 #ifndef WITHOUT_ACS
64 #include <asdmIDLC.h>
65 #endif
66 
68 
69 #include <pthread.h>
70 
71 namespace asdm {
72 
73 //class asdm::ASDM;
74 //class asdm::AlmaRadiometerRow;
75 
76 class ASDM;
77 class AlmaRadiometerRow;
126  friend class ASDM;
127 
128 public:
129 
130 
136  static const std::vector<std::string>& getKeyName();
137 
138 
139  virtual ~AlmaRadiometerTable();
140 
146  ASDM &getContainer() const;
147 
153  unsigned int size() const;
154 
162  std::string getName() const;
163 
171  static std::string name() ;
172 
177  std::string getVersion() const ;
178 
184  static const std::vector<std::string>& getAttributesNames();
185 
191  static const std::vector<std::string>& defaultAttributesNamesInBin();
192 
196  Entity getEntity() const;
197 
202  void setEntity(Entity e);
203 
211  std::string toXML() ;
212 
213 #ifndef WITHOUT_ACS
214  // Conversion Methods
220  asdmIDL::AlmaRadiometerTableIDL *toIDL() ;
221 
229  void toIDL(asdmIDL::AlmaRadiometerTableIDL& x) const;
230 
231 #endif
232 
233 #ifndef WITHOUT_ACS
234 
240  void fromIDL(asdmIDL::AlmaRadiometerTableIDL x) ;
241 #endif
242 
243  //
244  // ====> Row creation.
245  //
246 
252 
253 
254 
268 
269  //
270  // ====> Append a row to its table.
271  //
272 
273 
274 
275 
286 
287 
288 
289  //
290  // ====> Methods returning rows.
291  //
292 
298  std::vector<AlmaRadiometerRow *> get() ;
299 
306  const std::vector<AlmaRadiometerRow *>& get() const ;
307 
308 
309 
310 
311 
321  AlmaRadiometerRow* getRowByKey(Tag almaRadiometerId);
322 
323 
324 
325 
326 
327 
328  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
329  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
330 
331 private:
332 
342 
344 
345  bool archiveAsBin; // If true archive binary else archive XML
346  bool fileAsBin ; // If true file binary else file XML
347 
348  std::string version ;
349 
351 
352 
353 
354 
355 
356  // A map for the autoincrementation algorithm
357  std::map<std::string,int> noAutoIncIds;
358  void autoIncrement(std::string key, AlmaRadiometerRow* x);
359 
360 
370  AlmaRadiometerRow* checkAndAdd(AlmaRadiometerRow* x, bool skipCheckUniqueness=false) ;
371 
377  void append(AlmaRadiometerRow* x) ;
378 
385 
386 
387 
388 
389 
390 // A data structure to store the pointers on the table's rows.
391 
392 // In all cases we maintain a private vector of AlmaRadiometerRow s.
393  std::vector<AlmaRadiometerRow * > privateRows;
394 
395 
396 
397  std::vector<AlmaRadiometerRow *> row;
398 
399 
400  void error() ; //throw(ConversionException);
401 
402 
409  void fromXML(std::string& xmlDoc) ;
410 
411  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
412 
417  void setFromMIMEFile(const std::string& directory);
418  /*
419  void openMIMEFile(const std::string& directory);
420  */
421  void setFromXMLFile(const std::string& directory);
422 
430  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
431 
432 
439  void setFromMIME(const std::string & mimeMsg);
440 
444  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
445 
455  void toFile(std::string directory);
456 
462  if (!presentInMemory && !loadInProgress) {
463  loadInProgress = true;
464  setFromFile(getContainer().getDirectory());
465  presentInMemory = true;
466  loadInProgress = false;
467  }
468  }
477  void setFromFile(const std::string& directory);
478 
479 };
480 
481 } // End namespace asdm
482 
483 #endif /* AlmaRadiometerTable_CLASS */
void append(AlmaRadiometerRow *x)
Brutally append an AlmaRadiometerRow x to the collection of rows already stored in this table...
The AlmaRadiometerRow class is a row of a AlmaRadiometerTable.
void addWithoutCheckingUnique(AlmaRadiometerRow *x)
Brutally append an AlmaRadiometerRow x to the collection of rows already stored in this table...
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void fromIDL(asdmIDL::AlmaRadiometerTableIDL x)
Populate this table from the content of a AlmaRadiometerTableIDL Corba structure. ...
The AlmaRadiometerTable class is an Alma table.
AlmaRadiometerRow * add(AlmaRadiometerRow *x)
====&gt; Append a row to its table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
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...
A class to represent byte order information.
Definition: Misc.h:115
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...
AlmaRadiometerRow * checkAndAdd(AlmaRadiometerRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
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 setFromXMLFile(const std::string &directory)
std::string getName() const
Return the name of this table.
AlmaRadiometerRow * newRow()
====&gt; Row creation.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void autoIncrement(std::string key, AlmaRadiometerRow *x)
bool loadInProgress
Load the table in memory if necessary.
ASDM & getContainer() const
Return the container to which this table belongs.
std::vector< AlmaRadiometerRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
unsigned int size() const
Return the number of rows in the table.
void setEntity(Entity e)
Set this table&#39;s Entity.
std::vector< AlmaRadiometerRow * > row
Entity getEntity() const
Return this table&#39;s Entity.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
asdmIDL::AlmaRadiometerTableIDL * toIDL()
Conversion Methods.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a AlmaRadiometerTable as those produced by the...
std::string getVersion() const
Return the version information about this table.
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.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the 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:
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
AlmaRadiometerRow * getRowByKey(Tag almaRadiometerId)
Returns a AlmaRadiometerRow* given a key.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
std::string toXML()
Produces an XML representation conform to the schema defined for AlmaRadiometer (AlmaRadiometerTable...
AlmaRadiometerTable(ASDM &container)
Create a AlmaRadiometerTable.
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
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 Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59