LCOV - code coverage report
Current view: top level - alma/ASDM - SysCalTable.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 7 0.0 %
Date: 2024-10-29 13:38:20 Functions: 0 1 0.0 %

          Line data    Source code
       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 SysCalTable.h
      32             :  */
      33             :  
      34             : #ifndef SysCalTable_CLASS
      35             : #define SysCalTable_CLASS
      36             : 
      37             : #include <string>
      38             : #include <vector>
      39             : #include <map>
      40             : 
      41             : 
      42             : 
      43             :         
      44             : #include <alma/ASDM/ArrayTimeInterval.h>
      45             :         
      46             : 
      47             :         
      48             : #include <alma/ASDM/Temperature.h>
      49             :         
      50             : 
      51             :         
      52             : #include <alma/ASDM/Tag.h>
      53             :         
      54             : 
      55             : 
      56             : 
      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             : 
      88             :         
      89             : 
      90             :         
      91             : 
      92             : 
      93             : 
      94             : #include <alma/ASDM/ConversionException.h>
      95             : #include <alma/ASDM/DuplicateKey.h>
      96             : #include <alma/ASDM/UniquenessViolationException.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::SysCalRow;
     113             : 
     114             : class ASDM;
     115             : class SysCalRow;
     116             : /**
     117             :  * The SysCalTable class is an Alma table.
     118             :  * <BR>
     119             :  * 
     120             :  * \par Role
     121             :  * System calibration. Gives information on the conversion  of data to temperature scale. This table is reduced to follow  the contents of the Measurement Set SysCal table. Use only spectral  values (use a single channel spectral window for single numbers).   \texttt{numChan} can be found in the SpectralWindow Table.  The contents of this table are used to scale the data in the filler.
     122             :  * <BR>
     123             :  
     124             :  * Generated from model's revision "-1", branch ""
     125             :  *
     126             :  * <TABLE BORDER="1">
     127             :  * <CAPTION> Attributes of SysCal </CAPTION>
     128             :  * <TR BGCOLOR="#AAAAAA"> <TH> Name </TH> <TH> Type </TH> <TH> Expected shape  </TH> <TH> Comment </TH></TR>
     129             :  
     130             :  * <TR> <TH BGCOLOR="#CCCCCC" colspan="4" align="center"> Key </TD></TR>
     131             :         
     132             :  * <TR>
     133             :                 
     134             :  * <TD> antennaId </TD>
     135             :                  
     136             :  * <TD> Tag</TD>
     137             :  * <TD> &nbsp; </TD>
     138             :  * <TD> &nbsp;refers to a unique row  in AntennaTable. </TD>
     139             :  * </TR>
     140             :         
     141             :  * <TR>
     142             :                 
     143             :  * <TD> spectralWindowId </TD>
     144             :                  
     145             :  * <TD> Tag</TD>
     146             :  * <TD> &nbsp; </TD>
     147             :  * <TD> &nbsp;refers to a unique row in SpectralWindowTable. </TD>
     148             :  * </TR>
     149             :         
     150             :  * <TR>
     151             :                 
     152             :  * <TD> timeInterval </TD>
     153             :                  
     154             :  * <TD> ArrayTimeInterval</TD>
     155             :  * <TD> &nbsp; </TD>
     156             :  * <TD> &nbsp;time interval for which the row's content is valid. </TD>
     157             :  * </TR>
     158             :         
     159             :  * <TR>
     160             :                 
     161             :  * <TD> feedId </TD>
     162             :                  
     163             :  * <TD> int</TD>
     164             :  * <TD> &nbsp; </TD>
     165             :  * <TD> &nbsp;refers to a collection of rows in FeedTable. </TD>
     166             :  * </TR>
     167             :         
     168             : 
     169             : 
     170             :  * <TR> <TH BGCOLOR="#CCCCCC"  colspan="4" valign="center"> Value <br> (Mandatory) </TH></TR>
     171             :         
     172             :  * <TR>
     173             :  * <TD> numReceptor (numReceptor)</TD> 
     174             :  * <TD> int </TD>
     175             :  * <TD>  &nbsp;  </TD> 
     176             :  * <TD> &nbsp;the number of receptors. </TD>
     177             :  * </TR>
     178             :         
     179             :  * <TR>
     180             :  * <TD> numChan (numChan)</TD> 
     181             :  * <TD> int </TD>
     182             :  * <TD>  &nbsp;  </TD> 
     183             :  * <TD> &nbsp;the number of frequency channels. </TD>
     184             :  * </TR>
     185             :         
     186             : 
     187             : 
     188             :  * <TR> <TH BGCOLOR="#CCCCCC"  colspan="4" valign="center"> Value <br> (Optional) </TH></TR>
     189             :         
     190             :  * <TR>
     191             :  * <TD> tcalFlag</TD> 
     192             :  * <TD> bool </TD>
     193             :  * <TD>  &nbsp; </TD>
     194             :  * <TD>&nbsp; the calibration temperature flag. </TD>
     195             :  * </TR>
     196             :         
     197             :  * <TR>
     198             :  * <TD> tcalSpectrum</TD> 
     199             :  * <TD> std::vector<std::vector<Temperature > > </TD>
     200             :  * <TD>  numReceptor, numChan  </TD>
     201             :  * <TD>&nbsp; the calibration temperatures (one value per receptor per channel). </TD>
     202             :  * </TR>
     203             :         
     204             :  * <TR>
     205             :  * <TD> trxFlag</TD> 
     206             :  * <TD> bool </TD>
     207             :  * <TD>  &nbsp; </TD>
     208             :  * <TD>&nbsp; the receiver temperature flag. </TD>
     209             :  * </TR>
     210             :         
     211             :  * <TR>
     212             :  * <TD> trxSpectrum</TD> 
     213             :  * <TD> std::vector<std::vector<Temperature > > </TD>
     214             :  * <TD>  numReceptor, numChan  </TD>
     215             :  * <TD>&nbsp; the receiver temperatures (one value per receptor per channel). </TD>
     216             :  * </TR>
     217             :         
     218             :  * <TR>
     219             :  * <TD> tskyFlag</TD> 
     220             :  * <TD> bool </TD>
     221             :  * <TD>  &nbsp; </TD>
     222             :  * <TD>&nbsp; the sky temperature flag. </TD>
     223             :  * </TR>
     224             :         
     225             :  * <TR>
     226             :  * <TD> tskySpectrum</TD> 
     227             :  * <TD> std::vector<std::vector<Temperature > > </TD>
     228             :  * <TD>  numReceptor, numChan  </TD>
     229             :  * <TD>&nbsp; the sky temperatures (one value per receptor per channel). </TD>
     230             :  * </TR>
     231             :         
     232             :  * <TR>
     233             :  * <TD> tsysFlag</TD> 
     234             :  * <TD> bool </TD>
     235             :  * <TD>  &nbsp; </TD>
     236             :  * <TD>&nbsp; the system temperature flag. </TD>
     237             :  * </TR>
     238             :         
     239             :  * <TR>
     240             :  * <TD> tsysSpectrum</TD> 
     241             :  * <TD> std::vector<std::vector<Temperature > > </TD>
     242             :  * <TD>  numReceptor, numChan  </TD>
     243             :  * <TD>&nbsp; the system temperatures (one value per receptor per channel). </TD>
     244             :  * </TR>
     245             :         
     246             :  * <TR>
     247             :  * <TD> tantFlag</TD> 
     248             :  * <TD> bool </TD>
     249             :  * <TD>  &nbsp; </TD>
     250             :  * <TD>&nbsp; the tant flag. </TD>
     251             :  * </TR>
     252             :         
     253             :  * <TR>
     254             :  * <TD> tantSpectrum</TD> 
     255             :  * <TD> std::vector<std::vector<float > > </TD>
     256             :  * <TD>  numReceptor, numChan  </TD>
     257             :  * <TD>&nbsp; the Tant spectrum (one value per receptor per channel). </TD>
     258             :  * </TR>
     259             :         
     260             :  * <TR>
     261             :  * <TD> tantTsysFlag</TD> 
     262             :  * <TD> bool </TD>
     263             :  * <TD>  &nbsp; </TD>
     264             :  * <TD>&nbsp; the Tant/Tsys flag. </TD>
     265             :  * </TR>
     266             :         
     267             :  * <TR>
     268             :  * <TD> tantTsysSpectrum</TD> 
     269             :  * <TD> std::vector<std::vector<float > > </TD>
     270             :  * <TD>  numReceptor, numChan  </TD>
     271             :  * <TD>&nbsp; the Tant/Tsys spectrum(one value per receptor per channel) . </TD>
     272             :  * </TR>
     273             :         
     274             :  * <TR>
     275             :  * <TD> phaseDiffFlag</TD> 
     276             :  * <TD> bool </TD>
     277             :  * <TD>  &nbsp; </TD>
     278             :  * <TD>&nbsp; the phase difference flag. </TD>
     279             :  * </TR>
     280             :         
     281             :  * <TR>
     282             :  * <TD> phaseDiffSpectrum</TD> 
     283             :  * <TD> std::vector<std::vector<float > > </TD>
     284             :  * <TD>  numReceptor, numChan  </TD>
     285             :  * <TD>&nbsp; the phase difference spectrum (one value per receptor per channel). </TD>
     286             :  * </TR>
     287             :         
     288             : 
     289             :  * </TABLE>
     290             :  */
     291             : class SysCalTable : public Representable {
     292             :         friend class ASDM;
     293             : 
     294             : public:
     295             : 
     296             : 
     297             :         /**
     298             :          * Return the list of field names that make up key key
     299             :          * as an array of strings.
     300             :          * @return a vector of string.
     301             :          */     
     302             :         static const std::vector<std::string>& getKeyName();
     303             : 
     304             : 
     305             :         virtual ~SysCalTable();
     306             :         
     307             :         /**
     308             :          * Return the container to which this table belongs.
     309             :          *
     310             :          * @return the ASDM containing this table.
     311             :          */
     312             :         ASDM &getContainer() const;
     313             :         
     314             :         /**
     315             :          * Return the number of rows in the table.
     316             :          *
     317             :          * @return the number of rows in an unsigned int.
     318             :          */
     319             :         unsigned int size() const;
     320             :         
     321             :         /**
     322             :          * Return the name of this table.
     323             :          *
     324             :          * This is a instance method of the class.
     325             :          *
     326             :          * @return the name of this table in a string.
     327             :          */
     328             :         std::string getName() const;
     329             :         
     330             :         /**
     331             :          * Return the name of this table.
     332             :          *
     333             :          * This is a static method of the class.
     334             :          *
     335             :          * @return the name of this table in a string.
     336             :          */
     337             :         static std::string name() ;     
     338             :         
     339             :         /**
     340             :          * Return the version information about this table.
     341             :          *
     342             :          */
     343             :          std::string getVersion() const ;
     344             :         
     345             :         /**
     346             :          * Return the names of the attributes of this table.
     347             :          *
     348             :          * @return a vector of string
     349             :          */
     350             :          static const std::vector<std::string>& getAttributesNames();
     351             : 
     352             :         /**
     353             :          * Return the default sorted list of attributes names in the binary representation of the table.
     354             :          *
     355             :          * @return a const reference to a vector of string
     356             :          */
     357             :          static const std::vector<std::string>& defaultAttributesNamesInBin();
     358             :          
     359             :         /**
     360             :          * Return this table's Entity.
     361             :          */
     362             :         Entity getEntity() const;
     363             : 
     364             :         /**
     365             :          * Set this table's Entity.
     366             :          * @param e An entity. 
     367             :          */
     368             :         void setEntity(Entity e);
     369             :                 
     370             :         /**
     371             :          * Produces an XML representation conform
     372             :          * to the schema defined for SysCal (SysCalTable.xsd).
     373             :          *
     374             :          * @returns a string containing the XML representation.
     375             :          * @throws ConversionException
     376             :          */
     377             :         std::string toXML()  ;
     378             : 
     379             : #ifndef WITHOUT_ACS
     380             :         // Conversion Methods
     381             :         /**
     382             :          * Convert this table into a SysCalTableIDL CORBA structure.
     383             :          *
     384             :          * @return a pointer to a SysCalTableIDL
     385             :          */
     386             :         asdmIDL::SysCalTableIDL *toIDL() ;
     387             :         
     388             :         /**
     389             :          * Fills the CORBA data structure passed in parameter
     390             :          * with the content of this table.
     391             :          *
     392             :          * @param x a reference to the asdmIDL::SysCalTableIDL to be populated
     393             :          * with the content of this.
     394             :          */
     395             :          void toIDL(asdmIDL::SysCalTableIDL& x) const;
     396             :          
     397             : #endif
     398             : 
     399             : #ifndef WITHOUT_ACS
     400             :         /**
     401             :          * Populate this table from the content of a SysCalTableIDL Corba structure.
     402             :          *
     403             :          * @throws DuplicateKey Thrown if the method tries to add a row having a key that is already in the table.
     404             :          * @throws ConversionException
     405             :          */     
     406             :         void fromIDL(asdmIDL::SysCalTableIDL x) ;
     407             : #endif
     408             :         
     409             :         //
     410             :         // ====> Row creation.
     411             :         //
     412             :         
     413             :         /**
     414             :          * Create a new row with default values.
     415             :          * @return a pointer on a SysCalRow
     416             :          */
     417             :         SysCalRow *newRow();
     418             :         
     419             :         
     420             :         /**
     421             :          * Create a new row initialized to the specified values.
     422             :          * @return a pointer on the created and initialized row.
     423             :         
     424             :          * @param antennaId
     425             :         
     426             :          * @param spectralWindowId
     427             :         
     428             :          * @param timeInterval
     429             :         
     430             :          * @param feedId
     431             :         
     432             :          * @param numReceptor
     433             :         
     434             :          * @param numChan
     435             :         
     436             :      */
     437             :         SysCalRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, int numChan);
     438             :         
     439             : 
     440             : 
     441             :         /**
     442             :          * Create a new row using a copy constructor mechanism.
     443             :          * 
     444             :          * The method creates a new SysCalRow owned by this. Each attribute of the created row 
     445             :          * is a (deep) copy of the corresponding attribute of row. The method does not add 
     446             :          * the created row to this, its simply parents it to this, a call to the add method
     447             :          * has to be done in order to get the row added (very likely after having modified
     448             :          * some of its attributes).
     449             :          * If row is null then the method returns a new SysCalRow with default values for its attributes. 
     450             :          *
     451             :          * @param row the row which is to be copied.
     452             :          */
     453             :          SysCalRow *newRow(SysCalRow *row); 
     454             : 
     455             :         //
     456             :         // ====> Append a row to its table.
     457             :         //
     458             :  
     459             :         
     460             :         /**
     461             :          * Add a row.
     462             :          * @param x a pointer to the SysCalRow to be added.
     463             :          *
     464             :          * @return a pointer to a SysCalRow. If the table contains a SysCalRow whose attributes (key and mandatory values) are equal to x ones
     465             :          * then returns a pointer on that SysCalRow, otherwise returns x.
     466             :          *
     467             :          * @throw DuplicateKey { thrown when the table contains a SysCalRow with a key equal to the x one but having
     468             :          * and a value section different from x one }
     469             :          *
     470             :         
     471             :          * @note The row is inserted in the table in such a way that all the rows having the same value of
     472             :          * ( antennaId, spectralWindowId, feedId ) are stored by ascending time.
     473             :          * @see method getByContext.
     474             :         
     475             :          */
     476             :         SysCalRow* add(SysCalRow* x) ; 
     477             : 
     478             :  
     479             : 
     480             : 
     481             : 
     482             :         //
     483             :         // ====> Methods returning rows.
     484             :         //
     485             :                 
     486             :         /**
     487             :          * Get a collection of pointers on the rows of the table.
     488             :          * @return Alls rows in a vector of pointers of SysCalRow. The elements of this vector are stored in the order 
     489             :          * in which they have been added to the SysCalTable.
     490             :          */
     491             :         std::vector<SysCalRow *> get() ;
     492             :         
     493             :         /**
     494             :          * Get a const reference on the collection of rows pointers internally hold by the table.
     495             :          * @return A const reference of a vector of pointers of SysCalRow. The elements of this vector are stored in the order 
     496             :          * in which they have been added to the SysCalTable.
     497             :          *
     498             :          */
     499             :          const std::vector<SysCalRow *>& get() const ;
     500             :         
     501             : 
     502             :         /**
     503             :          * Returns all the rows sorted by ascending startTime for a given context. 
     504             :          * The context is defined by a value of ( antennaId, spectralWindowId, feedId ).
     505             :          *
     506             :          * @return a pointer on a vector<SysCalRow *>. A null returned value means that the table contains
     507             :          * no SysCalRow for the given ( antennaId, spectralWindowId, feedId ).
     508             :          *
     509             :          * @throws IllegalAccessException when a call is done to this method when it's called while the dataset has been imported with the 
     510             :          * option checkRowUniqueness set to false.
     511             :          */
     512             :          std::vector <SysCalRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
     513             :          
     514             : 
     515             : 
     516             :  
     517             :         
     518             :         /**
     519             :          * Returns a SysCalRow* given a key.
     520             :          * @return a pointer to the row having the key whose values are passed as parameters, or 0 if
     521             :          * no row exists for that key.
     522             :         
     523             :          * @param antennaId
     524             :         
     525             :          * @param spectralWindowId
     526             :         
     527             :          * @param timeInterval
     528             :         
     529             :          * @param feedId
     530             :         
     531             :          *
     532             :          */
     533             :         SysCalRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
     534             : 
     535             :                 
     536             : 
     537             : 
     538             : 
     539             :         /**
     540             :          * Look up the table for a row whose all attributes 
     541             :          * are equal to the corresponding parameters of the method.
     542             :          * @return a pointer on this row if any, null otherwise.
     543             :          *
     544             :                         
     545             :          * @param antennaId
     546             :                         
     547             :          * @param spectralWindowId
     548             :                         
     549             :          * @param timeInterval
     550             :                         
     551             :          * @param feedId
     552             :                         
     553             :          * @param numReceptor
     554             :                         
     555             :          * @param numChan
     556             :                          
     557             :          */
     558             :         SysCalRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, int numChan); 
     559             : 
     560             : 
     561             :         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
     562             :         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
     563             : 
     564             : private:
     565             : 
     566             :         /**
     567             :          * Create a SysCalTable.
     568             :          * <p>
     569             :          * This constructor is private because only the
     570             :          * container can create tables.  All tables must know the container
     571             :          * to which they belong.
     572             :          * @param container The container to which this table belongs.
     573             :          */ 
     574             :         SysCalTable (ASDM & container);
     575             : 
     576             :         ASDM & container;
     577             :         
     578             :         bool archiveAsBin; // If true archive binary else archive XML
     579             :         bool fileAsBin ; // If true file binary else file XML   
     580             :         
     581             :         std::string version ; 
     582             :         
     583             :         Entity entity;
     584             :         
     585             : 
     586             :         
     587             :         
     588             : 
     589             : 
     590             :         /**
     591             :          * If this table has an autoincrementable attribute then check if *x verifies the rule of uniqueness and throw exception if not.
     592             :          * Check if *x verifies the key uniqueness rule and throw an exception if not.
     593             :          * Append x to its table.
     594             :          * @throws DuplicateKey
     595             :          
     596             :          */
     597             :         SysCalRow* checkAndAdd(SysCalRow* x, bool skipCheckUniqueness=false) ;
     598             :         
     599             :         /**
     600             :          * Brutally append an SysCalRow x to the collection of rows already stored in this table. No uniqueness check is done !
     601             :          *
     602             :          * @param SysCalRow* x a pointer onto the SysCalRow to be appended.
     603             :          */
     604             :          void append(SysCalRow* x) ;
     605             :          
     606             :         /**
     607             :          * Brutally append an SysCalRow x to the collection of rows already stored in this table. No uniqueness check is done !
     608             :          *
     609             :          * @param SysCalRow* x a pointer onto the SysCalRow to be appended.
     610             :          */
     611             :          void addWithoutCheckingUnique(SysCalRow* x) ;
     612             :          
     613             :          
     614             : 
     615             : 
     616             :         
     617             :         
     618             :         /**
     619             :          * Insert a SysCalRow* in a vector of SysCalRow* so that it's ordered by ascending time.
     620             :          *
     621             :          * @param SysCalRow* x . The pointer to be inserted.
     622             :          * @param vector <SysCalRow*>& row . A reference to the vector where to insert x.
     623             :          *
     624             :          */
     625             :          SysCalRow * insertByStartTime(SysCalRow* x, std::vector<SysCalRow* >& row);
     626             :           
     627             : 
     628             : 
     629             : // A data structure to store the pointers on the table's rows.
     630             : 
     631             : // In all cases we maintain a private vector of SysCalRow s.
     632             :    std::vector<SysCalRow * > privateRows;
     633             :    
     634             : 
     635             :         
     636             : 
     637             :         
     638             :         
     639             :                 
     640             :                                 
     641             :         typedef std::vector <SysCalRow* > TIME_ROWS;
     642             :         std::map<std::string, TIME_ROWS > context;
     643             :                 
     644             :         /** 
     645             :          * Returns a string built by concatenating the ascii representation of the
     646             :          * parameters values suffixed with a "_" character.
     647             :          */
     648             :          std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
     649             :                  
     650             :                 
     651             :         
     652             :         
     653             :         /**
     654             :          * Fills the vector vout (passed by reference) with pointers on elements of vin 
     655             :          * whose attributes are equal to the corresponding parameters of the method.
     656             :          *
     657             :          */
     658             :         void getByKeyNoAutoIncNoTime(std::vector <SysCalRow*>& vin, std::vector <SysCalRow*>& vout,  Tag antennaId, Tag spectralWindowId, int feedId);
     659             :         
     660             : 
     661             :         
     662             :         void error() ; //throw(ConversionException);
     663             : 
     664             :         
     665             :         /**
     666             :          * Populate this table from the content of a XML document that is required to
     667             :          * be conform to the XML schema defined for a SysCal (SysCalTable.xsd).
     668             :          * @throws ConversionException
     669             :          * 
     670             :          */
     671             :         void fromXML(std::string& xmlDoc) ;
     672             :                 
     673             :         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
     674             : 
     675             :         /**
     676             :           * Private methods involved during the build of this table out of the content
     677             :           * of file(s) containing an external representation of a SysCal table.
     678             :           */
     679             :         void setFromMIMEFile(const std::string& directory);
     680             :         /*
     681             :         void openMIMEFile(const std::string& directory);
     682             :         */
     683             :         void setFromXMLFile(const std::string& directory);
     684             :         
     685             :                  /**
     686             :          * Serialize this into a stream of bytes and encapsulates that stream into a MIME message.
     687             :          * @returns a string containing the MIME message.
     688             :          *
     689             :          * @param byteOrder a const pointer to a static instance of the class ByteOrder.
     690             :          * 
     691             :          */
     692             :         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
     693             :   
     694             :         
     695             :    /** 
     696             :      * Extracts the binary part of a MIME message and deserialize its content
     697             :          * to fill this with the result of the deserialization. 
     698             :          * @param mimeMsg the string containing the MIME message.
     699             :          * @throws ConversionException
     700             :          */
     701             :          void setFromMIME(const std::string & mimeMsg);
     702             :         
     703             :         /**
     704             :           * Private methods involved during the export of this table into disk file(s).
     705             :           */
     706             :         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
     707             :         
     708             :         /**
     709             :           * Stores a representation (binary or XML) of this table into a file.
     710             :           *
     711             :           * Depending on the boolean value of its private field fileAsBin a binary serialization  of this (fileAsBin==true)  
     712             :           * will be saved in a file "SysCal.bin" or an XML representation (fileAsBin==false) will be saved in a file "SysCal.xml".
     713             :           * The file is always written in a directory whose name is passed as a parameter.
     714             :          * @param directory The name of directory  where the file containing the table's representation will be saved.
     715             :           * 
     716             :           */
     717             :           void toFile(std::string directory);
     718             :           
     719             :           /**
     720             :            * Load the table in memory if necessary.
     721             :            */
     722             :           bool loadInProgress;
     723           0 :           void checkPresenceInMemory() {
     724           0 :                 if (!presentInMemory && !loadInProgress) {
     725           0 :                         loadInProgress = true;
     726           0 :                         setFromFile(getContainer().getDirectory());
     727           0 :                         presentInMemory = true;
     728           0 :                         loadInProgress = false;
     729             :                 }
     730           0 :           }
     731             :         /**
     732             :          * Reads and parses a file containing a representation of a SysCalTable as those produced  by the toFile method.
     733             :          * This table is populated with the result of the parsing.
     734             :          * @param directory The name of the directory containing the file te be read and parsed.
     735             :          * @throws ConversionException If any error occurs while reading the 
     736             :          * files in the directory or parsing them.
     737             :          *
     738             :          */
     739             :          void setFromFile(const std::string& directory);    
     740             :  
     741             : };
     742             : 
     743             : } // End namespace asdm
     744             : 
     745             : #endif /* SysCalTable_CLASS */

Generated by: LCOV version 1.16