VR-Forces 4.0.4 Class Documentation
include/makArchives/DtFeatureSettingsRecord.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2010 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile:  $ $Revision:  $ $State:  $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 #include <makArchives/makArchives.h>
00015 #include <string>
00016 #include <vector>
00017 #include <utility>
00018 
00019 namespace makArchives
00020 {
00022    class DT_DLL_MAKARCHIVES DtFeatureSettingsRecord
00023    {
00024    public:
00025 
00026       struct Color
00027       {
00028          Color(float r, float g, float b, float a)
00029          : red(r)
00030          , green(g)
00031          , blue(b)
00032          , alpha(a)
00033          {         
00034          }
00035 
00036          Color()
00037          : red(1.0)
00038          , green(1.0)
00039          , blue(1.0)
00040          , alpha(1.0)
00041          {         
00042          }
00043          
00044          Color(const float* rgba)
00045          : red(rgba[0])
00046          , green(rgba[1])
00047          , blue(rgba[2])
00048          , alpha(rgba[3])
00049          {         
00050          }
00051 
00052          template<class Archive>
00053             void serialize(Archive & ar, const unsigned int version)
00054          {
00055             ar & BOOST_SERIALIZATION_NVP(red);
00056             ar & BOOST_SERIALIZATION_NVP(green);
00057             ar & BOOST_SERIALIZATION_NVP(blue);
00058             ar & BOOST_SERIALIZATION_NVP(alpha);
00059          }
00060 
00061          const float* rgba() const
00062          {
00063             return &red;
00064          }
00065 
00066          float red;
00067          float green;
00068          float blue;
00069          float alpha;
00070       };
00071 
00072       typedef std::vector< std::pair< std::string, Color> > ColorList;
00073 
00074 
00075       DtFeatureSettingsRecord();
00076       DtFeatureSettingsRecord(const DtFeatureSettingsRecord&);
00077       DtFeatureSettingsRecord& operator=(const DtFeatureSettingsRecord&);
00078       ~DtFeatureSettingsRecord();
00079 
00080       bool autoLoad() const;
00081       void setAutoLoad(bool autoLoad);
00082 
00084       const ColorList& featureColors() const;
00085 
00087       void setFeatureColors(const ColorList& list);
00088 
00090       void swapFeatureColors(ColorList& list);
00091 
00092    protected:
00093 
00094       friend class boost::serialization::access;
00095 
00099       template<class Archive>
00100       void serialize(Archive & ar, const unsigned int version)
00101       {
00102          ar & BOOST_SERIALIZATION_NVP(myAutoLoadFlag);
00103          ar & BOOST_SERIALIZATION_NVP(myColors);
00104       }
00105 
00106    protected:
00107 
00108 
00109       bool myAutoLoadFlag;
00110       std::vector< std::pair< std::string, Color> > myColors;
00111    };
00112 }
00113 

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)