casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AntennaTable.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 AntennaTable.h
32  */
33 
34 #ifndef AntennaTable_CLASS
35 #define AntennaTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/Length.h>
45 
46 
47 
48 #include <alma/ASDM/ArrayTime.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
64 
65 
66 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
81 #include <alma/ASDM/DuplicateKey.h>
83 #include <alma/ASDM/NoSuchRow.h>
84 #include <alma/ASDM/DuplicateKey.h>
85 
86 
87 #ifndef WITHOUT_ACS
88 #include <asdmIDLC.h>
89 #endif
90 
92 
93 #include <pthread.h>
94 
95 namespace asdm {
96 
97 //class asdm::ASDM;
98 //class asdm::AntennaRow;
99 
100 class ASDM;
101 class AntennaRow;
201 class AntennaTable : public Representable {
202  friend class ASDM;
203 
204 public:
205 
206 
212  static const std::vector<std::string>& getKeyName();
213 
214 
215  virtual ~AntennaTable();
216 
222  ASDM &getContainer() const;
223 
229  unsigned int size() const;
230 
238  std::string getName() const;
239 
247  static std::string name() ;
248 
253  std::string getVersion() const ;
254 
260  static const std::vector<std::string>& getAttributesNames();
261 
267  static const std::vector<std::string>& defaultAttributesNamesInBin();
268 
272  Entity getEntity() const;
273 
278  void setEntity(Entity e);
279 
287  std::string toXML() ;
288 
289 #ifndef WITHOUT_ACS
290  // Conversion Methods
296  asdmIDL::AntennaTableIDL *toIDL() ;
297 
305  void toIDL(asdmIDL::AntennaTableIDL& x) const;
306 
307 #endif
308 
309 #ifndef WITHOUT_ACS
310 
316  void fromIDL(asdmIDL::AntennaTableIDL x) ;
317 #endif
318 
319  //
320  // ====> Row creation.
321  //
322 
327  AntennaRow *newRow();
328 
329 
351  AntennaRow *newRow(std::string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, std::vector<Length > position, std::vector<Length > offset, ArrayTime time, Tag stationId);
352 
353 
354 
368 
369  //
370  // ====> Append a row to its table.
371  //
372 
373 
374 
375 
385  AntennaRow* add(AntennaRow* x) ;
386 
387 
388 
389  //
390  // ====> Methods returning rows.
391  //
392 
398  std::vector<AntennaRow *> get() ;
399 
406  const std::vector<AntennaRow *>& get() const ;
407 
408 
409 
410 
411 
421  AntennaRow* getRowByKey(Tag antennaId);
422 
423 
424 
425 
426 
450  AntennaRow* lookup(std::string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, std::vector<Length > position, std::vector<Length > offset, ArrayTime time, Tag stationId);
451 
452 
453  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
454  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
455 
456 private:
457 
467 
469 
470  bool archiveAsBin; // If true archive binary else archive XML
471  bool fileAsBin ; // If true file binary else file XML
472 
473  std::string version ;
474 
476 
477 
478 
479 
480 
481  // A map for the autoincrementation algorithm
482  std::map<std::string,int> noAutoIncIds;
483  void autoIncrement(std::string key, AntennaRow* x);
484 
485 
495  AntennaRow* checkAndAdd(AntennaRow* x, bool skipCheckUniqueness=false) ;
496 
502  void append(AntennaRow* x) ;
503 
510 
511 
512 
513 
514 
515 // A data structure to store the pointers on the table's rows.
516 
517 // In all cases we maintain a private vector of AntennaRow s.
518  std::vector<AntennaRow * > privateRows;
519 
520 
521 
522  std::vector<AntennaRow *> row;
523 
524 
525  void error() ; //throw(ConversionException);
526 
527 
534  void fromXML(std::string& xmlDoc) ;
535 
536  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
537 
542  void setFromMIMEFile(const std::string& directory);
543  /*
544  void openMIMEFile(const std::string& directory);
545  */
546  void setFromXMLFile(const std::string& directory);
547 
555  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
556 
557 
564  void setFromMIME(const std::string & mimeMsg);
565 
569  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
570 
580  void toFile(std::string directory);
581 
587  if (!presentInMemory && !loadInProgress) {
588  loadInProgress = true;
589  setFromFile(getContainer().getDirectory());
590  presentInMemory = true;
591  loadInProgress = false;
592  }
593  }
602  void setFromFile(const std::string& directory);
603 
604 };
605 
606 } // End namespace asdm
607 
608 #endif /* AntennaTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void checkPresenceInMemory()
Definition: AntennaTable.h:586
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...
AntennaTable(ASDM &container)
Create a AntennaTable.
AntennaRow * add(AntennaRow *x)
====&gt; Append a row to its table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
unsigned int size() const
Return the number of rows in the table.
bool loadInProgress
Load the table in memory if necessary.
Definition: AntennaTable.h:585
A class to represent byte order information.
Definition: Misc.h:115
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a AntennaTable as those produced by the toFile...
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void fromIDL(asdmIDL::AntennaTableIDL x)
Populate this table from the content of a AntennaTableIDL Corba structure.
std::string version
Definition: AntennaTable.h:473
AntennaRow * checkAndAdd(AntennaRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
AntennaRow * newRow()
====&gt; Row creation.
ASDM & getContainer() const
Return the container to which this table belongs.
static std::string name()
Return the name of this table.
Entity getEntity() const
Return this table&#39;s Entity.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
std::vector< AntennaRow * > row
Definition: AntennaTable.h:522
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
std::string toXML()
Produces an XML representation conform to the schema defined for Antenna (AntennaTable.xsd).
AntennaRow * getRowByKey(Tag antennaId)
Returns a AntennaRow* 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.
void setEntity(Entity e)
Set this table&#39;s Entity.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
std::vector< AntennaRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: AntennaTable.h:518
void autoIncrement(std::string key, AntennaRow *x)
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
The AntennaRow class is a row of a AntennaTable.
Definition: AntennaRow.h:120
asdmIDL::AntennaTableIDL * 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...
void addWithoutCheckingUnique(AntennaRow *x)
Brutally append an AntennaRow x to the collection of rows already stored in this table.
The Length class implements a quantity of length in meters.
Definition: Length.h:53
The AntennaTable class is an Alma table.
Definition: AntennaTable.h:201
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
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.
std::string getName() const
Return the name of this table.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
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 Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
AntennaRow * lookup(std::string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, std::vector< Length > position, std::vector< Length > offset, ArrayTime time, Tag stationId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
Definition: AntennaTable.h:482
A pure virtual class whose derived classes are expected to be functors whose behaviours will be to re...
Definition: EndianStream.h:117
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: AntennaTable.h:536
The Representable interface is implemented by all tables and by the container.
Definition: Representable.h:53
void append(AntennaRow *x)
Brutally append an AntennaRow x to the collection of rows already stored in this table.
const Double e
e and functions thereof:
std::string getVersion() const
Return the version information about this table.
virtual ~AntennaTable()
void setFromXMLFile(const std::string &directory)
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).