VR-Forces 4.0.4 Class Documentation
include/terrainDbFactory/mfRec.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 1998 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: mfRec.h,v $ $Revision: 1.21 $ $State: Exp $
00007 *******************************************************************************/
00008 #ifndef mfRec_H_
00009 #define mfRec_H_
00010 
00011 #include "terrainDbFactory/terrainDbFactoryDefines.h"
00012 #include "terrainDbFactory/terrainDefines.h"
00013 #include "geometry/gdbColor.h"
00014 #include "geometry/point.h"
00015 #include <vlutil/vlFilename.h>
00016 #include <iosfwd>
00017 #include <map>
00018 
00019 class DtTerrainInitializer;
00020 class DtSpecificationAttribute;
00021 
00022 typedef std::map<DtString, DtString> DtPropertyNamesMap;
00023 typedef DtPropertyNamesMap::iterator DtPropertyNamesIterator;
00024 typedef DtPropertyNamesMap::const_iterator DtPropertyNamesConstIterator;
00025 
00026 //
00027 // This is the base class for all metafile records.
00028 class DT_DLL_terrainDbFactory DtMetafileRecord
00029 {
00030 
00031 public:
00032 
00034    DtMetafileRecord();
00035 
00037    virtual ~DtMetafileRecord();
00038 
00040    DtMetafileRecord(const DtMetafileRecord& orig);
00041 
00043    DtMetafileRecord& operator=(const DtMetafileRecord& orig);
00044 
00046    virtual bool init();
00047 
00051    virtual DtString recordTypeName() const = 0;
00052 
00056    virtual DtConfigCategoryType recordCategory() const = 0;
00057 
00060    virtual bool canImport();
00061 
00063    virtual bool put(std::ostream& stream) const;
00064 
00066    virtual bool get(std::istream& stream);
00067 
00069    virtual bool processToken(std::istream& stream, DtString& token);
00070 
00075    virtual bool getAttribute(const DtString attrName, DtString& value, DtString& type, unsigned index=0);
00076 
00080    virtual bool setAttribute(DtString attrName, DtString value);
00081 
00083    virtual const DtTerrainInitializer* initializer() const;
00084    virtual DtTerrainInitializer* initializer();
00085 
00088    virtual void setInitializer(DtTerrainInitializer* init);
00089 
00090    virtual const int recordKey();
00091    virtual void setRecordKey(const int key);
00092 
00094    virtual const DtPropertyNamesMap properties() const;
00095 
00097    virtual const DtString& recordString() const;
00098 
00100    virtual void resetFileLists();
00101 
00103    virtual void setPath(const DtFilename&);
00104    virtual const DtFilename& path() const;
00105 
00106 protected:
00107 
00109    virtual bool writeAttributes(std::ostream& stream) const;
00110 
00113    virtual bool getAttribute(const DtString attrName, DtString& value, unsigned index=0);
00114 
00116    virtual bool setToken(const DtString& token, const DtString value);
00117 
00118 public:
00119 
00120    bool isInt(const DtString& valueIn);
00121    bool isDouble(const DtString& valueIn);
00122    bool isColor(const DtString& valueIn);
00123    bool isPoint(const DtString& valueIn);
00124    bool isBool(const DtString& valueIn);
00125 
00126    bool toInt(const DtString& valueIn, int& valueOut);
00127    bool toDouble(const DtString& valueIn, double& valueOut);
00128    bool toColor(const DtString& valueIn, DtColor& valueOut);
00129    bool toPoint(const DtString& valueIn, DtPoint& valueOut);
00130    bool toBool(const DtString& valueIn, bool& valueOut);
00131 
00132 protected:
00133 
00134    DtTerrainInitializer* mypInitializer;
00135    DtString myRecordString;
00136    int myRecordKey;                      // Unique int indentifier for the record   
00137    DtPropertyNamesMap myAttributeNames;  // The attributes that the record has
00138    bool myCanImport;
00139    DtFilename myPath;
00140 
00141 protected:
00142 
00143    static const DtString theImport;      // Used to determine whether the record is 
00144                                          // importable or not
00145 
00146 };
00147 
00148 DT_DLL_terrainDbFactory std::ostream& operator<<(std::ostream& str, const DtMetafileRecord& object);
00149 DT_DLL_terrainDbFactory std::istream& operator>>(std::istream& str, DtMetafileRecord& object);
00150 
00151 #endif
00152 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)