TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/attribute/OfxhParamSetDescriptor.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_OFX_PARAM_PARAMSETDESCRIPTOR_HPP_
00002 #define _TUTTLE_HOST_OFX_PARAM_PARAMSETDESCRIPTOR_HPP_
00003 
00004 #include "OfxhParamSetAccessor.hpp"
00005 #include "OfxhParamDescriptor.hpp"
00006 
00007 #include <boost/ptr_container/serialize_ptr_list.hpp>
00008 #include <map>
00009 
00010 namespace tuttle {
00011 namespace host {
00012 namespace ofx {
00013 namespace attribute {
00014 
00015 /// a set of parameters
00016 class OfxhParamSetDescriptor : public OfxhParamSetAccessor
00017 {
00018 public:
00019         typedef OfxhParamSetDescriptor This;
00020         typedef std::map<std::string, OfxhParamDescriptor*> ParamDescriptorMap;
00021         typedef boost::ptr_list<OfxhParamDescriptor> ParamDescriptorList;
00022         ParamDescriptorMap _paramMap;
00023         ParamDescriptorList _paramList;
00024 
00025 private:
00026         /// CC doesn't exist
00027         OfxhParamSetDescriptor( const This& );
00028 
00029 public:
00030         /// default ctor
00031         OfxhParamSetDescriptor();
00032 
00033         /// dtor
00034         virtual ~OfxhParamSetDescriptor();
00035 
00036         bool operator==( const This& other ) const
00037         {
00038                 if( _paramList != other._paramList )
00039                         return false;
00040                 return true;
00041         }
00042 
00043         bool operator!=( const This& other ) const { return !This::operator==( other ); }
00044 
00045         /// obtain a handle on this set for passing to the C api
00046         OfxParamSetHandle getParamSetHandle() const { return ( OfxParamSetHandle ) this; }
00047 
00048         /// get the map of params
00049         const ParamDescriptorMap& getParams() const { return _paramMap; }
00050         ParamDescriptorMap&       getParams()       { return _paramMap; }
00051 
00052         /// get the list of params
00053         const ParamDescriptorList& getParamList() const { return _paramList; }
00054 
00055         /// define a param
00056         virtual OfxhParamDescriptor* paramDefine( const char* paramType,
00057                                                   const char* name );
00058 
00059 private:
00060         /// add a param in
00061         virtual void addParam( const std::string& name, OfxhParamDescriptor* p );
00062 
00063 private:
00064         friend class boost::serialization::access;
00065         template<class Archive>
00066         void serialize( Archive& ar, const unsigned int version )
00067         {
00068                 ar& BOOST_SERIALIZATION_NVP( _paramList );
00069         }
00070 
00071 };
00072 
00073 }
00074 }
00075 }
00076 }
00077 
00078 #endif
00079