casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TotalPowerTable.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 TotalPowerTable.h
32  */
33 
34 #ifndef TotalPowerTable_CLASS
35 #define TotalPowerTable_CLASS
36 
37 #include <string>
38 #include <vector>
39 #include <map>
40 
41 
42 
43 
44 #include <alma/ASDM/ArrayTime.h>
45 
46 
47 
48 #include <alma/ASDM/Length.h>
49 
50 
51 
52 #include <alma/ASDM/Tag.h>
53 
54 
55 
56 #include <alma/ASDM/Interval.h>
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73 
74 
75 
76 
77 
78 
79 
80 
81 
82 
83 
84 
85 
86 
87 
89 #include <alma/ASDM/DuplicateKey.h>
91 #include <alma/ASDM/NoSuchRow.h>
92 #include <alma/ASDM/DuplicateKey.h>
93 
94 
95 #ifndef WITHOUT_ACS
96 #include <asdmIDLC.h>
97 #endif
98 
100 
101 #include <pthread.h>
102 
103 namespace asdm {
104 
105 //class asdm::ASDM;
106 //class asdm::TotalPowerRow;
107 
108 class ASDM;
109 class TotalPowerRow;
256  friend class ASDM;
257 
258 public:
259 
260 
266  static const std::vector<std::string>& getKeyName();
267 
268 
269  virtual ~TotalPowerTable();
270 
276  ASDM &getContainer() const;
277 
283  unsigned int size() const;
284 
292  std::string getName() const;
293 
301  static std::string name() ;
302 
307  std::string getVersion() const ;
308 
314  static const std::vector<std::string>& getAttributesNames();
315 
321  static const std::vector<std::string>& defaultAttributesNamesInBin();
322 
326  Entity getEntity() const;
327 
332  void setEntity(Entity e);
333 
341  std::string toXML() ;
342 
343 #ifndef WITHOUT_ACS
344  // Conversion Methods
350  asdmIDL::TotalPowerTableIDL *toIDL() ;
351 
359  void toIDL(asdmIDL::TotalPowerTableIDL& x) const;
360 
361 #endif
362 
363 #ifndef WITHOUT_ACS
364 
370  void fromIDL(asdmIDL::TotalPowerTableIDL x) ;
371 #endif
372 
373  //
374  // ====> Row creation.
375  //
376 
382 
383 
419  TotalPowerRow *newRow(ArrayTime time, Tag configDescriptionId, Tag fieldId, int scanNumber, int subscanNumber, int integrationNumber, std::vector<std::vector<Length > > uvw, std::vector<std::vector<Interval > > exposure, std::vector<std::vector<ArrayTime > > timeCentroid, std::vector<std::vector<std::vector<float > > > floatData, std::vector<int > flagAnt, std::vector<std::vector<int > > flagPol, Interval interval, std::vector<Tag> stateId, Tag execBlockId);
420 
421 
422 
436 
437  //
438  // ====> Append a row to its table.
439  //
440 
441 
459 
460 
461 
462 
463 
464  //
465  // ====> Methods returning rows.
466  //
467 
473  std::vector<TotalPowerRow *> get() ;
474 
481  const std::vector<TotalPowerRow *>& get() const ;
482 
483 
494  std::vector <TotalPowerRow*> *getByContext(Tag configDescriptionId, Tag fieldId);
495 
496 
497 
498 
499 
513  TotalPowerRow* getRowByKey(ArrayTime time, Tag configDescriptionId, Tag fieldId);
514 
515 
516 
517 
518 
556  TotalPowerRow* lookup(ArrayTime time, Tag configDescriptionId, Tag fieldId, int scanNumber, int subscanNumber, int integrationNumber, std::vector<std::vector<Length > > uvw, std::vector<std::vector<Interval > > exposure, std::vector<std::vector<ArrayTime > > timeCentroid, std::vector<std::vector<std::vector<float > > > floatData, std::vector<int > flagAnt, std::vector<std::vector<int > > flagPol, Interval interval, std::vector<Tag> stateId, Tag execBlockId);
557 
558 
559  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
560  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
561 
562 private:
563 
573 
575 
576  bool archiveAsBin; // If true archive binary else archive XML
577  bool fileAsBin ; // If true file binary else file XML
578 
579  std::string version ;
580 
582 
583 
584 
585 
586 
587 
595  TotalPowerRow* checkAndAdd(TotalPowerRow* x, bool skipCheckUniqueness=false) ;
596 
602  void append(TotalPowerRow* x) ;
603 
610 
611 
612 
613 
614 
615 
623  TotalPowerRow * insertByTime(TotalPowerRow* x, std::vector<TotalPowerRow *>&row );
624 
625 
626 
627 // A data structure to store the pointers on the table's rows.
628 
629 // In all cases we maintain a private vector of TotalPowerRow s.
630  std::vector<TotalPowerRow * > privateRows;
631 
632 
633 
634 
635 
636 
637 
638 
639  typedef std::vector <TotalPowerRow* > TIME_ROWS;
640  std::map<std::string, TIME_ROWS > context;
641 
646  std::string Key(Tag configDescriptionId, Tag fieldId) ;
647 
648 
649 
650 
656  void getByKeyNoAutoIncNoTime(std::vector <TotalPowerRow*>& vin, std::vector <TotalPowerRow*>& vout, Tag configDescriptionId, Tag fieldId);
657 
658 
659 
660  void error() ; //throw(ConversionException);
661 
662 
669  void fromXML(std::string& xmlDoc) ;
670 
671  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
672 
677  void setFromMIMEFile(const std::string& directory);
678  /*
679  void openMIMEFile(const std::string& directory);
680  */
681  void setFromXMLFile(const std::string& directory);
682 
690  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
691 
692 
699  void setFromMIME(const std::string & mimeMsg);
700 
704  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
705 
715  void toFile(std::string directory);
716 
722  if (!presentInMemory && !loadInProgress) {
723  loadInProgress = true;
724  setFromFile(getContainer().getDirectory());
725  presentInMemory = true;
726  loadInProgress = false;
727  }
728  }
737  void setFromFile(const std::string& directory);
738 
739 };
740 
741 } // End namespace asdm
742 
743 #endif /* TotalPowerTable_CLASS */
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a TotalPowerTable as those produced by the toF...
bool loadInProgress
Load the table in memory if necessary.
Entity getEntity() const
Return this table&#39;s Entity.
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
The Interval class implements an interval of time in units of nanoseconds.
Definition: Interval.h:58
TotalPowerTable(ASDM &container)
Create a TotalPowerTable.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
TotalPowerRow * lookup(ArrayTime time, Tag configDescriptionId, Tag fieldId, int scanNumber, int subscanNumber, int integrationNumber, std::vector< std::vector< Length > > uvw, std::vector< std::vector< Interval > > exposure, std::vector< std::vector< ArrayTime > > timeCentroid, std::vector< std::vector< std::vector< float > > > floatData, std::vector< int > flagAnt, std::vector< std::vector< int > > flagPol, Interval interval, std::vector< Tag > stateId, Tag execBlockId)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
TotalPowerRow * add(TotalPowerRow *x)
====&gt; Append a row to its table.
struct _xmlDoc xmlDoc
Definition: Misc.h:59
A class to represent byte order information.
Definition: Misc.h:115
std::string Key(Tag configDescriptionId, Tag fieldId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
The ASDM class is the container for all tables.
Definition: ASDM.h:273
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
virtual ~TotalPowerTable()
TotalPowerRow * newRow()
====&gt; Row creation.
TotalPowerRow * insertByTime(TotalPowerRow *x, std::vector< TotalPowerRow * > &row)
Insert a TotalPowerRow* in a vector of TotalPowerRow* so that it&#39;s ordered by ascending time...
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
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::TotalPowerTableIDL x)
Populate this table from the content of a TotalPowerTableIDL Corba structure.
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 addWithoutCheckingUnique(TotalPowerRow *x)
Brutally append an TotalPowerRow x to the collection of rows already stored in this table...
static std::string name()
Return the name of this table.
std::map< std::string, TIME_ROWS > context
TotalPowerRow * checkAndAdd(TotalPowerRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
asdmIDL::TotalPowerTableIDL * toIDL()
Conversion Methods.
TotalPowerRow * getRowByKey(ArrayTime time, Tag configDescriptionId, Tag fieldId)
Returns a TotalPowerRow* given a key.
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 ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void getByKeyNoAutoIncNoTime(std::vector< TotalPowerRow * > &vin, std::vector< TotalPowerRow * > &vout, Tag configDescriptionId, Tag fieldId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
void setEntity(Entity e)
Set this table&#39;s Entity.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
std::string getVersion() const
Return the version information about this table.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
std::string getName() const
Return the name of this table.
void setFromXMLFile(const std::string &directory)
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
The TotalPowerRow class is a row of a TotalPowerTable.
const Double e
e and functions thereof:
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
void append(TotalPowerRow *x)
Brutally append an TotalPowerRow x to the collection of rows already stored in this table...
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
The TotalPowerTable class is an Alma table.
std::vector< TotalPowerRow * > 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 TotalPower (TotalPowerTable.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...
std::vector< TotalPowerRow * > * getByContext(Tag configDescriptionId, Tag fieldId)
Returns all the rows sorted by ascending startTime for a given context.
std::vector< TotalPowerRow * > TIME_ROWS
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...
ASDM & getContainer() const
Return the container to which this table belongs.
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59