casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ReceiverTable.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 ReceiverTable.h
32  */
33 
34 #ifndef ReceiverTable_CLASS
35 #define ReceiverTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/Frequency.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
68 
69 
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::ReceiverRow;
101 
102 class ASDM;
103 class ReceiverRow;
197 class ReceiverTable : public Representable {
198  friend class ASDM;
199 
200 public:
201 
202 
208  static const std::vector<std::string>& getKeyName();
209 
210 
211  virtual ~ReceiverTable();
212 
218  ASDM &getContainer() const;
219 
225  unsigned int size() const;
226 
234  std::string getName() const;
235 
243  static std::string name() ;
244 
249  std::string getVersion() const ;
250 
256  static const std::vector<std::string>& getAttributesNames();
257 
263  static const std::vector<std::string>& defaultAttributesNamesInBin();
264 
268  Entity getEntity() const;
269 
274  void setEntity(Entity e);
275 
283  std::string toXML() ;
284 
285 #ifndef WITHOUT_ACS
286  // Conversion Methods
292  asdmIDL::ReceiverTableIDL *toIDL() ;
293 
301  void toIDL(asdmIDL::ReceiverTableIDL& x) const;
302 
303 #endif
304 
305 #ifndef WITHOUT_ACS
306 
312  void fromIDL(asdmIDL::ReceiverTableIDL x) ;
313 #endif
314 
315  //
316  // ====> Row creation.
317  //
318 
323  ReceiverRow *newRow();
324 
325 
347  ReceiverRow *newRow(Tag spectralWindowId, ArrayTimeInterval timeInterval, std::string name, int numLO, ReceiverBandMod::ReceiverBand frequencyBand, std::vector<Frequency > freqLO, ReceiverSidebandMod::ReceiverSideband receiverSideband, std::vector<NetSidebandMod::NetSideband > sidebandLO);
348 
349 
350 
364 
365  //
366  // ====> Append a row to its table.
367  //
368 
369 
370 
371 
372 
383 
384 
385 
386  //
387  // ====> Methods returning rows.
388  //
389 
395  std::vector<ReceiverRow *> get() ;
396 
403  const std::vector<ReceiverRow *>& get() const ;
404 
405 
406 
407 
408 
422  ReceiverRow* getRowByKey(int receiverId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
423 
424 
425 
433  std::vector <ReceiverRow *> getRowByReceiverId(int);
434 
435 
436 
460  ReceiverRow* lookup(Tag spectralWindowId, ArrayTimeInterval timeInterval, std::string name, int numLO, ReceiverBandMod::ReceiverBand frequencyBand, std::vector<Frequency > freqLO, ReceiverSidebandMod::ReceiverSideband receiverSideband, std::vector<NetSidebandMod::NetSideband > sidebandLO);
461 
462 
463  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
464  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
465 
466 private:
467 
477 
479 
480  bool archiveAsBin; // If true archive binary else archive XML
481  bool fileAsBin ; // If true file binary else file XML
482 
483  std::string version ;
484 
486 
487 
488 
489 
490 
491 
501  ReceiverRow* checkAndAdd(ReceiverRow* x, bool skipCheckUniqueness=false) ;
502 
508  void append(ReceiverRow* x) ;
509 
516 
517 
518 
519 
520 
521 
529  ReceiverRow * insertByStartTime(ReceiverRow* x, std::vector<ReceiverRow* >& row);
530 
531 
532 
533 // A data structure to store the pointers on the table's rows.
534 
535 // In all cases we maintain a private vector of ReceiverRow s.
536  std::vector<ReceiverRow * > privateRows;
537 
538 
539 
540 
541 
542 
543 
544 
545  typedef std::vector <std::vector <ReceiverRow* > > ID_TIME_ROWS;
546  std::map<std::string, ID_TIME_ROWS > context;
547 
552  std::string Key(Tag spectralWindowId) ;
553 
554 
555 
556 
562  void getByKeyNoAutoIncNoTime(std::vector <ReceiverRow*>& vin, std::vector <ReceiverRow*>& vout, Tag spectralWindowId);
563 
564 
565 
566  void error() ; //throw(ConversionException);
567 
568 
575  void fromXML(std::string& xmlDoc) ;
576 
577  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
578 
583  void setFromMIMEFile(const std::string& directory);
584  /*
585  void openMIMEFile(const std::string& directory);
586  */
587  void setFromXMLFile(const std::string& directory);
588 
596  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
597 
598 
605  void setFromMIME(const std::string & mimeMsg);
606 
610  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
611 
621  void toFile(std::string directory);
622 
628  if (!presentInMemory && !loadInProgress) {
629  loadInProgress = true;
630  setFromFile(getContainer().getDirectory());
631  presentInMemory = true;
632  loadInProgress = false;
633  }
634  }
643  void setFromFile(const std::string& directory);
644 
645 };
646 
647 } // End namespace asdm
648 
649 #endif /* ReceiverTable_CLASS */
std::string toXML()
Produces an XML representation conform to the schema defined for Receiver (ReceiverTable.xsd).
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 setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
The ReceiverRow class is a row of a ReceiverTable.
Definition: ReceiverRow.h:119
asdmIDL::ReceiverTableIDL * toIDL()
Conversion Methods.
std::vector< ReceiverRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
void fromIDL(asdmIDL::ReceiverTableIDL x)
Populate this table from the content of a ReceiverTableIDL Corba structure.
ReceiverRow * checkAndAdd(ReceiverRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
void getByKeyNoAutoIncNoTime(std::vector< ReceiverRow * > &vin, std::vector< ReceiverRow * > &vout, Tag spectralWindowId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
A class to represent byte order information.
Definition: Misc.h:115
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
virtual ~ReceiverTable()
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).
The ASDM class is the container for all tables.
Definition: ASDM.h:273
ReceiverRow * insertByStartTime(ReceiverRow *x, std::vector< ReceiverRow * > &row)
Insert a ReceiverRow* in a vector of ReceiverRow* so that it&#39;s ordered by ascending time...
ReceiverRow * getRowByKey(int receiverId, Tag spectralWindowId, ArrayTimeInterval timeInterval)
Returns a ReceiverRow* given a key.
ASDM & getContainer() const
Return the container to which this table belongs.
std::string Key(Tag spectralWindowId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
std::string getVersion() const
Return the version information about this table.
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
unsigned int size() const
Return the number of rows in the table.
bool loadInProgress
Load the table in memory if necessary.
ReceiverTable(ASDM &container)
Create a ReceiverTable.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
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 std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void setEntity(Entity e)
Set this table&#39;s Entity.
std::vector< std::vector< ReceiverRow * > > ID_TIME_ROWS
std::string getName() const
Return the name of this table.
The ReceiverTable class is an Alma table.
Entity getEntity() const
Return this table&#39;s Entity.
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...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
void setFromXMLFile(const std::string &directory)
std::vector< ReceiverRow * > getRowByReceiverId(int)
Returns a vector of pointers on rows whose key element receiverId is equal to the parameter receiverI...
void append(ReceiverRow *x)
Brutally append an ReceiverRow x to the collection of rows already stored in this table...
ReceiverRow * lookup(Tag spectralWindowId, ArrayTimeInterval timeInterval, std::string name, int numLO, ReceiverBandMod::ReceiverBand frequencyBand, std::vector< Frequency > freqLO, ReceiverSidebandMod::ReceiverSideband receiverSideband, std::vector< NetSidebandMod::NetSideband > sidebandLO)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
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 addWithoutCheckingUnique(ReceiverRow *x)
Brutally append an ReceiverRow 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...
ReceiverRow * newRow()
====&gt; Row creation.
std::map< std::string, ID_TIME_ROWS > context
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a ReceiverTable as those produced by the toFil...
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
ReceiverRow * add(ReceiverRow *x)
====&gt; Append a row to its table.
static std::string name()
Return the name of this table.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59