casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpectralWindowTable.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 SpectralWindowTable.h
32  */
33 
34 #ifndef SpectralWindowTable_CLASS
35 #define SpectralWindowTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/Frequency.h>
45 
46 
47 
48 #include <alma/ASDM/Tag.h>
49 
50 
51 
52 
53 
54 
55 
56 
58 
59 
60 
62 
63 
64 
65 
66 
67 
68 
69 
70 
72 
73 
74 
75 
76 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
106 
107 
108 
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
124 
125 
126 
127 
129 #include <alma/ASDM/DuplicateKey.h>
131 #include <alma/ASDM/NoSuchRow.h>
132 #include <alma/ASDM/DuplicateKey.h>
133 
134 
135 #ifndef WITHOUT_ACS
136 #include <asdmIDLC.h>
137 #endif
138 
139 #include <alma/ASDM/Representable.h>
140 
141 #include <pthread.h>
142 
143 namespace asdm {
144 
145 //class asdm::ASDM;
146 //class asdm::SpectralWindowRow;
147 
148 class ASDM;
149 class SpectralWindowRow;
404  friend class ASDM;
405 
406 public:
407 
408 
414  static const std::vector<std::string>& getKeyName();
415 
416 
417  virtual ~SpectralWindowTable();
418 
424  ASDM &getContainer() const;
425 
431  unsigned int size() const;
432 
440  std::string getName() const;
441 
449  static std::string name() ;
450 
455  std::string getVersion() const ;
456 
462  static const std::vector<std::string>& getAttributesNames();
463 
469  static const std::vector<std::string>& defaultAttributesNamesInBin();
470 
474  Entity getEntity() const;
475 
480  void setEntity(Entity e);
481 
489  std::string toXML() ;
490 
491 #ifndef WITHOUT_ACS
492  // Conversion Methods
498  asdmIDL::SpectralWindowTableIDL *toIDL() ;
499 
507  void toIDL(asdmIDL::SpectralWindowTableIDL& x) const;
508 
509 #endif
510 
511 #ifndef WITHOUT_ACS
512 
518  void fromIDL(asdmIDL::SpectralWindowTableIDL x) ;
519 #endif
520 
521  //
522  // ====> Row creation.
523  //
524 
530 
531 
551  SpectralWindowRow *newRow(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction);
552 
553 
554 
568 
569  //
570  // ====> Append a row to its table.
571  //
572 
573 
574 
575 
586 
587 
588 
589  //
590  // ====> Methods returning rows.
591  //
592 
598  std::vector<SpectralWindowRow *> get() ;
599 
606  const std::vector<SpectralWindowRow *>& get() const ;
607 
608 
609 
610 
611 
621  SpectralWindowRow* getRowByKey(Tag spectralWindowId);
622 
623 
624 
625 
626 
648  SpectralWindowRow* lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction);
649 
650 
651  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
652  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
653 
654 private:
655 
665 
667 
668  bool archiveAsBin; // If true archive binary else archive XML
669  bool fileAsBin ; // If true file binary else file XML
670 
671  std::string version ;
672 
674 
675 
676 
677 
678 
679  // A map for the autoincrementation algorithm
680  std::map<std::string,int> noAutoIncIds;
681  void autoIncrement(std::string key, SpectralWindowRow* x);
682 
683 
693  SpectralWindowRow* checkAndAdd(SpectralWindowRow* x, bool skipCheckUniqueness=false) ;
694 
700  void append(SpectralWindowRow* x) ;
701 
708 
709 
710 
711 
712 
713 // A data structure to store the pointers on the table's rows.
714 
715 // In all cases we maintain a private vector of SpectralWindowRow s.
716  std::vector<SpectralWindowRow * > privateRows;
717 
718 
719 
720  std::vector<SpectralWindowRow *> row;
721 
722 
723  void error() ; //throw(ConversionException);
724 
725 
732  void fromXML(std::string& xmlDoc) ;
733 
734  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
735 
740  void setFromMIMEFile(const std::string& directory);
741  /*
742  void openMIMEFile(const std::string& directory);
743  */
744  void setFromXMLFile(const std::string& directory);
745 
753  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
754 
755 
762  void setFromMIME(const std::string & mimeMsg);
763 
767  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
768 
778  void toFile(std::string directory);
779 
785  if (!presentInMemory && !loadInProgress) {
786  loadInProgress = true;
787  setFromFile(getContainer().getDirectory());
788  presentInMemory = true;
789  loadInProgress = false;
790  }
791  }
800  void setFromFile(const std::string& directory);
801 
802 };
803 
804 } // End namespace asdm
805 
806 #endif /* SpectralWindowTable_CLASS */
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
ASDM & getContainer() const
Return the container to which this table belongs.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a SpectralWindowTable as those produced by the...
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
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...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
A class to represent byte order information.
Definition: Misc.h:115
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
SpectralWindowRow * getRowByKey(Tag spectralWindowId)
Returns a SpectralWindowRow* given a key.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
void autoIncrement(std::string key, SpectralWindowRow *x)
SpectralWindowRow * add(SpectralWindowRow *x)
====&gt; Append a row to its table.
Entity getEntity() const
Return this table&#39;s Entity.
std::vector< SpectralWindowRow * > row
SpectralWindowRow * newRow()
====&gt; Row creation.
void append(SpectralWindowRow *x)
Brutally append an SpectralWindowRow x to the collection of rows already stored in this table...
std::string getVersion() const
Return the version information about this table.
static std::string name()
Return the name of this table.
SpectralWindowRow * checkAndAdd(SpectralWindowRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
bool loadInProgress
Load the table in memory if necessary.
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 SpectralWindowTable class is an Alma table.
asdmIDL::SpectralWindowTableIDL * toIDL()
Conversion Methods.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
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 setFromXMLFile(const std::string &directory)
SpectralWindowRow * lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction)
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...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void setEntity(Entity e)
Set this table&#39;s Entity.
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
std::map< std::string, int > noAutoIncIds
A map for the autoincrementation algorithm.
unsigned int size() const
Return the number of rows in the table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
const Double e
e and functions thereof:
SpectralWindowTable(ASDM &container)
Create a SpectralWindowTable.
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.
void fromIDL(asdmIDL::SpectralWindowTableIDL x)
Populate this table from the content of a SpectralWindowTableIDL Corba structure. ...
void addWithoutCheckingUnique(SpectralWindowRow *x)
Brutally append an SpectralWindowRow x to the collection of rows already stored in this table...
The Frequency class implements a quantity of frequency in hertz.
Definition: Frequency.h:53
std::string getName() const
Return the name of this table.
The SpectralWindowRow class is a row of a SpectralWindowTable.
std::vector< SpectralWindowRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
std::string toXML()
Produces an XML representation conform to the schema defined for SpectralWindow (SpectralWindowTable...
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59