TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/attribute/OfxhParamDescriptor.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_OFX_PARAM_PARAMDESCRIPTOR_HPP_
00002 #define _TUTTLE_HOST_OFX_PARAM_PARAMDESCRIPTOR_HPP_
00003 
00004 #include "OfxhParamAccessor.hpp"
00005 #include "OfxhAttributeDescriptor.hpp"
00006 
00007 #include <string>
00008 
00009 namespace tuttle {
00010 namespace host {
00011 namespace ofx {
00012 namespace attribute {
00013 
00014 /// is this a standard BaseType
00015 bool isStandardType( const std::string& BaseType );
00016 
00017 /// the Descriptor of a plugin parameter
00018 class OfxhParamDescriptor
00019         : public OfxhAttributeDescriptor
00020         , virtual public OfxhParamAccessor
00021 {
00022 public:
00023         typedef OfxhParamDescriptor This;
00024 
00025 private:
00026         OfxhParamDescriptor() {}
00027 
00028 public:
00029         /// make a parameter, with the given type and name
00030         OfxhParamDescriptor( const std::string& type, const std::string& name );
00031         ~OfxhParamDescriptor() {}
00032 
00033         bool operator==( const This& other ) const
00034         {
00035                 if( OfxhAttributeDescriptor::operator!=( other ) )
00036                         return false;
00037                 return true;
00038         }
00039 
00040         bool operator!=( const This& other ) const { return !This::operator==( other ); }
00041 
00042         /// grab a handle on the parameter for passing to the C API
00043         OfxParamHandle getParamHandle() const
00044         {
00045                 return ( OfxParamHandle ) this;
00046         }
00047 
00048         /// add standard param props, will call the below
00049         void initStandardParamProps( const std::string& type );
00050 
00051 private:
00052         /// add standard properties to a params that can take an interact
00053         void initInteractParamProps( const std::string& type );
00054 
00055         /// add standard properties to a value holding param
00056         void initValueParamProps( const std::string& type, property::EPropType valueType, int dim );
00057         void initNoValueParamProps();
00058 
00059         /// add standard properties to a value holding param
00060         void initNumericParamProps( const std::string& type, property::EPropType valueType, int dim );
00061 
00062 private:
00063         friend class boost::serialization::access;
00064         template<class Archive>
00065         void serialize( Archive& ar, const unsigned int version )
00066         {
00067                 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP( OfxhAttributeDescriptor );
00068         }
00069 
00070 };
00071 
00072 }
00073 }
00074 }
00075 }
00076 
00077 // force boost::is_virtual_base_of value (used by boost::serialization)
00078 namespace boost {
00079 template<>
00080 struct is_virtual_base_of<tuttle::host::ofx::attribute::OfxhAttributeDescriptor, tuttle::host::ofx::attribute::OfxhParamDescriptor>: public mpl::true_ {};
00081 }
00082 
00083 #endif
00084