casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CorrelatorModeTable.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 CorrelatorModeTable.h
32  */
33 
34 #ifndef CorrelatorModeTable_CLASS
35 #define CorrelatorModeTable_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 
60 
62 
63 
64 
65 
66 
67 
68 
70 
71 
72 
74 
75 
76 
78 
79 
80 
81 
83 #include <alma/ASDM/DuplicateKey.h>
85 #include <alma/ASDM/NoSuchRow.h>
86 #include <alma/ASDM/DuplicateKey.h>
87 
88 
89 #ifndef WITHOUT_ACS
90 #include <asdmIDLC.h>
91 #endif
92 
94 
95 #include <pthread.h>
96 
97 namespace asdm {
98 
99 //class asdm::ASDM;
100 //class asdm::CorrelatorModeRow;
101 
102 class ASDM;
103 class CorrelatorModeRow;
201  friend class ASDM;
202 
203 public:
204 
205 
211  static const std::vector<std::string>& getKeyName();
212 
213 
214  virtual ~CorrelatorModeTable();
215 
221  ASDM &getContainer() const;
222 
228  unsigned int size() const;
229 
237  std::string getName() const;
238 
246  static std::string name() ;
247 
252  std::string getVersion() const ;
253 
259  static const std::vector<std::string>& getAttributesNames();
260 
266  static const std::vector<std::string>& defaultAttributesNamesInBin();
267 
271  Entity getEntity() const;
272 
277  void setEntity(Entity e);
278 
286  std::string toXML() ;
287 
288 #ifndef WITHOUT_ACS
289  // Conversion Methods
295  asdmIDL::CorrelatorModeTableIDL *toIDL() ;
296 
304  void toIDL(asdmIDL::CorrelatorModeTableIDL& x) const;
305 
306 #endif
307 
308 #ifndef WITHOUT_ACS
309 
315  void fromIDL(asdmIDL::CorrelatorModeTableIDL x) ;
316 #endif
317 
318  //
319  // ====> Row creation.
320  //
321 
327 
328 
352  CorrelatorModeRow *newRow(int numBaseband, std::vector<BasebandNameMod::BasebandName > basebandNames, std::vector<int > basebandConfig, AccumModeMod::AccumMode accumMode, int binMode, int numAxes, std::vector<AxisNameMod::AxisName > axesOrderArray, std::vector<FilterModeMod::FilterMode > filterMode, CorrelatorNameMod::CorrelatorName correlatorName);
353 
354 
355 
369 
370  //
371  // ====> Append a row to its table.
372  //
373 
374 
375 
376 
387 
388 
389 
390  //
391  // ====> Methods returning rows.
392  //
393 
399  std::vector<CorrelatorModeRow *> get() ;
400 
407  const std::vector<CorrelatorModeRow *>& get() const ;
408 
409 
410 
411 
412 
422  CorrelatorModeRow* getRowByKey(Tag correlatorModeId);
423 
424 
425 
426 
427 
453  CorrelatorModeRow* lookup(int numBaseband, std::vector<BasebandNameMod::BasebandName > basebandNames, std::vector<int > basebandConfig, AccumModeMod::AccumMode accumMode, int binMode, int numAxes, std::vector<AxisNameMod::AxisName > axesOrderArray, std::vector<FilterModeMod::FilterMode > filterMode, CorrelatorNameMod::CorrelatorName correlatorName);
454 
455 
456  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
457  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
458 
459 private:
460 
470 
472 
473  bool archiveAsBin; // If true archive binary else archive XML
474  bool fileAsBin ; // If true file binary else file XML
475 
476  std::string version ;
477 
479 
480 
481 
482 
483 
484  // A map for the autoincrementation algorithm
485  std::map<std::string,int> noAutoIncIds;
486  void autoIncrement(std::string key, CorrelatorModeRow* x);
487 
488 
498  CorrelatorModeRow* checkAndAdd(CorrelatorModeRow* x, bool skipCheckUniqueness=false) ;
499 
505  void append(CorrelatorModeRow* x) ;
506 
513 
514 
515 
516 
517 
518 // A data structure to store the pointers on the table's rows.
519 
520 // In all cases we maintain a private vector of CorrelatorModeRow s.
521  std::vector<CorrelatorModeRow * > privateRows;
522 
523 
524 
525  std::vector<CorrelatorModeRow *> row;
526 
527 
528  void error() ; //throw(ConversionException);
529 
530 
537  void fromXML(std::string& xmlDoc) ;
538 
539  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
540 
545  void setFromMIMEFile(const std::string& directory);
546  /*
547  void openMIMEFile(const std::string& directory);
548  */
549  void setFromXMLFile(const std::string& directory);
550 
558  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
559 
560 
567  void setFromMIME(const std::string & mimeMsg);
568 
572  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
573 
583  void toFile(std::string directory);
584 
590  if (!presentInMemory && !loadInProgress) {
591  loadInProgress = true;
592  setFromFile(getContainer().getDirectory());
593  presentInMemory = true;
594  loadInProgress = false;
595  }
596  }
605  void setFromFile(const std::string& directory);
606 
607 };
608 
609 } // End namespace asdm
610 
611 #endif /* CorrelatorModeTable_CLASS */
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.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
std::string getVersion() const
Return the version information about this table.
The CorrelatorModeRow class is a row of a CorrelatorModeTable.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
void append(CorrelatorModeRow *x)
Brutally append an CorrelatorModeRow x to the collection of rows already stored in this table...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
ASDM & getContainer() const
Return the container to which this table belongs.
std::string getName() const
Return the name of this table.
A class to represent byte order information.
Definition: Misc.h:115
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void addWithoutCheckingUnique(CorrelatorModeRow *x)
Brutally append an CorrelatorModeRow x to the collection of rows already stored in this table...
CorrelatorModeRow * newRow()
====&gt; Row creation.
CorrelatorModeRow * lookup(int numBaseband, std::vector< BasebandNameMod::BasebandName > basebandNames, std::vector< int > basebandConfig, AccumModeMod::AccumMode accumMode, int binMode, int numAxes, std::vector< AxisNameMod::AxisName > axesOrderArray, std::vector< FilterModeMod::FilterMode > filterMode, CorrelatorNameMod::CorrelatorName correlatorName)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
std::vector< CorrelatorModeRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
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...
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
unsigned int size() const
Return the number of rows in the 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...
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a CorrelatorModeTable as those produced by the...
CorrelatorModeTable(ASDM &container)
Create a CorrelatorModeTable.
void setEntity(Entity e)
Set this table&#39;s Entity.
bool loadInProgress
Load the table in memory if necessary.
void fromIDL(asdmIDL::CorrelatorModeTableIDL x)
Populate this table from the content of a CorrelatorModeTableIDL Corba structure. ...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
CorrelatorModeRow * add(CorrelatorModeRow *x)
====&gt; Append a row to its table.
The CorrelatorModeTable class is an Alma table.
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
asdmIDL::CorrelatorModeTableIDL * toIDL()
Conversion Methods.
void setFromXMLFile(const std::string &directory)
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
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
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
std::string toXML()
Produces an XML representation conform to the schema defined for CorrelatorMode (CorrelatorModeTable...
const Double e
e and functions thereof:
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 std::string name()
Return the name of this table.
void autoIncrement(std::string key, CorrelatorModeRow *x)
CorrelatorModeRow * checkAndAdd(CorrelatorModeRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
std::vector< CorrelatorModeRow * > row
Entity getEntity() const
Return this table&#39;s Entity.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
CorrelatorModeRow * getRowByKey(Tag correlatorModeId)
Returns a CorrelatorModeRow* given a key.