casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointingModelTable.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 PointingModelTable.h
32  */
33 
34 #ifndef PointingModelTable_CLASS
35 #define PointingModelTable_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 
56 
57 
58 
60 
61 
62 
64 
65 
66 
67 
68 
69 
70 
71 
73 #include <alma/ASDM/DuplicateKey.h>
75 #include <alma/ASDM/NoSuchRow.h>
76 #include <alma/ASDM/DuplicateKey.h>
77 
78 
79 #ifndef WITHOUT_ACS
80 #include <asdmIDLC.h>
81 #endif
82 
84 
85 #include <pthread.h>
86 
87 namespace asdm {
88 
89 //class asdm::ASDM;
90 //class asdm::PointingModelRow;
91 
92 class ASDM;
93 class PointingModelRow;
196  friend class ASDM;
197 
198 public:
199 
200 
206  static const std::vector<std::string>& getKeyName();
207 
208 
209  virtual ~PointingModelTable();
210 
216  ASDM &getContainer() const;
217 
223  unsigned int size() const;
224 
232  std::string getName() const;
233 
241  static std::string name() ;
242 
247  std::string getVersion() const ;
248 
254  static const std::vector<std::string>& getAttributesNames();
255 
261  static const std::vector<std::string>& defaultAttributesNamesInBin();
262 
266  Entity getEntity() const;
267 
272  void setEntity(Entity e);
273 
281  std::string toXML() ;
282 
283 #ifndef WITHOUT_ACS
284  // Conversion Methods
290  asdmIDL::PointingModelTableIDL *toIDL() ;
291 
299  void toIDL(asdmIDL::PointingModelTableIDL& x) const;
300 
301 #endif
302 
303 #ifndef WITHOUT_ACS
304 
310  void fromIDL(asdmIDL::PointingModelTableIDL x) ;
311 #endif
312 
313  //
314  // ====> Row creation.
315  //
316 
322 
323 
345  PointingModelRow *newRow(Tag antennaId, int numCoeff, std::vector<std::string > coeffName, std::vector<float > coeffVal, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, std::string assocNature, int assocPointingModelId);
346 
347 
348 
362 
363  //
364  // ====> Append a row to its table.
365  //
366 
367 
368 
369 
380 
381 
382 
383  //
384  // ====> Methods returning rows.
385  //
386 
392  std::vector<PointingModelRow *> get() ;
393 
400  const std::vector<PointingModelRow *>& get() const ;
401 
402 
403 
404 
405 
417  PointingModelRow* getRowByKey(Tag antennaId, int pointingModelId);
418 
419 
420 
428  std::vector <PointingModelRow *> getRowByPointingModelId(int);
429 
430 
431 
455  PointingModelRow* lookup(Tag antennaId, int numCoeff, std::vector<std::string > coeffName, std::vector<float > coeffVal, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, std::string assocNature, int assocPointingModelId);
456 
457 
458  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
459  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
460 
461 private:
462 
472 
474 
475  bool archiveAsBin; // If true archive binary else archive XML
476  bool fileAsBin ; // If true file binary else file XML
477 
478  std::string version ;
479 
481 
482 
483 
484 
485 
486  // A map for the autoincrementation algorithm
487  std::map<std::string,int> noAutoIncIds;
488  void autoIncrement(std::string key, PointingModelRow* x);
489 
490 
500  PointingModelRow* checkAndAdd(PointingModelRow* x, bool skipCheckUniqueness=false) ;
501 
507  void append(PointingModelRow* x) ;
508 
515 
516 
517 
518 
519 
520 // A data structure to store the pointers on the table's rows.
521 
522 // In all cases we maintain a private vector of PointingModelRow s.
523  std::vector<PointingModelRow * > privateRows;
524 
525 
526 
527  std::vector<PointingModelRow *> row;
528 
529 
530  void error() ; //throw(ConversionException);
531 
532 
539  void fromXML(std::string& xmlDoc) ;
540 
541  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
542 
547  void setFromMIMEFile(const std::string& directory);
548  /*
549  void openMIMEFile(const std::string& directory);
550  */
551  void setFromXMLFile(const std::string& directory);
552 
560  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
561 
562 
569  void setFromMIME(const std::string & mimeMsg);
570 
574  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
575 
585  void toFile(std::string directory);
586 
592  if (!presentInMemory && !loadInProgress) {
593  loadInProgress = true;
594  setFromFile(getContainer().getDirectory());
595  presentInMemory = true;
596  loadInProgress = false;
597  }
598  }
607  void setFromFile(const std::string& directory);
608 
609 };
610 
611 } // End namespace asdm
612 
613 #endif /* PointingModelTable_CLASS */
PointingModelRow * checkAndAdd(PointingModelRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
void append(PointingModelRow *x)
Brutally append an PointingModelRow x to the collection of rows already stored in this table...
std::string toXML()
Produces an XML representation conform to the schema defined for PointingModel (PointingModelTable.xsd).
ASDM & getContainer() const
Return the container to which this table belongs.
std::string getVersion() const
Return the version information about this table.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a PointingModelTable as those produced by the ...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
PointingModelRow * add(PointingModelRow *x)
====&gt; Append a row to its table.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
Entity getEntity() const
Return this table&#39;s Entity.
A class to represent byte order information.
Definition: Misc.h:115
PointingModelRow * getRowByKey(Tag antennaId, int pointingModelId)
Returns a PointingModelRow* given a key.
asdmIDL::PointingModelTableIDL * toIDL()
Conversion Methods.
The PointingModelTable class is an Alma table.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
PointingModelRow * lookup(Tag antennaId, int numCoeff, std::vector< std::string > coeffName, std::vector< float > coeffVal, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, std::string assocNature, int assocPointingModelId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
void setEntity(Entity e)
Set this table&#39;s Entity.
bool loadInProgress
Load the table in memory if necessary.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
static std::string name()
Return the name of this table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
std::vector< PointingModelRow * > row
std::vector< PointingModelRow * > getRowByPointingModelId(int)
Returns a vector of pointers on rows whose key element pointingModelId is equal to the parameter poin...
void addWithoutCheckingUnique(PointingModelRow *x)
Brutally append an PointingModelRow x to the collection of rows already stored in 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...
std::vector< PointingModelRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
void setFromXMLFile(const std::string &directory)
PointingModelRow * newRow()
====&gt; Row creation.
void autoIncrement(std::string key, PointingModelRow *x)
The PointingModelRow class is a row of a PointingModelTable.
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...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
std::string getName() const
Return the name of this table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
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:
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 fromIDL(asdmIDL::PointingModelTableIDL x)
Populate this table from the content of a PointingModelTableIDL Corba structure.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
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.
PointingModelTable(ASDM &container)
Create a PointingModelTable.
unsigned int size() const
Return the number of rows in the table.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59