casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SquareLawDetectorTable.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 SquareLawDetectorTable.h
32  */
33 
34 #ifndef SquareLawDetectorTable_CLASS
35 #define SquareLawDetectorTable_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 
56 
57 
58 
59 
61 #include <alma/ASDM/DuplicateKey.h>
63 #include <alma/ASDM/NoSuchRow.h>
64 #include <alma/ASDM/DuplicateKey.h>
65 
66 
67 #ifndef WITHOUT_ACS
68 #include <asdmIDLC.h>
69 #endif
70 
72 
73 #include <pthread.h>
74 
75 namespace asdm {
76 
77 //class asdm::ASDM;
78 //class asdm::SquareLawDetectorRow;
79 
80 class ASDM;
81 class SquareLawDetectorRow;
130  friend class ASDM;
131 
132 public:
133 
134 
140  static const std::vector<std::string>& getKeyName();
141 
142 
143  virtual ~SquareLawDetectorTable();
144 
150  ASDM &getContainer() const;
151 
157  unsigned int size() const;
158 
166  std::string getName() const;
167 
175  static std::string name() ;
176 
181  std::string getVersion() const ;
182 
188  static const std::vector<std::string>& getAttributesNames();
189 
195  static const std::vector<std::string>& defaultAttributesNamesInBin();
196 
200  Entity getEntity() const;
201 
206  void setEntity(Entity e);
207 
215  std::string toXML() ;
216 
217 #ifndef WITHOUT_ACS
218  // Conversion Methods
224  asdmIDL::SquareLawDetectorTableIDL *toIDL() ;
225 
233  void toIDL(asdmIDL::SquareLawDetectorTableIDL& x) const;
234 
235 #endif
236 
237 #ifndef WITHOUT_ACS
238 
244  void fromIDL(asdmIDL::SquareLawDetectorTableIDL x) ;
245 #endif
246 
247  //
248  // ====> Row creation.
249  //
250 
256 
257 
267  SquareLawDetectorRow *newRow(int numBand, DetectorBandTypeMod::DetectorBandType bandType);
268 
269 
270 
284 
285  //
286  // ====> Append a row to its table.
287  //
288 
289 
290 
291 
302 
303 
304 
305  //
306  // ====> Methods returning rows.
307  //
308 
314  std::vector<SquareLawDetectorRow *> get() ;
315 
322  const std::vector<SquareLawDetectorRow *>& get() const ;
323 
324 
325 
326 
327 
337  SquareLawDetectorRow* getRowByKey(Tag squareLawDetectorId);
338 
339 
340 
341 
342 
354  SquareLawDetectorRow* lookup(int numBand, DetectorBandTypeMod::DetectorBandType bandType);
355 
356 
357  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
358  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
359 
360 private:
361 
371 
373 
374  bool archiveAsBin; // If true archive binary else archive XML
375  bool fileAsBin ; // If true file binary else file XML
376 
377  std::string version ;
378 
380 
381 
382 
383 
384 
385  // A map for the autoincrementation algorithm
386  std::map<std::string,int> noAutoIncIds;
387  void autoIncrement(std::string key, SquareLawDetectorRow* x);
388 
389 
399  SquareLawDetectorRow* checkAndAdd(SquareLawDetectorRow* x, bool skipCheckUniqueness=false) ;
400 
406  void append(SquareLawDetectorRow* x) ;
407 
414 
415 
416 
417 
418 
419 // A data structure to store the pointers on the table's rows.
420 
421 // In all cases we maintain a private vector of SquareLawDetectorRow s.
422  std::vector<SquareLawDetectorRow * > privateRows;
423 
424 
425 
426  std::vector<SquareLawDetectorRow *> row;
427 
428 
429  void error() ; //throw(ConversionException);
430 
431 
438  void fromXML(std::string& xmlDoc) ;
439 
440  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
441 
446  void setFromMIMEFile(const std::string& directory);
447  /*
448  void openMIMEFile(const std::string& directory);
449  */
450  void setFromXMLFile(const std::string& directory);
451 
459  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
460 
461 
468  void setFromMIME(const std::string & mimeMsg);
469 
473  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
474 
484  void toFile(std::string directory);
485 
491  if (!presentInMemory && !loadInProgress) {
492  loadInProgress = true;
493  setFromFile(getContainer().getDirectory());
494  presentInMemory = true;
495  loadInProgress = false;
496  }
497  }
506  void setFromFile(const std::string& directory);
507 
508 };
509 
510 } // End namespace asdm
511 
512 #endif /* SquareLawDetectorTable_CLASS */
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 toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void fromIDL(asdmIDL::SquareLawDetectorTableIDL x)
Populate this table from the content of a SquareLawDetectorTableIDL Corba structure.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
std::vector< SquareLawDetectorRow * > row
SquareLawDetectorRow * checkAndAdd(SquareLawDetectorRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
A class to represent byte order information.
Definition: Misc.h:115
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
unsigned int size() const
Return the number of rows in the table.
std::string toXML()
Produces an XML representation conform to the schema defined for SquareLawDetector (SquareLawDetector...
asdmIDL::SquareLawDetectorTableIDL * toIDL()
Conversion Methods.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
The ASDM class is the container for all tables.
Definition: ASDM.h:273
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::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
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...
void autoIncrement(std::string key, SquareLawDetectorRow *x)
SquareLawDetectorRow * lookup(int numBand, DetectorBandTypeMod::DetectorBandType bandType)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
void append(SquareLawDetectorRow *x)
Brutally append an SquareLawDetectorRow x to the collection of rows already stored in this table...
SquareLawDetectorRow * newRow()
====&gt; Row creation.
The SquareLawDetectorRow class is a row of a SquareLawDetectorTable.
ASDM & getContainer() const
Return the container to which this table belongs.
void setFromXMLFile(const std::string &directory)
static std::string name()
Return the name of this table.
std::vector< SquareLawDetectorRow * > 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.
Entity getEntity() const
Return this table&#39;s Entity.
The SquareLawDetectorTable class is an Alma table.
std::string getName() const
Return the name of this table.
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
void addWithoutCheckingUnique(SquareLawDetectorRow *x)
Brutally append an SquareLawDetectorRow x to the collection of rows already stored in this table...
SquareLawDetectorTable(ASDM &container)
Create a SquareLawDetectorTable.
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:
SquareLawDetectorRow * getRowByKey(Tag squareLawDetectorId)
Returns a SquareLawDetectorRow* given a key.
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.
bool loadInProgress
Load the table in memory if necessary.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a SquareLawDetectorTable as those produced by ...
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
SquareLawDetectorRow * add(SquareLawDetectorRow *x)
====&gt; Append a row to its 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).
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59