FeedTable.h

Go to the documentation of this file.
00001 
00002 /*
00003  * ALMA - Atacama Large Millimeter Array
00004  * (c) European Southern Observatory, 2002
00005  * (c) Associated Universities Inc., 2002
00006  * Copyright by ESO (in the framework of the ALMA collaboration),
00007  * Copyright by AUI (in the framework of the ALMA collaboration),
00008  * All rights reserved.
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  * 
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023  * MA 02111-1307  USA
00024  *
00025  * Warning!
00026  *  -------------------------------------------------------------------- 
00027  * | This is generated code!  Do not modify this file.                  |
00028  * | If you do, all changes will be lost when the file is re-generated. |
00029  *  --------------------------------------------------------------------
00030  *
00031  * File FeedTable.h
00032  */
00033  
00034 #ifndef FeedTable_CLASS
00035 #define FeedTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <Angle.h>
00045         
00046 
00047         
00048 #include <Tag.h>
00049         
00050 
00051         
00052 #include <Length.h>
00053         
00054 
00055         
00056 #include <ArrayTimeInterval.h>
00057         
00058 
00059         
00060 #include <ComplexWrapper.h>
00061         
00062 
00063 
00064 
00065 
00066         
00067 
00068         
00069 
00070         
00071 
00072         
00073 
00074         
00075 
00076         
00077 #include "CPolarizationType.h"
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096 
00097 
00098 #include <ConversionException.h>
00099 #include <DuplicateKey.h>
00100 #include <UniquenessViolationException.h>
00101 #include <NoSuchRow.h>
00102 #include <DuplicateKey.h>
00103 
00104 
00105 #ifndef WITHOUT_ACS
00106 #include <asdmIDLC.h>
00107 #endif
00108 
00109 #include <Representable.h>
00110 
00111 #include <pthread.h>
00112 
00113 namespace asdm {
00114 
00115 //class asdm::ASDM;
00116 //class asdm::FeedRow;
00117 
00118 class ASDM;
00119 class FeedRow;
00274 class FeedTable : public Representable {
00275         friend class ASDM;
00276 
00277 public:
00278 
00279 
00285         static const std::vector<std::string>& getKeyName();
00286 
00287 
00288         virtual ~FeedTable();
00289         
00295         ASDM &getContainer() const;
00296         
00302         unsigned int size() const;
00303         
00311         std::string getName() const;
00312         
00320         static std::string name() ;     
00321         
00326          std::string getVersion() const ;
00327         
00333          static const std::vector<std::string>& getAttributesNames();
00334 
00340          static const std::vector<std::string>& defaultAttributesNamesInBin();
00341          
00345         Entity getEntity() const;
00346 
00351         void setEntity(Entity e);
00352                 
00360         std::string toXML()  ;
00361 
00362 #ifndef WITHOUT_ACS
00363         // Conversion Methods
00369         asdmIDL::FeedTableIDL *toIDL() ;
00370         
00378          void toIDL(asdmIDL::FeedTableIDL& x) const;
00379          
00380 #endif
00381 
00382 #ifndef WITHOUT_ACS
00383 
00389         void fromIDL(asdmIDL::FeedTableIDL x) ;
00390 #endif
00391         
00392         //
00393         // ====> Row creation.
00394         //
00395         
00400         FeedRow *newRow();
00401         
00402         
00428         FeedRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, vector<vector<double > > beamOffset, vector<vector<Length > > focusReference, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Complex > > polResponse, vector<Angle > receptorAngle, vector<int>  receiverId);
00429         
00430 
00431 
00444          FeedRow *newRow(FeedRow *row); 
00445 
00446         //
00447         // ====> Append a row to its table.
00448         //
00449 
00450         
00451          
00452         
00453         
00463          FeedRow* add(FeedRow* x) ;
00464 
00465 
00466 
00467         //
00468         // ====> Methods returning rows.
00469         //
00470                 
00476         std::vector<FeedRow *> get() ;
00477         
00484          const std::vector<FeedRow *>& get() const ;
00485         
00486 
00487 
00488  
00489         
00505         FeedRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
00506 
00507                 
00508         
00516         std::vector <FeedRow *>  getRowByFeedId(int);
00517 
00518 
00519 
00547         FeedRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, vector<vector<double > > beamOffset, vector<vector<Length > > focusReference, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Complex > > polResponse, vector<Angle > receptorAngle, vector<int>  receiverId); 
00548 
00549 
00550         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00551         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00552 
00553 private:
00554 
00563         FeedTable (ASDM & container);
00564 
00565         ASDM & container;
00566         
00567         bool archiveAsBin; // If true archive binary else archive XML
00568         bool fileAsBin ; // If true file binary else file XML   
00569         
00570         std::string version ; 
00571         
00572         Entity entity;
00573         
00574 
00575         
00576         
00577 
00578 
00588         FeedRow* checkAndAdd(FeedRow* x, bool skipCheckUniqueness=false) ;
00589         
00595          void append(FeedRow* x) ;
00596          
00602          void addWithoutCheckingUnique(FeedRow* x) ;
00603          
00604          
00605 
00606 
00607         
00608         
00616          FeedRow * insertByStartTime(FeedRow* x, std::vector<FeedRow* >& row);
00617           
00618 
00619 
00620 // A data structure to store the pointers on the table's rows.
00621 
00622 // In all cases we maintain a private vector of FeedRow s.
00623    std::vector<FeedRow * > privateRows;
00624    
00625 
00626         
00627 
00628         
00629         
00630                 
00631                 
00632         typedef std::vector <std::vector <FeedRow* > > ID_TIME_ROWS;
00633         std::map<std::string, ID_TIME_ROWS > context;
00634         
00639          std::string Key(Tag antennaId, Tag spectralWindowId) ;
00640                 
00641                 
00642         
00643         
00649         void getByKeyNoAutoIncNoTime(std::vector <FeedRow*>& vin, std::vector <FeedRow*>& vout,  Tag antennaId, Tag spectralWindowId);
00650         
00651 
00652         
00653         void error() ; //throw(ConversionException);
00654 
00655         
00662         void fromXML(std::string& xmlDoc) ;
00663                 
00664         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00665 
00670         void setFromMIMEFile(const std::string& directory);
00671         /*
00672         void openMIMEFile(const std::string& directory);
00673         */
00674         void setFromXMLFile(const std::string& directory);
00675         
00683         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00684   
00685         
00692          void setFromMIME(const std::string & mimeMsg);
00693         
00697         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00698         
00708           void toFile(std::string directory);
00709           
00713           bool loadInProgress;
00714           void checkPresenceInMemory() {
00715                 if (!presentInMemory && !loadInProgress) {
00716                         loadInProgress = true;
00717                         setFromFile(getContainer().getDirectory());
00718                         presentInMemory = true;
00719                         loadInProgress = false;
00720                 }
00721           }
00730          void setFromFile(const std::string& directory);        
00731  
00732 };
00733 
00734 } // End namespace asdm
00735 
00736 #endif /* FeedTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1