VR-Forces 4.0.4 Class Documentation
include/makSettingsManager/boolSetting.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2008 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: boolSetting.h,v $ $Revision: 1.6 $ $State: Exp $
00007 *******************************************************************************/
00008 
00009 // \file boolSetting.h
00010 // \brief Generic boolean object for use with DtSettingsManager
00011 // This is a general purpose boolean object which is instantiated by
00012 // DtSettingsManager::addIndependentBool.
00013 
00014 #ifndef boolSetting_H_
00015 #define boolSetting_H_
00016 
00017 #include "makSettingsManager/settingsObject.h"
00018 #include "makSettingsManager/settingsObjectFactory.h"
00019 
00020 #include <boost/serialization/nvp.hpp>
00021 #include <boost/serialization/base_object.hpp>
00022 #include <boost/serialization/export.hpp>
00023 
00024 #include <boost/archive/xml_iarchive.hpp>
00025 #include <boost/archive/xml_oarchive.hpp>
00026 #include <boost/archive/text_iarchive.hpp>
00027 #include <boost/archive/text_oarchive.hpp>
00028 
00029 #include "makSettingsManager/makSettingsManagerDefines.h"
00030 class DT_DLL_makSettingsManager DtBoolSetting : public DtSettingsObject
00031 {
00032 public:
00033    // Default constructor, required for deserialization
00034    DtBoolSetting();
00035    
00036    // Constructor
00037    DtBoolSetting(std::string name, bool value);
00038 
00039    // Copy constructor
00040    DtBoolSetting(const DtBoolSetting& orig);
00041 
00042    // Equality operator
00043    virtual bool operator==(const DtSettingsObject & other) const;
00044 
00045    // Inequality operator
00046    virtual bool operator!=(const DtSettingsObject & other) const;
00047 
00048    // Used by DtSettingsManager::setSetting when it needs to update an
00049    // existing DtSettingsObject.
00050    virtual bool setFrom(const DtSettingsObject* other);
00051 
00052    // Clone operator, returns a new settings which is a copy of this one.
00053    virtual DtSettingsObject* clone() const;
00054 
00055    // The boolean value
00057    bool value() const;
00058    void setValue(bool value);
00060       
00061 private:
00062    // Serialization support
00063    friend class boost::serialization::access;
00064    template<class Archive>
00065    void serialize(Archive & ar, const unsigned int version)
00066    {
00067       // Serialize the base class
00068       ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(DtSettingsObject);
00069       // Serialize the members
00070       ar & BOOST_SERIALIZATION_NVP(myValue);
00071    }
00072 
00073 protected:
00074    bool myValue;
00075 };
00076 
00077 
00078 #endif

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)