SDMDataObject.h

Go to the documentation of this file.
00001 #ifndef SDMDataObject_CLASS
00002 #define SDMDataObject_CLASS
00003 
00004 #include <string>
00005 #include <set>
00006 #include <vector>
00007 #include <map>
00008 #include <sstream>
00009 
00010 #ifdef WITHOUT_ACS
00011 #else
00012 #include "almaEnumerations_IFC.h"
00013 #endif
00014 
00015 #include "SDMDataObjectPartTypes.h"
00016 
00017 #include "CAtmPhaseCorrection.h"
00018 #include "CAxisName.h"
00019 #include "CBasebandName.h"
00020 #include "CCorrelationMode.h"
00021 #include "CPrimitiveDataType.h"
00022 #include "CSpectralResolutionType.h"
00023 #include "CProcessorType.h"
00024 #include "CCorrelatorType.h"
00025 #include "CStokesParameter.h"
00026 #include "CNetSideband.h"
00027 
00028 using namespace AtmPhaseCorrectionMod;
00029 using namespace AxisNameMod;
00030 using namespace BasebandNameMod;
00031 using namespace CorrelationModeMod;
00032 using namespace PrimitiveDataTypeMod;
00033 using namespace SpectralResolutionTypeMod;
00034 using namespace ProcessorTypeMod;
00035 using namespace CorrelatorTypeMod;
00036 using namespace StokesParameterMod;
00037 using namespace NetSidebandMod;
00038 
00039 using namespace std;
00040 
00041 
00042 
00043 #ifdef REG_BASIC
00044 #undef REG_BASIC
00045 #endif
00046 
00047 #ifdef REG_EXTENDED 
00048 #undef REG_EXTENDED
00049 #endif 
00050 
00051 #ifdef REG_ICASE
00052 #undef REG_ICASE
00053 #endif
00054 
00055 #ifdef REG_NOSUB
00056 #undef REG_NOSUB
00057 #endif
00058 
00059 #ifdef REG_NEWLINE
00060 #undef REG_NEWLINE
00061 #endif
00062 
00063 #ifdef REG_NOTBOL
00064 #undef REG_NOTBOL
00065 #endif
00066 
00067 #ifdef REG_NOTEOL
00068 #undef REG_NOTEOL
00069 #endif
00070 
00071 #ifdef REG_STARTEND
00072 #undef REG_STARTEND
00073 #endif
00074 
00075 #ifdef REG_NOERROR
00076 #undef REG_NOERROR
00077 #endif
00078 
00079 #ifdef REG_NOMATCH
00080 #undef REG_NOMATCH
00081 #endif
00082 
00083 #ifdef REG_BADPAT
00084 #undef REG_BADPAT
00085 #endif
00086 
00087 #ifdef REG_ECOLLATE
00088 #undef REG_ECOLLATE
00089 #endif
00090 
00091 #include <boost/regex.hpp> 
00092 using namespace boost;
00093 
00094 #if defined(__APPLE__)
00095 #include <machine/endian.h>
00096 #else 
00097 #include <endian.h>
00098 #endif
00099 
00100 /*
00101 #include <boost/date_time/posix_time/posix_time.hpp>
00102 #include <boost/date_time/posix_time/posix_time_duration.hpp>
00103 
00104 #include <boost/date_time/gregorian/gregorian.hpp>
00105 
00106 using namespace boost::posix_time;
00107 using namespace boost::gregorian;
00108 */
00109 
00134 namespace asdmbinaries {
00135 
00139   const int SCHEMAVERSION=2;
00140 
00141 
00145   class SDMDataObjectException {
00146     
00147   public:
00151     SDMDataObjectException();
00152 
00157     SDMDataObjectException(const string& m);
00158     
00162     virtual ~SDMDataObjectException();
00163 
00168     string getMessage() const;
00169     
00170   protected:
00171     string message;
00172     
00173   };
00174 
00175   inline SDMDataObjectException::SDMDataObjectException() : message ("SDMDataObjectReaderException") {}
00176   inline SDMDataObjectException::SDMDataObjectException(const string& m) : message(m) {}
00177   inline SDMDataObjectException::~SDMDataObjectException() {}
00178   inline string SDMDataObjectException::getMessage() const {
00179     return "SDMDataObjectException : " + message;
00180   }
00181   
00191   template<class Enum, class EnumHelper> 
00192     class Optional {
00193     private:
00194     bool present_;
00195     Enum literal_;
00196     
00197     public:
00203     Optional() {
00204       present_=false;
00205     }
00206     
00214     Optional(Enum literal) {
00215       literal_ = literal;
00216       present_ = true;
00217     }
00218     
00224     bool present() const { return present_; }
00225 
00234     Enum literal() const { return literal_; }
00235   };
00236 
00242   typedef Optional<SpectralResolutionType, CSpectralResolutionType> OptionalSpectralResolutionType;
00243 
00244 
00249   class ByteOrder {
00250   public:
00251     static const ByteOrder* Little_Endian; /*< A unique object to represent a little endian byte order. */
00252     static const ByteOrder* Big_Endian;    /*< A unique object to represent a big endian byte order. */
00253     static const ByteOrder* Machine_Endianity; /*< A unique object storing the endianity of the machine. */
00254 
00263     string toString() const ;
00264 
00265   private:
00266     string name_;
00267     int endianity_;
00268 
00269     ByteOrder(const string & name, int endianity);
00270     virtual ~ByteOrder();
00271     static const ByteOrder* machineEndianity(); 
00272   };
00273 
00274   // forward declarations.
00275   class SDMDataSubset;
00276   class SDMDataObject;
00277 
00278 
00279   
00280   class SDMDataObjectReader;
00281 
00282   // SDMDataObject:: declarations
00283   //
00284 
00332   class SDMDataObject {
00333     friend class SDMDataObjectReader;
00334     friend class SDMDataObjectWriter;
00335     friend class HeaderParser;
00336     friend class SDMDataSubset;
00337     friend class CorrSubsetHeaderParser;
00338 
00339   public:
00340 
00341     // SDMDataObject::SpectralWindow:: declarations
00342     //
00355     class SpectralWindow {
00356       friend class SDMDataObject;
00357       friend class DataStruct;
00358       friend class Baseband;
00359       friend class HeaderParser;
00360 
00361     private:
00362       vector<StokesParameter> crossPolProducts_;
00363       vector<StokesParameter> sdPolProducts_;
00364       float scaleFactor_;
00365       unsigned int numSpectralPoint_;
00366       unsigned int numBin_;
00367       NetSideband sideband_;
00368       string strSw_;
00369       string strImage_;
00370       void strSw(const string& s);
00371       const string & strSw() const;
00372       void strImage(const string& s);
00373       const string & strImage() const;
00374 
00375       const SDMDataObject* owner_;
00376 
00377       void owner(const SDMDataObject* o);
00378 
00379     public:
00385       SpectralWindow();
00386 
00387 
00391       virtual ~SpectralWindow();
00392 
00396       SpectralWindow(const vector<StokesParameter>& crossPolProducts,
00397                      float scaleFactor,
00398                      unsigned int numSpectralPoint,
00399                      unsigned int numBin,
00400                      NetSideband sideband);
00401 
00405       SpectralWindow(const vector<StokesParameter>& sdPolProducts,
00406                      unsigned int numSpectralPoint,
00407                      unsigned numBin,
00408                      NetSideband sideband);
00409 
00413       SpectralWindow(const vector<StokesParameter>& crossPolProducts,
00414                      const vector<StokesParameter>& sdPolProduct,
00415                      float scaleFactor,
00416                      unsigned int numSpectralPoint,
00417                      unsigned int numBin,
00418                      NetSideband sideband);
00419 
00426       const vector<StokesParameter>& crossPolProducts() const;
00427       //void crossPolProducts(const vector<StokesParameter>& value);
00428 
00435       const vector<StokesParameter>& sdPolProducts() const;
00436       //void sdPolProducts(const vector<StokesParameter>& value);
00437 
00445       float scaleFactor() const;
00446       //void scaleFactor(float value);
00447 
00452       unsigned int numSpectralPoint() const;
00453       //void numSpectralPoint(unsigned int value);
00454 
00461       unsigned int numBin() const;
00462       //void numBin(unsigned int value);
00463 
00469       NetSidebandMod::NetSideband sideband() const;
00470 
00471     }; // SpectralWindow::
00472 
00473 
00474     // SDMDataObject::Baseband:: declarations
00475     //
00486     class Baseband {
00487       friend class SDMDataObject;
00488       friend class DataStruct;
00489       friend class HeaderParser;
00490 
00491     private:
00492       BasebandName name_;
00493       vector<SpectralWindow> spectralWindows_;
00494 
00495       const SDMDataObject* owner_;
00496 
00497       void owner(const SDMDataObject* o);
00498 
00499     public:
00505       Baseband();
00506 
00510       ~Baseband();
00511 
00515       Baseband(BasebandName name, const vector<SpectralWindow>& spectralWindows);
00516 
00521       BasebandName name() const;
00522       //void ref(BasebandName value);
00523 
00528       const vector<SpectralWindow>& spectralWindows() const;
00529       void spectralWindows(const vector<SpectralWindow>& value);
00530     }; // Baseband::
00531 
00532 
00533     // SDMDataObject::BinaryPart:: declarations
00534     //
00552     class BinaryPart {
00553       friend class DataStruct;
00554       friend class SDMDataObject;
00555       friend class HeaderParser;
00556       friend class SDMDataObjectWriter;
00557 
00558     protected:
00559       unsigned int size_;
00560       vector<AxisName> axes_;
00561 
00562       const SDMDataObject* owner_;
00563     
00564       void owner(const SDMDataObject* o);
00565     public:
00566 
00570       BinaryPart();
00571 
00575       virtual ~BinaryPart();
00576 
00580       BinaryPart( unsigned int size,
00581                   const vector<AxisName>& axes);
00582       
00587       virtual unsigned int size() const; 
00588       //      virtual void size (unsigned int value); 
00589       
00596       virtual const vector<AxisName>& axes() const ; 
00597       //      virtual void axes (const vector<AxisName>& axes); 
00598     }; // BinaryPart::
00599 
00607     class AutoDataBinaryPart : public BinaryPart {
00608       friend class DataStruct;
00609       friend class SDMDataObject;
00610       friend class HeaderParser;
00611       friend class SDMDataObjectWriter;
00612       
00613     protected:
00614       bool normalized_;
00615 
00616     public:
00620       AutoDataBinaryPart();
00621       
00625       ~AutoDataBinaryPart();
00626       
00630       AutoDataBinaryPart(unsigned int size,
00631                          const vector<AxisName>& axes,
00632                          bool normalized);
00633       
00638       virtual bool normalized() const;
00639       
00640     }; // AutoDataBinaryPart
00641     
00649     class ZeroLagsBinaryPart : public BinaryPart {
00650       friend class DataStruct;
00651       friend class SDMDataObject;
00652       friend class HeaderParser;
00653       friend class SDMDataObjectWriter;
00654 
00655     protected:
00656       CorrelatorType correlatorType_;
00657       
00658     public:
00659       
00663       ZeroLagsBinaryPart() ;
00664 
00668       ~ZeroLagsBinaryPart();
00669 
00673       ZeroLagsBinaryPart(unsigned int size,
00674                          const vector<AxisName>& axes,
00675                          CorrelatorType correlatorType);
00676 
00681       virtual CorrelatorType correlatorType() const;
00682     };
00683 
00684     // SDMDataObject::DataStruct:: declarations
00685     //
00695     class DataStruct {
00696       friend class SDMDataObject;
00697       friend class HeaderParser;
00698       friend class SDMDataObjectWriter;
00699 
00700     public:
00706       DataStruct();
00707 
00711       virtual ~DataStruct();
00712 
00732       DataStruct(const vector<AtmPhaseCorrection>& apc,
00733                  const vector<Baseband>& basebands,
00734                  const BinaryPart& flags,
00735                  const BinaryPart& actualTimes,
00736                  const BinaryPart& actualDurations,
00737                  const ZeroLagsBinaryPart& zeroLags,
00738                  const BinaryPart& crossData,
00739                  const AutoDataBinaryPart& autoData);
00740       
00741       
00746       const vector<AtmPhaseCorrection>& apc() const;
00747       //      void apc(const vector<AtmPhaseCorrection>& value);
00748 
00753       const vector<Baseband>& basebands() const;
00754       //      void basebands(const vector<Baseband>& value);
00755       
00760       const BinaryPart& flags() const;
00761       //      void flags(const BinaryPart& value);
00762 
00767       const BinaryPart& actualTimes() const;
00768       //      void actualTimes(const BinaryPart& value);
00769  
00770 
00775       const BinaryPart& actualDurations() const;
00776       //      void actualDurations(const BinaryPart& value);
00777 
00778 
00783       const ZeroLagsBinaryPart& zeroLags() const;
00784       //      void zeroLags(const BinaryPart& value);
00785 
00786 
00791       const BinaryPart& crossData() const;
00792       //      void crossData(const BinaryPart& value);
00793 
00794 
00799       const AutoDataBinaryPart& autoData() const;
00800       //      void autoData(const BinaryPart& value);
00801 
00814       void imageSPW(unsigned int ibb,
00815                     unsigned int ispw1,
00816                     unsigned int ispw2);
00817 
00829       const SpectralWindow* imageSPW(unsigned int ibb,
00830                                      unsigned int ispw) const;
00831 
00844       void imageOfSPW(unsigned int ibb,
00845                       unsigned int ispw1,
00846                       unsigned int ispw2);
00847       
00848 
00860       const SpectralWindow* imageOfSPW(unsigned int ibb,
00861                                        unsigned int ispw) const;
00862       
00863 
00864     private:
00865       vector<AtmPhaseCorrection> apc_;
00866       vector<Baseband> basebands_;
00867       BinaryPart flags_;
00868       BinaryPart actualTimes_;
00869       BinaryPart actualDurations_;
00870       ZeroLagsBinaryPart zeroLags_;
00871       BinaryPart crossData_;
00872       AutoDataBinaryPart autoData_;
00873 
00874       const SDMDataObject* owner_;
00875       void owner(const SDMDataObject* o);
00876 
00877       map<string, string> imageSPW_;
00878       map<string, string> imageOfSPW_;
00879 
00880       void checkCoordinate(unsigned int ibb, unsigned int ispw) const;
00881       bool associatedSPW(unsigned int ibb,
00882                          unsigned int ispw1,
00883                          unsigned int ispw2);
00884 
00885       void divorceSPW(unsigned int ibb, unsigned int ispw)   ;
00886 
00887     }; //DataStruct::
00888 
00889     SDMDataObject();
00890     SDMDataObject(unsigned long long startTime,
00891                   const string& dataOID,
00892                   unsigned int dimensionality,
00893                   const string& execBlockUID,
00894                   unsigned int execBlockNum,
00895                   unsigned int scanNum,
00896                   unsigned int subscanNum,
00897                   unsigned int numAntenna,
00898                   CorrelationMode correlatorMode,
00899                   const SDMDataObject::DataStruct& dataStruct);
00900 
00901     SDMDataObject(unsigned long long startTime,
00902                   const string& dataOID,
00903                   unsigned int dimensionality,
00904                   unsigned int numTime,
00905                   const string& execBlockUID,
00906                   unsigned int execBlockNum,
00907                   unsigned int scanNum,
00908                   unsigned int subscanNum,
00909                   unsigned int numAntenna,
00910                   const SDMDataObject::DataStruct& dataStruct);
00911 
00916     string title() const;
00917     void title(const string& value) ;
00918 
00923     unsigned long long startTime() const;
00924     void startTime(unsigned long long value);    
00925 
00931     unsigned int numTime() const;
00932     void numTime(unsigned int value);
00933 
00938     string dataOID() const;
00939     void dataOID(const string& value);
00940 
00941 
00946     string execBlockUID() const;
00947     void execBlockUID(const string& value);
00948 
00953     unsigned int execBlockNum() const;
00954     void execBlockNum (unsigned int value );
00955 
00960     unsigned int scanNum() const;
00961     void scanNum( unsigned int value);
00962 
00967     unsigned int subscanNum() const;
00968     void subscanNum(int value);
00969 
00974     string projectPath() const;
00975 
00981     vector<string> projectPaths() const;
00982 
00987     unsigned int numAntenna() const;
00988     void numAntenna (unsigned int value);
00989 
00994     CorrelationMode correlationMode() const;
00995 
00996 
01005     OptionalSpectralResolutionType spectralResolutionType() const;
01006 
01011     ProcessorType processorType() const;
01012 
01013 
01020     CorrelatorType correlatorType() const;
01021 
01028     bool isTP() const ;
01029 
01030 
01037     bool isCorrelation() const;
01038 
01039 
01040 
01045     const DataStruct& dataStruct() const;
01046     void dataStruct(const DataStruct& dataStruct);
01047 
01048 
01054     const vector<SDMDataSubset>& corrDataSubsets() const;
01055     void corrDataSubsets(const vector<SDMDataSubset>& value);
01056 
01065     const SDMDataSubset& sdmDataSubset(const string& projectPath) const;
01066 
01067 
01076     bool aborted();
01077 
01088     unsigned long long abortTime();
01089 
01090 
01091 
01102     string abortReason();
01103 
01104 
01110     const SDMDataSubset& tpDataSubset() const;
01111     void tpDataSubset(const SDMDataSubset& value);
01112 
01117     string toString() const;
01118 
01123     void done();
01124 
01125   private:
01126 
01127     static vector<string> correlationModeRefs;
01128     static vector<string> axes;
01129     static vector<string> types;
01130     static vector<string> apcs;
01131 
01132     const static bool _init;
01133     static bool init();
01134 
01135     // Is the SDMDataObject actually properly filled with valid data.
01136     bool valid_; 
01137 
01138     // Global header variables.
01139     string title_;
01140 
01141     const ByteOrder* byteOrder_;
01142 
01143     int schemaVersion_;
01144     
01145     long long startTime_;
01146 
01147     string dataOID_;
01148 
01149     unsigned int dimensionality_;
01150 
01151     unsigned int numTime_;
01152 
01153     string execBlockUID_;
01154 
01155     unsigned int execBlockNum_;
01156 
01157     unsigned int scanNum_;
01158 
01159     unsigned int subscanNum_;
01160 
01161     unsigned int numAntenna_;
01162 
01163     CorrelationMode correlationMode_;
01164 
01165     OptionalSpectralResolutionType spectralResolutionType_;
01166 
01167     ProcessorType processorType_;
01168 
01169     DataStruct dataStruct_;
01170 
01171     map<string, unsigned int> str2index_;
01172     
01173     vector<SDMDataSubset> dataSubsets_;
01174 
01175     bool aborted_;
01176 
01177     unsigned long long int abortTime_;
01178     string   abortReason_;
01179 
01180     void append(const SDMDataSubset& value);
01181 
01182 
01191     unsigned int dimensionality() const;
01192     void dimensionality( unsigned int value );
01193 
01194 
01198     void owns();
01199 
01200  
01205     string toXML() ;
01206     void toXML(const BinaryPart& binaryPart, const string& elementName,  ostringstream& oss) const;
01207     void toXML(const AutoDataBinaryPart& autoDataBinaryPart, const string& elementName,  ostringstream& oss) const;
01208     void toXML(const ZeroLagsBinaryPart& zeroLagsBinaryPart, const string& elementName,  ostringstream& oss) const;
01209     void spectralWindowsToXML(const vector<Baseband>& basebands, unsigned int ibb,  ostringstream& oss) const;
01210     void basebandsToXML(ostringstream& oss) const; 
01211     void dataStructToXML(ostringstream& oss) ;
01212 
01213     void updateIdImageSPW();
01214 
01215     const static regex  SPWID;
01216 
01217   };
01218   // SDMDataObject::
01219 
01220   // SDMDataSubset:: declarations
01221   //
01229   class SDMDataSubset {
01230     friend class SDMDataObject;
01231     friend class SDMDataObjectReader;
01232     friend class SDMDataObjectWriter;
01233     friend class CorrSubsetHeaderParser;
01234     friend class TPSubsetHeaderParser;
01235 
01236   public:
01237   
01238     /*
01239      * An empty constructor.
01240      */
01241     SDMDataSubset(SDMDataObject* owner= 0);
01242 
01243     SDMDataSubset(SDMDataObject* owner,
01244                   unsigned long long time,
01245                   unsigned long long interval,
01246                   const vector<float>& autoData);
01247 
01248     virtual ~SDMDataSubset();
01249 
01250     const SDMDataObject* owner() const;
01251 
01252     unsigned int integrationNum() const;
01253     
01254     unsigned int subintegrationNum() const;    
01255 
01264     string projectPath() const;
01265   
01273     unsigned long long time() const;
01274   
01279     unsigned long long interval() const;
01280 
01281 
01286     string toString(unsigned int N = 10 )const ;
01287 
01288     void binAttachToXML(const string& name, ostringstream& oss);
01289     void tpBinAttachToXML(ostringstream& oss);
01290     void corrBinAttachToXML(ostringstream& oss);
01291 
01292     void toXML(ostringstream& oss) const;
01293 
01298     string toXML();
01299 
01300 
01308     unsigned long int actualDurations(const ACTUALDURATIONSTYPE* & ptr) const;
01309 
01317     unsigned long int actualTimes(const ACTUALTIMESTYPE* & ptr) const;
01318 
01326     unsigned long int autoData(const AUTODATATYPE* & ptr) const ;
01327 
01335     unsigned long int crossData(const SHORTCROSSDATATYPE* & ptr) const;
01336 
01337 
01345     unsigned long int crossData(const INTCROSSDATATYPE* & ptr) const;
01346 
01354     unsigned long int crossData(const FLOATCROSSDATATYPE* & ptr) const;
01355 
01361     PrimitiveDataType crossDataType() const;
01362 
01363     void crossDataType(PrimitiveDataType value);
01364 
01372     unsigned long int flags(const FLAGSTYPE* &ptr) const;
01373 
01381     unsigned long int zeroLags(const ZEROLAGSTYPE* & ptr) const;
01382 
01387     bool aborted() const ; 
01388 
01394     unsigned long long abortTime() const; 
01395 
01401     string abortReason() const;
01402 
01403 
01404 
01405   private:
01406     SDMDataObject* owner_;
01407     unsigned int integrationNum_;
01408     unsigned int subintegrationNum_;
01409     CorrelationMode ref_;
01410     unsigned long long time_;
01411     unsigned long long interval_;
01412     string dataStruct_;
01413     string flagsREF_;
01414     string actualTimesREF_;
01415     string actualDurationsREF_;
01416     string zeroLagsREF_;
01417     string crossDataREF_;
01418     PrimitiveDataType crossDataType_;
01419     string autoDataREF_;
01420 
01421     const ACTUALTIMESTYPE * actualTimes_;
01422     unsigned long int nActualTimes_;
01423     const ACTUALDURATIONSTYPE * actualDurations_;
01424     unsigned long int nActualDurations_;
01425     const ZEROLAGSTYPE* zeroLags_;
01426     unsigned long int nZeroLags_;
01427     const FLAGSTYPE* flags_;    
01428     unsigned long int nFlags_;
01429     const INTCROSSDATATYPE* longCrossData_;
01430     const SHORTCROSSDATATYPE* shortCrossData_;
01431     const FLOATCROSSDATATYPE* floatCrossData_;
01432     unsigned long int nCrossData_;
01433     const AUTODATATYPE* autoData_;
01434     unsigned long int nAutoData_;
01435 
01436     string xsiType() const;
01437 
01438     bool aborted_;
01439     unsigned long long int abortTime_;
01440     string   abortReason_;
01441 
01442   };
01443   // SDMDataSubset:: declarations
01444 
01445 
01446   // Utils:: declarations
01447   //
01448   class Utils {
01449   public:
01450     static void invalidCall(const string & methodName, const SDMDataObject* sdmDataObject);
01451     static string quote(const string& s);
01452     static string quote(bool b);
01453     static string quote(int i);
01454     static string quote(unsigned int i);
01455     static string quote(long long l);
01456     static string quote(float f);
01457     static string quote(const set<string>& s);
01458     static string quote(const vector<string>& s);
01459     template<class Enum, class EnumHelper> static string quote(Enum l) {
01460       ostringstream oss;
01461       oss << "\"";
01462       oss << EnumHelper::name(l);
01463       oss << "\"";
01464       return oss.str();
01465     }
01466 
01467     template<class Enum, class EnumHelper> static string quote(const vector<Enum>& v_l) {
01468       ostringstream oss;
01469       oss << "\"";
01470 
01471       if (v_l.size() > 0)
01472         oss << EnumHelper::name(v_l.at(0));
01473 
01474       for (unsigned int i = 1; i < v_l.size(); i++)
01475         oss << " " << EnumHelper::name(v_l.at(i));
01476       oss << "\"";
01477       return oss.str();
01478     }
01479 
01480     template<class Enum, class EnumHelper> static string toString(Enum l) {
01481       ostringstream oss;
01482       oss << EnumHelper::name(l);
01483       return oss.str();
01484     }
01485 
01486     template<class Enum, class EnumHelper> static string toString(const vector<Enum>& v_l) {
01487       ostringstream oss;
01488 
01489       if (v_l.size() > 0)
01490         oss << EnumHelper::name(v_l.at(0));
01491 
01492       for (unsigned int i = 1; i < v_l.size(); i++)
01493         oss << " " << EnumHelper::name(v_l.at(i));
01494       return oss.str();
01495     }
01496 
01500     template<class Enum, class EnumHelper> static vector<Enum> enumvec(const string& strliterals) {
01501       vector<Enum> result;
01502       
01503       string strliteral;
01504       istringstream iss(strliterals);
01505       
01506       while (iss >> strliteral)
01507         result.push_back(EnumHelper::literal(strliteral));
01508       
01509       return result;
01510     }
01511 
01512 
01513     static void toXML(const string& elementName, int value, ostringstream& oss);
01514     static void toXML(const string& elementName, unsigned int value, ostringstream& oss);
01515     static void toXML(const string& elementName, long long value, ostringstream& oss);
01516     static void toXML(const string& elementName, unsigned long long value, ostringstream& oss);
01517     static void oXML(const string& elementName, ostringstream& oss);
01518     static void cXML(const string& elementName, ostringstream& oss);
01519     
01528     template<class Enum, class EnumHelper> static void toXML(const string& elementName, Enum value, ostringstream& oss) {
01529       oss << "<" << elementName << ">" << EnumHelper::name(value) << "</" << elementName << ">" << endl;      
01530     }
01531 
01532 #define QUOTE    Utils::quote
01533 #define TOSTRING Utils::toString
01534 #define TOXML    Utils::toXML
01535 #define OXML     Utils::oXML
01536 #define CXML     Utils::cXML
01537   };
01538 }
01539 #endif // SDMDataObject_CLASS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines