VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtSchemaManager.h
Go to the documentation of this file.
00001 /****************************************************************************** 
00002 ** Copyright (c) 2010 MAK Technologies, Inc. 
00003 ** All rights reserved. 
00004 ******************************************************************************/ 
00005 /****************************************************************************** 
00006 ** $RCSfile: DtSchemaManager.h,v $ $Revision: 1.16 $ $State: Exp $ 
00007 ******************************************************************************/ 
00008  
00012  
00013 #pragma once
00014 
00015 #include <vrvCore/vrvCore.h> 
00016 #include <vrvCore/DtSettingsBackup.h> 
00017 #include <makArchives/DtSchema.h>
00018 #include <vrvUtil/DtVirtualBaseClass.h>
00019 
00020 #include <string>
00021 #include <set>
00022 
00023 #include <boost/signal.hpp>
00024 
00025 namespace makVrv 
00026 { 
00027    class DtDe;
00028    class DtSchemaManager;
00029    class DtSchemaManagerSignaler;
00030 
00033    class DT_DLL_VRVCORE DtSchemaSettingsBackup : public DtSettingsBackup
00034    {
00035    public:
00036       DtSchemaSettingsBackup();
00037       DtSchemaSettingsBackup(const DtSchemaSettingsBackup&);
00038       DtSchemaSettingsBackup(DtDe* de, DtSchemaManager*);
00039 
00040       virtual ~DtSchemaSettingsBackup();
00041 
00042    protected:
00044       virtual void restore(const DtSettingsBackup* from);
00045 
00048       virtual std::string backupClassType() const;
00049 
00051       virtual void saveSchema();
00052 
00055       virtual DtSettingsBackup* create() const;
00056 
00059       virtual void write(boost::archive::xml_oarchive& ar);
00060 
00063       virtual void read(boost::archive::xml_iarchive& ar);
00064 
00065    public:
00066       const makArchives::DtSchema& restoredSchema() const
00067       {
00068          return myRestoredSchema;
00069       }
00070 
00071    protected:
00072       DtDe*                 myDe;
00073       DtSchemaManager*      mySchemaManager;
00074       makArchives::DtSchema myRestoredSchema;
00075    };
00076 
00081    class DT_DLL_VRVCORE DtSchemaManager
00082    { 
00083    public:
00084       friend class DtSchemaManagerCreator;
00085 
00086       typedef std::set<int> PossibleSchemaValues;
00087 
00088       enum SchemaTypes
00089       {
00090          ModelDefinitionSchema,
00091          VisualDefinitionSchema
00092       };
00093 
00095       virtual ~DtSchemaManager();
00096 
00098       virtual void addSchemaEntry(const makArchives::DtSchemaEntry& schema);
00099 
00102       virtual bool removeSchemaEntry(const std::string&);
00103       
00106       virtual makArchives::DtSchemaEntry* findSchemaEntry(
00107          const std::string& schemaName);
00108 
00111       virtual const makArchives::DtSchemaEntry* findSchemaEntry(
00112          const std::string& schemaName) const;
00113 
00115       virtual void merge(const makArchives::DtSchema& schema);
00116 
00118       virtual void replace(const makArchives::DtSchema& schema);
00119 
00121       virtual void exportSchemas(const std::set<std::string>& schemaNames,
00122          const std::string& filename) const;
00123 
00127       virtual bool renameSchemaEntry(
00128          const std::string& oldName, const std::string& newName);
00129 
00131       const makArchives::DtSchema& schema() const;
00132 
00134       virtual std::string schemaName() const;
00135 
00139       virtual bool renameSchemaParameter(const std::string& schema,
00140          const std::string& oldName, const std::string& newName);
00141 
00143       virtual void addPossibleSchemaValue(int schema);
00144 
00146       virtual PossibleSchemaValues possibleSchemaValues() const;
00147 
00149       virtual void removePossibleSchemaValue(int schema);
00150 
00152       virtual void loadSchemas();
00153 
00155       virtual bool loadSchema( const std::string& filepath);
00156 
00158       virtual void saveSchema();
00159 
00161       virtual void saveSchemaAs(const std::string& filepath);
00162 
00166       virtual bool importSchema(const std::string& filepath,
00167          bool mergeSchema);
00168 
00170       virtual DtSchemaSettingsBackup& settingsBackup();
00171 
00173       virtual void backup();
00174 
00175    protected:
00176 
00178       DtSchemaManager(DtDe&);
00179 
00181       virtual void saveSchema(const makArchives::DtSchema& schema,
00182          const std::string& file) const;
00183 
00184    protected:
00186       DtDe& myDe;
00187 
00189       DtSchemaManagerSignaler& mySignaler;
00190 
00192       makArchives::DtSchema myModelDefinitionSchema;
00193 
00195       DtSchemaSettingsBackup myModelDefinitionSchemaBackup;
00196 
00198       PossibleSchemaValues myPossibleSchemaValues;
00199    }; 
00200 
00203    class DT_DLL_VRVCORE DtSchemaManagerSignaler : public DtVirtualBaseClass
00204    {
00205    public:
00206 
00208       static DtSchemaManagerSignaler& instance(DtDe& de);
00209 
00211       virtual ~DtSchemaManagerSignaler();
00212 
00214       boost::signal<void (const std::string&)> signal_schemaEntryAdded;
00215 
00217       boost::signal<void (const std::string&)> signal_schemaEntryRemoved;
00218 
00220       boost::signal<void (const std::string&)> signal_schemaEntryToBeRemoved;
00221 
00224       boost::signal<void (const std::string&, const std::string&)>
00225          signal_schemaEntryRenamed;
00226 
00229       boost::signal<
00230          void (const std::string&, const std::string&, const std::string)>
00231          signal_schemaParameterRenamed;
00232 
00233    protected:
00235       DtSchemaManagerSignaler();
00236 
00237    };
00238 
00241    class DT_DLL_VRVCORE DtSchemaManagerCreator : public DtVirtualBaseClass
00242    {
00243    public:
00245       DtSchemaManagerCreator();
00246 
00248       virtual ~DtSchemaManagerCreator();
00249 
00253       static DtSchemaManagerCreator& instance(DtDe& de);
00254 
00256       virtual DtSchemaManager* create(DtDe&);
00257    };
00258 }

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)