casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConfigDescriptionTable.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 ConfigDescriptionTable.h
32  */
33 
34 #ifndef ConfigDescriptionTable_CLASS
35 #define ConfigDescriptionTable_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 
58 
59 
60 
61 
62 
63 
64 
66 
67 
68 
70 
71 
72 
73 
74 
76 
77 
78 
79 
80 
82 
83 
84 
85 
87 #include <alma/ASDM/DuplicateKey.h>
89 #include <alma/ASDM/NoSuchRow.h>
90 #include <alma/ASDM/DuplicateKey.h>
91 
92 
93 #ifndef WITHOUT_ACS
94 #include <asdmIDLC.h>
95 #endif
96 
98 
99 #include <pthread.h>
100 
101 namespace asdm {
102 
103 //class asdm::ASDM;
104 //class asdm::ConfigDescriptionRow;
105 
106 class ASDM;
107 class ConfigDescriptionRow;
264  friend class ASDM;
265 
266 public:
267 
268 
274  static const std::vector<std::string>& getKeyName();
275 
276 
277  virtual ~ConfigDescriptionTable();
278 
284  ASDM &getContainer() const;
285 
291  unsigned int size() const;
292 
300  std::string getName() const;
301 
309  static std::string name() ;
310 
315  std::string getVersion() const ;
316 
322  static const std::vector<std::string>& getAttributesNames();
323 
329  static const std::vector<std::string>& defaultAttributesNamesInBin();
330 
334  Entity getEntity() const;
335 
340  void setEntity(Entity e);
341 
349  std::string toXML() ;
350 
351 #ifndef WITHOUT_ACS
352  // Conversion Methods
358  asdmIDL::ConfigDescriptionTableIDL *toIDL() ;
359 
367  void toIDL(asdmIDL::ConfigDescriptionTableIDL& x) const;
368 
369 #endif
370 
371 #ifndef WITHOUT_ACS
372 
378  void fromIDL(asdmIDL::ConfigDescriptionTableIDL x) ;
379 #endif
380 
381  //
382  // ====> Row creation.
383  //
384 
390 
391 
423  ConfigDescriptionRow *newRow(int numAntenna, int numDataDescription, int numFeed, CorrelationModeMod::CorrelationMode correlationMode, int numAtmPhaseCorrection, std::vector<AtmPhaseCorrectionMod::AtmPhaseCorrection > atmPhaseCorrection, ProcessorTypeMod::ProcessorType processorType, SpectralResolutionTypeMod::SpectralResolutionType spectralType, std::vector<Tag> antennaId, std::vector<int> feedId, std::vector<Tag> switchCycleId, std::vector<Tag> dataDescriptionId, Tag processorId);
424 
425 
426 
440 
441  //
442  // ====> Append a row to its table.
443  //
444 
445 
446 
447 
458 
459 
460 
461  //
462  // ====> Methods returning rows.
463  //
464 
470  std::vector<ConfigDescriptionRow *> get() ;
471 
478  const std::vector<ConfigDescriptionRow *>& get() const ;
479 
480 
481 
482 
483 
493  ConfigDescriptionRow* getRowByKey(Tag configDescriptionId);
494 
495 
496 
497 
498 
532  ConfigDescriptionRow* lookup(int numAntenna, int numDataDescription, int numFeed, CorrelationModeMod::CorrelationMode correlationMode, int numAtmPhaseCorrection, std::vector<AtmPhaseCorrectionMod::AtmPhaseCorrection > atmPhaseCorrection, ProcessorTypeMod::ProcessorType processorType, SpectralResolutionTypeMod::SpectralResolutionType spectralType, std::vector<Tag> antennaId, std::vector<int> feedId, std::vector<Tag> switchCycleId, std::vector<Tag> dataDescriptionId, Tag processorId);
533 
534 
535  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
536  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
537 
538 private:
539 
549 
551 
552  bool archiveAsBin; // If true archive binary else archive XML
553  bool fileAsBin ; // If true file binary else file XML
554 
555  std::string version ;
556 
558 
559 
560 
561 
562 
563  // A map for the autoincrementation algorithm
564  std::map<std::string,int> noAutoIncIds;
565  void autoIncrement(std::string key, ConfigDescriptionRow* x);
566 
567 
577  ConfigDescriptionRow* checkAndAdd(ConfigDescriptionRow* x, bool skipCheckUniqueness=false) ;
578 
584  void append(ConfigDescriptionRow* x) ;
585 
592 
593 
594 
595 
596 
597 // A data structure to store the pointers on the table's rows.
598 
599 // In all cases we maintain a private vector of ConfigDescriptionRow s.
600  std::vector<ConfigDescriptionRow * > privateRows;
601 
602 
603 
604  std::vector<ConfigDescriptionRow *> row;
605 
606 
607  void error() ; //throw(ConversionException);
608 
609 
616  void fromXML(std::string& xmlDoc) ;
617 
618  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
619 
624  void setFromMIMEFile(const std::string& directory);
625  /*
626  void openMIMEFile(const std::string& directory);
627  */
628  void setFromXMLFile(const std::string& directory);
629 
637  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
638 
639 
646  void setFromMIME(const std::string & mimeMsg);
647 
651  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
652 
662  void toFile(std::string directory);
663 
669  if (!presentInMemory && !loadInProgress) {
670  loadInProgress = true;
671  setFromFile(getContainer().getDirectory());
672  presentInMemory = true;
673  loadInProgress = false;
674  }
675  }
684  void setFromFile(const std::string& directory);
685 
686 };
687 
688 } // End namespace asdm
689 
690 #endif /* ConfigDescriptionTable_CLASS */
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static std::string name()
Return the name of this table.
std::vector< ConfigDescriptionRow * > row
A class to represent byte order information.
Definition: Misc.h:115
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...
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::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
The ConfigDescriptionTable class is an Alma table.
void fromIDL(asdmIDL::ConfigDescriptionTableIDL x)
Populate this table from the content of a ConfigDescriptionTableIDL Corba structure.
std::vector< ConfigDescriptionRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Entity getEntity() const
Return this table&#39;s Entity.
ConfigDescriptionRow * lookup(int numAntenna, int numDataDescription, int numFeed, CorrelationModeMod::CorrelationMode correlationMode, int numAtmPhaseCorrection, std::vector< AtmPhaseCorrectionMod::AtmPhaseCorrection > atmPhaseCorrection, ProcessorTypeMod::ProcessorType processorType, SpectralResolutionTypeMod::SpectralResolutionType spectralType, std::vector< Tag > antennaId, std::vector< int > feedId, std::vector< Tag > switchCycleId, std::vector< Tag > dataDescriptionId, Tag processorId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
void addWithoutCheckingUnique(ConfigDescriptionRow *x)
Brutally append an ConfigDescriptionRow x to the collection of rows already stored in this table...
ConfigDescriptionRow * add(ConfigDescriptionRow *x)
====&gt; Append a row to its table.
void setEntity(Entity e)
Set this table&#39;s Entity.
void setFromXMLFile(const std::string &directory)
std::string getName() const
Return the name of this table.
ConfigDescriptionRow * checkAndAdd(ConfigDescriptionRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
std::string getVersion() const
Return the version information about this table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
void append(ConfigDescriptionRow *x)
Brutally append an ConfigDescriptionRow x to the collection of rows already stored in this table...
void autoIncrement(std::string key, ConfigDescriptionRow *x)
ConfigDescriptionTable(ASDM &container)
Create a ConfigDescriptionTable.
std::string toXML()
Produces an XML representation conform to the schema defined for ConfigDescription (ConfigDescription...
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...
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.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
unsigned int size() const
Return the number of rows in the table.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a ConfigDescriptionTable as those produced by ...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
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:
The ConfigDescriptionRow class is a row of a ConfigDescriptionTable.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
ConfigDescriptionRow * newRow()
====&gt; Row creation.
ASDM & getContainer() const
Return the container to which this table belongs.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
ConfigDescriptionRow * getRowByKey(Tag configDescriptionId)
Returns a ConfigDescriptionRow* given a key.
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
bool loadInProgress
Load the table in memory if necessary.
asdmIDL::ConfigDescriptionTableIDL * toIDL()
Conversion Methods.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59