casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GainTrackingTable.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 GainTrackingTable.h
32  */
33 
34 #ifndef GainTrackingTable_CLASS
35 #define GainTrackingTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
45 
46 
47 
48 #include <alma/ASDM/Tag.h>
49 
50 
51 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
79 #include <alma/ASDM/DuplicateKey.h>
81 #include <alma/ASDM/NoSuchRow.h>
82 #include <alma/ASDM/DuplicateKey.h>
83 
84 
85 #ifndef WITHOUT_ACS
86 #include <asdmIDLC.h>
87 #endif
88 
90 
91 #include <pthread.h>
92 
93 namespace asdm {
94 
95 //class asdm::ASDM;
96 //class asdm::GainTrackingRow;
97 
98 class ASDM;
99 class GainTrackingRow;
213  friend class ASDM;
214 
215 public:
216 
217 
223  static const std::vector<std::string>& getKeyName();
224 
225 
226  virtual ~GainTrackingTable();
227 
233  ASDM &getContainer() const;
234 
240  unsigned int size() const;
241 
249  std::string getName() const;
250 
258  static std::string name() ;
259 
264  std::string getVersion() const ;
265 
271  static const std::vector<std::string>& getAttributesNames();
272 
278  static const std::vector<std::string>& defaultAttributesNamesInBin();
279 
283  Entity getEntity() const;
284 
289  void setEntity(Entity e);
290 
298  std::string toXML() ;
299 
300 #ifndef WITHOUT_ACS
301  // Conversion Methods
307  asdmIDL::GainTrackingTableIDL *toIDL() ;
308 
316  void toIDL(asdmIDL::GainTrackingTableIDL& x) const;
317 
318 #endif
319 
320 #ifndef WITHOUT_ACS
321 
327  void fromIDL(asdmIDL::GainTrackingTableIDL x) ;
328 #endif
329 
330  //
331  // ====> Row creation.
332  //
333 
339 
340 
360  GainTrackingRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, std::vector<float > attenuator, std::vector<PolarizationTypeMod::PolarizationType > polarizationType);
361 
362 
363 
377 
378  //
379  // ====> Append a row to its table.
380  //
381 
382 
400 
401 
402 
403 
404 
405  //
406  // ====> Methods returning rows.
407  //
408 
414  std::vector<GainTrackingRow *> get() ;
415 
422  const std::vector<GainTrackingRow *>& get() const ;
423 
424 
435  std::vector <GainTrackingRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
436 
437 
438 
439 
440 
456  GainTrackingRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
457 
458 
459 
460 
461 
483  GainTrackingRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, std::vector<float > attenuator, std::vector<PolarizationTypeMod::PolarizationType > polarizationType);
484 
485 
486  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
487  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
488 
489 private:
490 
500 
502 
503  bool archiveAsBin; // If true archive binary else archive XML
504  bool fileAsBin ; // If true file binary else file XML
505 
506  std::string version ;
507 
509 
510 
511 
512 
513 
514 
522  GainTrackingRow* checkAndAdd(GainTrackingRow* x, bool skipCheckUniqueness=false) ;
523 
529  void append(GainTrackingRow* x) ;
530 
537 
538 
539 
540 
541 
542 
550  GainTrackingRow * insertByStartTime(GainTrackingRow* x, std::vector<GainTrackingRow* >& row);
551 
552 
553 
554 // A data structure to store the pointers on the table's rows.
555 
556 // In all cases we maintain a private vector of GainTrackingRow s.
557  std::vector<GainTrackingRow * > privateRows;
558 
559 
560 
561 
562 
563 
564 
565 
566  typedef std::vector <GainTrackingRow* > TIME_ROWS;
567  std::map<std::string, TIME_ROWS > context;
568 
573  std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
574 
575 
576 
577 
583  void getByKeyNoAutoIncNoTime(std::vector <GainTrackingRow*>& vin, std::vector <GainTrackingRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId);
584 
585 
586 
587  void error() ; //throw(ConversionException);
588 
589 
596  void fromXML(std::string& xmlDoc) ;
597 
598  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
599 
604  void setFromMIMEFile(const std::string& directory);
605  /*
606  void openMIMEFile(const std::string& directory);
607  */
608  void setFromXMLFile(const std::string& directory);
609 
617  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
618 
619 
626  void setFromMIME(const std::string & mimeMsg);
627 
631  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
632 
642  void toFile(std::string directory);
643 
649  if (!presentInMemory && !loadInProgress) {
650  loadInProgress = true;
651  setFromFile(getContainer().getDirectory());
652  presentInMemory = true;
653  loadInProgress = false;
654  }
655  }
664  void setFromFile(const std::string& directory);
665 
666 };
667 
668 } // End namespace asdm
669 
670 #endif /* GainTrackingTable_CLASS */
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
GainTrackingRow * lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, std::vector< float > attenuator, std::vector< PolarizationTypeMod::PolarizationType > polarizationType)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
std::string getName() const
Return the name of this table.
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
void append(GainTrackingRow *x)
Brutally append an GainTrackingRow x to the collection of rows already stored in this table...
void setFromXMLFile(const std::string &directory)
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
GainTrackingTable(ASDM &container)
Create a GainTrackingTable.
GainTrackingRow * add(GainTrackingRow *x)
====&gt; Append a row to its table.
A class to represent byte order information.
Definition: Misc.h:115
The GainTrackingRow class is a row of a GainTrackingTable.
static std::string name()
Return the name of this table.
std::vector< GainTrackingRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
GainTrackingRow * checkAndAdd(GainTrackingRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::map< std::string, TIME_ROWS > context
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
std::vector< GainTrackingRow * > * getByContext(Tag antennaId, Tag spectralWindowId, int feedId)
Returns all the rows sorted by ascending startTime for a given context.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
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...
bool loadInProgress
Load the table in memory if necessary.
std::string getVersion() const
Return the version information about this table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
GainTrackingRow * getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId)
Returns a GainTrackingRow* given a key.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a GainTrackingTable as those produced by the t...
void fromIDL(asdmIDL::GainTrackingTableIDL x)
Populate this table from the content of a GainTrackingTableIDL Corba structure.
GainTrackingRow * insertByStartTime(GainTrackingRow *x, std::vector< GainTrackingRow * > &row)
Insert a GainTrackingRow* in a vector of GainTrackingRow* so that it&#39;s ordered by ascending time...
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.
std::vector< GainTrackingRow * > TIME_ROWS
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
void getByKeyNoAutoIncNoTime(std::vector< GainTrackingRow * > &vin, std::vector< GainTrackingRow * > &vout, Tag antennaId, Tag spectralWindowId, int feedId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
std::string toXML()
Produces an XML representation conform to the schema defined for GainTracking (GainTrackingTable.xsd).
asdmIDL::GainTrackingTableIDL * toIDL()
Conversion Methods.
The GainTrackingTable class is an Alma table.
GainTrackingRow * newRow()
====&gt; Row creation.
std::string Key(Tag antennaId, Tag spectralWindowId, int feedId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
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:
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 setEntity(Entity e)
Set this table&#39;s Entity.
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...
unsigned int size() const
Return the number of rows in the table.
Entity getEntity() const
Return this table&#39;s Entity.
void addWithoutCheckingUnique(GainTrackingRow *x)
Brutally append an GainTrackingRow x to the collection of rows already stored in this table...
ASDM & getContainer() const
Return the container to which this table belongs.
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 Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59