casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FeedTable.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 FeedTable.h
32  */
33 
34 #ifndef FeedTable_CLASS
35 #define FeedTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/Angle.h>
49 
50 
51 
52 #include <alma/ASDM/Length.h>
53 
54 
55 
56 #include <alma/ASDM/Tag.h>
57 
58 
59 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
94 
95 
96 
97 
99 #include <alma/ASDM/DuplicateKey.h>
101 #include <alma/ASDM/NoSuchRow.h>
102 #include <alma/ASDM/DuplicateKey.h>
103 
104 
105 #ifndef WITHOUT_ACS
106 #include <asdmIDLC.h>
107 #endif
108 
109 #include <alma/ASDM/Representable.h>
110 
111 #include <pthread.h>
112 
113 namespace asdm {
114 
115 //class asdm::ASDM;
116 //class asdm::FeedRow;
117 
118 class ASDM;
119 class FeedRow;
274 class FeedTable : public Representable {
275  friend class ASDM;
276 
277 public:
278 
279 
285  static const std::vector<std::string>& getKeyName();
286 
287 
288  virtual ~FeedTable();
289 
295  ASDM &getContainer() const;
296 
302  unsigned int size() const;
303 
311  std::string getName() const;
312 
320  static std::string name() ;
321 
326  std::string getVersion() const ;
327 
333  static const std::vector<std::string>& getAttributesNames();
334 
340  static const std::vector<std::string>& defaultAttributesNamesInBin();
341 
345  Entity getEntity() const;
346 
351  void setEntity(Entity e);
352 
360  std::string toXML() ;
361 
362 #ifndef WITHOUT_ACS
363  // Conversion Methods
369  asdmIDL::FeedTableIDL *toIDL() ;
370 
378  void toIDL(asdmIDL::FeedTableIDL& x) const;
379 
380 #endif
381 
382 #ifndef WITHOUT_ACS
383 
389  void fromIDL(asdmIDL::FeedTableIDL x) ;
390 #endif
391 
392  //
393  // ====> Row creation.
394  //
395 
400  FeedRow *newRow();
401 
402 
428  FeedRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, std::vector<std::vector<double > > beamOffset, std::vector<std::vector<Length > > focusReference, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<Complex > > polResponse, std::vector<Angle > receptorAngle, std::vector<int> receiverId);
429 
430 
431 
444  FeedRow *newRow(FeedRow *row);
445 
446  //
447  // ====> Append a row to its table.
448  //
449 
450 
451 
452 
453 
463  FeedRow* add(FeedRow* x) ;
464 
465 
466 
467  //
468  // ====> Methods returning rows.
469  //
470 
476  std::vector<FeedRow *> get() ;
477 
484  const std::vector<FeedRow *>& get() const ;
485 
486 
487 
488 
489 
505  FeedRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
506 
507 
508 
516  std::vector <FeedRow *> getRowByFeedId(int);
517 
518 
519 
547  FeedRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, std::vector<std::vector<double > > beamOffset, std::vector<std::vector<Length > > focusReference, std::vector<PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector<std::vector<Complex > > polResponse, std::vector<Angle > receptorAngle, std::vector<int> receiverId);
548 
549 
550  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
551  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
552 
553 private:
554 
564 
566 
567  bool archiveAsBin; // If true archive binary else archive XML
568  bool fileAsBin ; // If true file binary else file XML
569 
570  std::string version ;
571 
573 
574 
575 
576 
577 
578 
588  FeedRow* checkAndAdd(FeedRow* x, bool skipCheckUniqueness=false) ;
589 
595  void append(FeedRow* x) ;
596 
603 
604 
605 
606 
607 
608 
616  FeedRow * insertByStartTime(FeedRow* x, std::vector<FeedRow* >& row);
617 
618 
619 
620 // A data structure to store the pointers on the table's rows.
621 
622 // In all cases we maintain a private vector of FeedRow s.
623  std::vector<FeedRow * > privateRows;
624 
625 
626 
627 
628 
629 
630 
631 
632  typedef std::vector <std::vector <FeedRow* > > ID_TIME_ROWS;
633  std::map<std::string, ID_TIME_ROWS > context;
634 
639  std::string Key(Tag antennaId, Tag spectralWindowId) ;
640 
641 
642 
643 
649  void getByKeyNoAutoIncNoTime(std::vector <FeedRow*>& vin, std::vector <FeedRow*>& vout, Tag antennaId, Tag spectralWindowId);
650 
651 
652 
653  void error() ; //throw(ConversionException);
654 
655 
662  void fromXML(std::string& xmlDoc) ;
663 
664  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
665 
670  void setFromMIMEFile(const std::string& directory);
671  /*
672  void openMIMEFile(const std::string& directory);
673  */
674  void setFromXMLFile(const std::string& directory);
675 
683  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
684 
685 
692  void setFromMIME(const std::string & mimeMsg);
693 
697  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
698 
708  void toFile(std::string directory);
709 
715  if (!presentInMemory && !loadInProgress) {
716  loadInProgress = true;
717  setFromFile(getContainer().getDirectory());
718  presentInMemory = true;
719  loadInProgress = false;
720  }
721  }
730  void setFromFile(const std::string& directory);
731 
732 };
733 
734 } // End namespace asdm
735 
736 #endif /* FeedTable_CLASS */
The FeedRow class is a row of a FeedTable.
Definition: FeedRow.h:141
std::map< std::string, ID_TIME_ROWS > context
Definition: FeedTable.h:633
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
asdmIDL::FeedTableIDL * toIDL()
Conversion Methods.
void setFromXMLFile(const std::string &directory)
void append(FeedRow *x)
Brutally append an FeedRow x to the collection of rows already stored in this table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
bool loadInProgress
Load the table in memory if necessary.
Definition: FeedTable.h:713
A class to represent byte order information.
Definition: Misc.h:115
std::string toXML()
Produces an XML representation conform to the schema defined for Feed (FeedTable.xsd).
std::string getVersion() const
Return the version information about this table.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
FeedRow * getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId)
Returns a FeedRow* given a key.
std::string version
Definition: FeedTable.h:570
void fromIDL(asdmIDL::FeedTableIDL x)
Populate this table from the content of a FeedTableIDL Corba structure.
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.
Entity getEntity() const
Return this table&#39;s Entity.
static std::string name()
Return the name of this table.
ASDM & container
Definition: FeedTable.h:565
FeedRow * checkAndAdd(FeedRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
std::string getName() const
Return the name of this table.
std::vector< FeedRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: FeedTable.h:623
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.
virtual ~FeedTable()
std::vector< FeedRow * > getRowByFeedId(int)
Returns a vector of pointers on rows whose key element feedId is equal to the parameter feedId...
void addWithoutCheckingUnique(FeedRow *x)
Brutally append an FeedRow x to the collection of rows already stored in this table.
ASDM & getContainer() const
Return the container to which this table belongs.
std::string Key(Tag antennaId, Tag spectralWindowId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
void checkPresenceInMemory()
Definition: FeedTable.h:714
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: FeedTable.h:664
std::vector< std::vector< FeedRow * > > ID_TIME_ROWS
Definition: FeedTable.h:632
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 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 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 FeedTable class is an Alma table.
Definition: FeedTable.h:274
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 setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
FeedRow * newRow()
====&gt; Row creation.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
FeedRow * lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, std::vector< std::vector< double > > beamOffset, std::vector< std::vector< Length > > focusReference, std::vector< PolarizationTypeMod::PolarizationType > polarizationTypes, std::vector< std::vector< Complex > > polResponse, std::vector< Angle > receptorAngle, std::vector< int > receiverId)
Look up the table for a row whose all attributes except the autoincrementable one are equal to the co...
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a FeedTable as those produced by the toFile me...
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 toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
void getByKeyNoAutoIncNoTime(std::vector< FeedRow * > &vin, std::vector< FeedRow * > &vout, Tag antennaId, Tag spectralWindowId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
FeedRow * insertByStartTime(FeedRow *x, std::vector< FeedRow * > &row)
Insert a FeedRow* in a vector of FeedRow* so that it&#39;s ordered by ascending time. ...
FeedRow * add(FeedRow *x)
====&gt; Append a row to its table.
FeedTable(ASDM &container)
Create a FeedTable.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59