casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FocusModelTable.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 FocusModelTable.h
32  */
33 
34 #ifndef FocusModelTable_CLASS
35 #define FocusModelTable_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 
54 
55 
56 
58 
59 
60 
61 
62 
63 
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::FocusModelRow;
91 
92 class ASDM;
93 class FocusModelRow;
193  friend class ASDM;
194 
195 public:
196 
197 
203  static const std::vector<std::string>& getKeyName();
204 
205 
206  virtual ~FocusModelTable();
207 
213  ASDM &getContainer() const;
214 
220  unsigned int size() const;
221 
229  std::string getName() const;
230 
238  static std::string name() ;
239 
244  std::string getVersion() const ;
245 
251  static const std::vector<std::string>& getAttributesNames();
252 
258  static const std::vector<std::string>& defaultAttributesNamesInBin();
259 
263  Entity getEntity() const;
264 
269  void setEntity(Entity e);
270 
278  std::string toXML() ;
279 
280 #ifndef WITHOUT_ACS
281  // Conversion Methods
287  asdmIDL::FocusModelTableIDL *toIDL() ;
288 
296  void toIDL(asdmIDL::FocusModelTableIDL& x) const;
297 
298 #endif
299 
300 #ifndef WITHOUT_ACS
301 
307  void fromIDL(asdmIDL::FocusModelTableIDL x) ;
308 #endif
309 
310  //
311  // ====> Row creation.
312  //
313 
319 
320 
344  FocusModelRow *newRow(Tag antennaId, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, int numCoeff, std::vector<std::string > coeffName, std::vector<std::string > coeffFormula, std::vector<float > coeffVal, std::string assocNature, int assocFocusModelId);
345 
346 
347 
361 
362  //
363  // ====> Append a row to its table.
364  //
365 
366 
367 
368 
379 
380 
381 
382  //
383  // ====> Methods returning rows.
384  //
385 
391  std::vector<FocusModelRow *> get() ;
392 
399  const std::vector<FocusModelRow *>& get() const ;
400 
401 
402 
403 
404 
416  FocusModelRow* getRowByKey(Tag antennaId, int focusModelId);
417 
418 
419 
427  std::vector <FocusModelRow *> getRowByFocusModelId(int);
428 
429 
430 
456  FocusModelRow* lookup(Tag antennaId, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, int numCoeff, std::vector<std::string > coeffName, std::vector<std::string > coeffFormula, std::vector<float > coeffVal, std::string assocNature, int assocFocusModelId);
457 
458 
459  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
460  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
461 
462 private:
463 
473 
475 
476  bool archiveAsBin; // If true archive binary else archive XML
477  bool fileAsBin ; // If true file binary else file XML
478 
479  std::string version ;
480 
482 
483 
484 
485 
486 
487  // A map for the autoincrementation algorithm
488  std::map<std::string,int> noAutoIncIds;
489  void autoIncrement(std::string key, FocusModelRow* x);
490 
491 
501  FocusModelRow* checkAndAdd(FocusModelRow* x, bool skipCheckUniqueness=false) ;
502 
508  void append(FocusModelRow* x) ;
509 
516 
517 
518 
519 
520 
521 // A data structure to store the pointers on the table's rows.
522 
523 // In all cases we maintain a private vector of FocusModelRow s.
524  std::vector<FocusModelRow * > privateRows;
525 
526 
527 
528  std::vector<FocusModelRow *> row;
529 
530 
531  void error() ; //throw(ConversionException);
532 
533 
540  void fromXML(std::string& xmlDoc) ;
541 
542  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
543 
548  void setFromMIMEFile(const std::string& directory);
549  /*
550  void openMIMEFile(const std::string& directory);
551  */
552  void setFromXMLFile(const std::string& directory);
553 
561  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
562 
563 
570  void setFromMIME(const std::string & mimeMsg);
571 
575  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
576 
586  void toFile(std::string directory);
587 
593  if (!presentInMemory && !loadInProgress) {
594  loadInProgress = true;
595  setFromFile(getContainer().getDirectory());
596  presentInMemory = true;
597  loadInProgress = false;
598  }
599  }
608  void setFromFile(const std::string& directory);
609 
610 };
611 
612 } // End namespace asdm
613 
614 #endif /* FocusModelTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
virtual ~FocusModelTable()
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
FocusModelRow * add(FocusModelRow *x)
====&gt; Append a row to its table.
void autoIncrement(std::string key, FocusModelRow *x)
std::string toXML()
Produces an XML representation conform to the schema defined for FocusModel (FocusModelTable.xsd).
void setEntity(Entity e)
Set this table&#39;s Entity.
A class to represent byte order information.
Definition: Misc.h:115
FocusModelRow * getRowByKey(Tag antennaId, int focusModelId)
Returns a FocusModelRow* given a key.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void setFromXMLFile(const std::string &directory)
void append(FocusModelRow *x)
Brutally append an FocusModelRow x to the collection of rows already stored in this table...
bool loadInProgress
Load the table in memory if necessary.
std::string getVersion() const
Return the version information about this table.
FocusModelRow * checkAndAdd(FocusModelRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
static std::string name()
Return the name of this table.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a FocusModelTable as those produced by the toF...
unsigned int size() const
Return the number of rows in the table.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
Entity getEntity() const
Return this table&#39;s Entity.
std::string getName() const
Return the name of this table.
std::vector< FocusModelRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
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 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< FocusModelRow * > getRowByFocusModelId(int)
Returns a vector of pointers on rows whose key element focusModelId is equal to the parameter focusMo...
asdmIDL::FocusModelTableIDL * toIDL()
Conversion Methods.
void addWithoutCheckingUnique(FocusModelRow *x)
Brutally append an FocusModelRow x to the collection of rows already stored in this 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
The FocusModelRow class is a row of a FocusModelTable.
const Double e
e and functions thereof:
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::vector< FocusModelRow * > row
FocusModelRow * newRow()
====&gt; Row creation.
FocusModelTable(ASDM &container)
Create a FocusModelTable.
The FocusModelTable class is an Alma table.
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
FocusModelRow * lookup(Tag antennaId, PolarizationTypeMod::PolarizationType polarizationType, ReceiverBandMod::ReceiverBand receiverBand, int numCoeff, std::vector< std::string > coeffName, std::vector< std::string > coeffFormula, std::vector< float > coeffVal, std::string assocNature, int assocFocusModelId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
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...
ASDM & getContainer() const
Return the container to which this table belongs.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
void fromIDL(asdmIDL::FocusModelTableIDL x)
Populate this table from the content of a FocusModelTableIDL Corba structure.