casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PointingTable.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 PointingTable.h
32  */
33 
34 #ifndef PointingTable_CLASS
35 #define PointingTable_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/ArrayTime.h>
53 
54 
55 
56 #include <alma/ASDM/Tag.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 
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::PointingRow;
117 
118 class ASDM;
119 class PointingRow;
277 class PointingTable : public Representable {
278  friend class ASDM;
279 
280 public:
281 
282 
288  static const std::vector<std::string>& getKeyName();
289 
290 
291  virtual ~PointingTable();
292 
298  ASDM &getContainer() const;
299 
305  unsigned int size() const;
306 
314  std::string getName() const;
315 
323  static std::string name() ;
324 
329  std::string getVersion() const ;
330 
336  static const std::vector<std::string>& getAttributesNames();
337 
343  static const std::vector<std::string>& defaultAttributesNamesInBin();
344 
348  Entity getEntity() const;
349 
354  void setEntity(Entity e);
355 
363  std::string toXML() ;
364 
365 #ifndef WITHOUT_ACS
366  // Conversion Methods
372  asdmIDL::PointingTableIDL *toIDL() ;
373 
381  void toIDL(asdmIDL::PointingTableIDL& x) const;
382 
383 #endif
384 
385 #ifndef WITHOUT_ACS
386 
392  void fromIDL(asdmIDL::PointingTableIDL x) ;
393 #endif
394 
395  //
396  // ====> Row creation.
397  //
398 
403  PointingRow *newRow();
404 
405 
435  PointingRow *newRow(Tag antennaId, ArrayTimeInterval timeInterval, int numSample, std::vector<std::vector<Angle > > encoder, bool pointingTracking, bool usePolynomials, ArrayTime timeOrigin, int numTerm, std::vector<std::vector<Angle > > pointingDirection, std::vector<std::vector<Angle > > target, std::vector<std::vector<Angle > > offset, int pointingModelId);
436 
437 
438 
452 
453  //
454  // ====> Append a row to its table.
455  //
456 
457 
474  PointingRow* add(PointingRow* x) ;
475 
476 
477 
478 
479 
480  //
481  // ====> Methods returning rows.
482  //
483 
489  std::vector<PointingRow *> get() ;
490 
497  const std::vector<PointingRow *>& get() const ;
498 
499 
510  std::vector <PointingRow*> *getByContext(Tag antennaId);
511 
512 
513 
514 
515 
527  PointingRow* getRowByKey(Tag antennaId, ArrayTimeInterval timeInterval);
528 
529 
530 
531 
532 
564  PointingRow* lookup(Tag antennaId, ArrayTimeInterval timeInterval, int numSample, std::vector<std::vector<Angle > > encoder, bool pointingTracking, bool usePolynomials, ArrayTime timeOrigin, int numTerm, std::vector<std::vector<Angle > > pointingDirection, std::vector<std::vector<Angle > > target, std::vector<std::vector<Angle > > offset, int pointingModelId);
565 
566 
567  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
568  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
569 
570 private:
571 
581 
583 
584  bool archiveAsBin; // If true archive binary else archive XML
585  bool fileAsBin ; // If true file binary else file XML
586 
587  std::string version ;
588 
590 
591 
592 
593 
594 
595 
603  PointingRow* checkAndAdd(PointingRow* x, bool skipCheckUniqueness=false) ;
604 
610  void append(PointingRow* x) ;
611 
618 
619 
620 
621 
622 
623 
631  PointingRow * insertByStartTime(PointingRow* x, std::vector<PointingRow* >& row);
632 
633 
634 
635 // A data structure to store the pointers on the table's rows.
636 
637 // In all cases we maintain a private vector of PointingRow s.
638  std::vector<PointingRow * > privateRows;
639 
640 
641 
642 
643 
644 
645 
646 
647  typedef std::vector <PointingRow* > TIME_ROWS;
648  std::map<std::string, TIME_ROWS > context;
649 
654  std::string Key(Tag antennaId) ;
655 
656 
657 
658 
664  void getByKeyNoAutoIncNoTime(std::vector <PointingRow*>& vin, std::vector <PointingRow*>& vout, Tag antennaId);
665 
666 
667 
668  void error() ; //throw(ConversionException);
669 
670 
677  void fromXML(std::string& xmlDoc) ;
678 
679  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
680 
685  void setFromMIMEFile(const std::string& directory);
686  /*
687  void openMIMEFile(const std::string& directory);
688  */
689  void setFromXMLFile(const std::string& directory);
690 
698  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
699 
700 
707  void setFromMIME(const std::string & mimeMsg);
708 
712  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
713 
723  void toFile(std::string directory);
724 
730  if (!presentInMemory && !loadInProgress) {
731  loadInProgress = true;
732  setFromFile(getContainer().getDirectory());
733  presentInMemory = true;
734  loadInProgress = false;
735  }
736  }
745  void setFromFile(const std::string& directory);
746 
747 };
748 
749 } // End namespace asdm
750 
751 #endif /* PointingTable_CLASS */
std::string getVersion() const
Return the version information about this table.
PointingRow * lookup(Tag antennaId, ArrayTimeInterval timeInterval, int numSample, std::vector< std::vector< Angle > > encoder, bool pointingTracking, bool usePolynomials, ArrayTime timeOrigin, int numTerm, std::vector< std::vector< Angle > > pointingDirection, std::vector< std::vector< Angle > > target, std::vector< std::vector< Angle > > offset, int pointingModelId)
Look up the table for a row whose all attributes are equal to the corresponding parameters of the met...
static const ByteOrder * Machine_Endianity
Definition: Misc.h:119
The PointingTable class is an Alma table.
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
bool loadInProgress
Load the table in memory if necessary.
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a PointingTable as those produced by the toFil...
void addWithoutCheckingUnique(PointingRow *x)
Brutally append an PointingRow x to the collection of rows already stored in this table...
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
std::vector< PointingRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
static std::string name()
Return the name of this 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).
struct _xmlDoc xmlDoc
Definition: Misc.h:59
The ArrayTimeInterval class aggregates an instance of ArrayTime and an instance of Interval...
std::string getName() const
Return the name of this table.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void getByKeyNoAutoIncNoTime(std::vector< PointingRow * > &vin, std::vector< PointingRow * > &vout, Tag antennaId)
Fills the vector vout (passed by reference) with pointers on elements of vin whose attributes are equ...
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...
std::vector< PointingRow * > * getByContext(Tag antennaId)
Returns all the rows sorted by ascending startTime for a given context.
A class to represent byte order information.
Definition: Misc.h:115
The ASDM class is the container for all tables.
Definition: ASDM.h:273
The PointingRow class is a row of a PointingTable.
Definition: PointingRow.h:138
PointingRow * getRowByKey(Tag antennaId, ArrayTimeInterval timeInterval)
Returns a PointingRow* given a key.
PointingRow * insertByStartTime(PointingRow *x, std::vector< PointingRow * > &row)
Insert a PointingRow* in a vector of PointingRow* so that it&#39;s ordered by ascending time...
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
PointingRow * newRow()
====&gt; Row creation.
std::vector< PointingRow * > TIME_ROWS
Entity getEntity() const
Return this table&#39;s Entity.
std::map< std::string, TIME_ROWS > context
ASDM & getContainer() const
Return the container to which this table belongs.
PointingTable(ASDM &container)
Create a PointingTable.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
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...
PointingRow * add(PointingRow *x)
====&gt; Append a row to its table.
void setEntity(Entity e)
Set this table&#39;s Entity.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
void append(PointingRow *x)
Brutally append an PointingRow x to the collection of rows already stored in this table...
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
virtual ~PointingTable()
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...
asdmIDL::PointingTableIDL * toIDL()
Conversion Methods.
std::string Key(Tag antennaId)
Returns a string built by concatenating the ascii representation of the parameters values suffixed wi...
void setUnknownAttributeBinaryReader(const std::string &attributeName, BinaryAttributeReaderFunctor *barFctr)
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 toMIME(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
unsigned int size() const
Return the number of rows in the table.
std::string toXML()
Produces an XML representation conform to the schema defined for Pointing (PointingTable.xsd).
void fromIDL(asdmIDL::PointingTableIDL x)
Populate this table from the content of a PointingTableIDL Corba structure.
PointingRow * checkAndAdd(PointingRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59
void setFromXMLFile(const std::string &directory)