casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ScanTable.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 ScanTable.h
32  */
33 
34 #ifndef ScanTable_CLASS
35 #define ScanTable_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/Tag.h>
49 
50 
51 
52 
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
66 
67 
68 
70 
71 
72 
73 
74 
76 
77 
78 
80 
81 
82 
84 
85 
86 
87 
88 
89 
90 
91 
92 
93 
95 #include <alma/ASDM/DuplicateKey.h>
97 #include <alma/ASDM/NoSuchRow.h>
98 #include <alma/ASDM/DuplicateKey.h>
99 
100 
101 #ifndef WITHOUT_ACS
102 #include <asdmIDLC.h>
103 #endif
104 
105 #include <alma/ASDM/Representable.h>
106 
107 #include <pthread.h>
108 
109 namespace asdm {
110 
111 //class asdm::ASDM;
112 //class asdm::ScanRow;
113 
114 class ASDM;
115 class ScanRow;
252 class ScanTable : public Representable {
253  friend class ASDM;
254 
255 public:
256 
257 
263  static const std::vector<std::string>& getKeyName();
264 
265 
266  virtual ~ScanTable();
267 
273  ASDM &getContainer() const;
274 
280  unsigned int size() const;
281 
289  std::string getName() const;
290 
298  static std::string name() ;
299 
304  std::string getVersion() const ;
305 
311  static const std::vector<std::string>& getAttributesNames();
312 
318  static const std::vector<std::string>& defaultAttributesNamesInBin();
319 
323  Entity getEntity() const;
324 
329  void setEntity(Entity e);
330 
338  std::string toXML() ;
339 
340 #ifndef WITHOUT_ACS
341  // Conversion Methods
347  asdmIDL::ScanTableIDL *toIDL() ;
348 
356  void toIDL(asdmIDL::ScanTableIDL& x) const;
357 
358 #endif
359 
360 #ifndef WITHOUT_ACS
361 
367  void fromIDL(asdmIDL::ScanTableIDL x) ;
368 #endif
369 
370  //
371  // ====> Row creation.
372  //
373 
378  ScanRow *newRow();
379 
380 
404  ScanRow *newRow(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, std::vector<ScanIntentMod::ScanIntent > scanIntent, std::vector<CalDataOriginMod::CalDataOrigin > calDataType, std::vector<bool > calibrationOnLine);
405 
406 
407 
421 
422  //
423  // ====> Append a row to its table.
424  //
425 
426 
439  ScanRow* add(ScanRow* x) ;
440 
441 
442 
443 
444 
445  //
446  // ====> Methods returning rows.
447  //
448 
454  std::vector<ScanRow *> get() ;
455 
462  const std::vector<ScanRow *>& get() const ;
463 
464 
465 
466 
467 
479  ScanRow* getRowByKey(Tag execBlockId, int scanNumber);
480 
481 
482 
483 
484 
510  ScanRow* lookup(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, std::vector<ScanIntentMod::ScanIntent > scanIntent, std::vector<CalDataOriginMod::CalDataOrigin > calDataType, std::vector<bool > calibrationOnLine);
511 
512 
513  void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
514  BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
515 
516 private:
517 
527 
529 
530  bool archiveAsBin; // If true archive binary else archive XML
531  bool fileAsBin ; // If true file binary else file XML
532 
533  std::string version ;
534 
536 
537 
538 
539 
540 
541 
549  ScanRow* checkAndAdd(ScanRow* x, bool skipCheckUniqueness=false) ;
550 
556  void append(ScanRow* x) ;
557 
564 
565 
566 
567 
568 
569 // A data structure to store the pointers on the table's rows.
570 
571 // In all cases we maintain a private vector of ScanRow s.
572  std::vector<ScanRow * > privateRows;
573 
574 
575 
576  std::vector<ScanRow *> row;
577 
578 
579  void error() ; //throw(ConversionException);
580 
581 
588  void fromXML(std::string& xmlDoc) ;
589 
590  std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
591 
596  void setFromMIMEFile(const std::string& directory);
597  /*
598  void openMIMEFile(const std::string& directory);
599  */
600  void setFromXMLFile(const std::string& directory);
601 
609  std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
610 
611 
618  void setFromMIME(const std::string & mimeMsg);
619 
623  std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
624 
634  void toFile(std::string directory);
635 
641  if (!presentInMemory && !loadInProgress) {
642  loadInProgress = true;
643  setFromFile(getContainer().getDirectory());
644  presentInMemory = true;
645  loadInProgress = false;
646  }
647  }
656  void setFromFile(const std::string& directory);
657 
658 };
659 
660 } // End namespace asdm
661 
662 #endif /* ScanTable_CLASS */
std::map< std::string, BinaryAttributeReaderFunctor * > unknownAttributes2Functors
Definition: ScanTable.h:590
asdmIDL::ScanTableIDL * toIDL()
Conversion Methods.
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...
ScanRow * lookup(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, std::vector< ScanIntentMod::ScanIntent > scanIntent, std::vector< CalDataOriginMod::CalDataOrigin > calDataType, std::vector< bool > calibrationOnLine)
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
std::string MIMEXMLPart(const asdm::ByteOrder *byteOrder=asdm::ByteOrder::Machine_Endianity)
Private methods involved during the export of this table into disk file(s).
ScanRow * getRowByKey(Tag execBlockId, int scanNumber)
Returns a ScanRow* given a key.
std::string toXML()
Produces an XML representation conform to the schema defined for Scan (ScanTable.xsd).
BinaryAttributeReaderFunctor * getUnknownAttributeBinaryReader(const std::string &attributeName) const
struct _xmlDoc xmlDoc
Definition: Misc.h:59
void setFromFile(const std::string &directory)
Reads and parses a file containing a representation of a ScanTable as those produced by the toFile me...
static const std::vector< std::string > & getKeyName()
Return the list of field names that make up key key as an array of strings.
A class to represent byte order information.
Definition: Misc.h:115
unsigned int size() const
Return the number of rows in the table.
ScanRow * add(ScanRow *x)
====&gt; Append a row to its table.
ScanTable(ASDM &container)
Create a ScanTable.
static std::string name()
Return the name of this table.
The ASDM class is the container for all tables.
Definition: ASDM.h:273
std::string getName() const
Return the name of this table.
void checkPresenceInMemory()
Definition: ScanTable.h:640
static const std::vector< std::string > & defaultAttributesNamesInBin()
Return the default sorted list of attributes names in the binary representation of the table...
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...
virtual ~ScanTable()
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 setEntity(Entity e)
Set this table&#39;s Entity.
bool loadInProgress
Load the table in memory if necessary.
Definition: ScanTable.h:639
Entity getEntity() const
Return this table&#39;s Entity.
ASDM & getContainer() const
Return the container to which this table belongs.
void toFile(std::string directory)
Stores a representation (binary or XML) of this table into a file.
static const std::vector< std::string > & getAttributesNames()
Return the names of the attributes of this table.
void fromIDL(asdmIDL::ScanTableIDL x)
Populate this table from the content of a ScanTableIDL Corba structure.
The ArrayTime class implements the concept of a point in time, implemented as an Interval of time sin...
Definition: ArrayTime.h:89
std::string getVersion() const
Return the version information about this table.
The Tag class is an implementation of a unique index identifying a row of an ASDM table...
Definition: Tag.h:73
ScanRow * checkAndAdd(ScanRow *x, bool skipCheckUniqueness=false)
If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and...
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
ScanRow * newRow()
====&gt; Row creation.
const Double e
e and functions thereof:
std::vector< ScanRow * > row
Definition: ScanTable.h:576
void addWithoutCheckingUnique(ScanRow *x)
Brutally append an ScanRow x to the collection of rows already stored in this table.
std::vector< ScanRow * > privateRows
A data structure to store the pointers on the table&#39;s rows.
Definition: ScanTable.h:572
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...
void setFromXMLFile(const std::string &directory)
std::string version
Definition: ScanTable.h:533
ASDM & container
Definition: ScanTable.h:528
void append(ScanRow *x)
Brutally append an ScanRow x to the collection of rows already stored in this table.
The ScanTable class is an Alma table.
Definition: ScanTable.h:252
The ScanRow class is a row of a ScanTable.
Definition: ScanRow.h:131
The Entity class is an identification of a persistant entity in the ALMA archive. ...
Definition: Entity.h:59