TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/property/OfxhGetHook.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_OFX_PROPERTY_GETHOOK_HPP_
00002 #define _TUTTLE_HOST_OFX_PROPERTY_GETHOOK_HPP_
00003 
00004 #include "OfxhPropertyTemplate.hpp"
00005 #include <tuttle/host/ofx/OfxhException.hpp>
00006 #include <string>
00007 
00008 namespace tuttle {
00009 namespace host {
00010 namespace ofx {
00011 namespace property {
00012 
00013 /// Sits on a property and can override the local property value when a value is being fetched
00014 /// only one of these can be in any property (as the thing has only a single value).
00015 /// We deliberately don't have a getStringPropertyN as it is somewhat more painfull and never
00016 /// used in practice.
00017 class OfxhGetHook
00018 {
00019 public:
00020         /// dtor
00021         virtual ~OfxhGetHook()
00022         {}
00023 
00024         /// We specialise this to do some magic so that it calls get string/int/double/pointer appropriately
00025         /// this is what is called by the propertytemplate code to fetch values out of a hook.
00026         template<class T>
00027         typename T::ReturnType getProperty( const std::string& name, int index = 0 ) const OFX_EXCEPTION_SPEC;
00028 
00029         /// We specialise this to do some magic so that it calls get int/double/pointer appropriately
00030         /// this is what is called by the propertytemplate code to fetch values out of a hook.
00031         template<class T>
00032         void getPropertyN( const std::string & name, typename T::APIType * values, int count ) const OFX_EXCEPTION_SPEC;
00033 
00034         /// override this to fetch a single value at the given index.
00035         virtual const std::string& getStringProperty( const std::string& name, int index = 0 ) const OFX_EXCEPTION_SPEC;
00036 
00037         /// override this to fetch a single value at the given index.
00038         virtual int getIntProperty( const std::string& name, int index = 0 ) const OFX_EXCEPTION_SPEC;
00039 
00040         /// override this to fetch a multiple values in a multi-dimension property
00041         virtual void getIntPropertyN( const std::string& name, int* values, int count ) const OFX_EXCEPTION_SPEC;
00042 
00043         /// override this to fetch a single value at the given index.
00044         virtual double getDoubleProperty( const std::string& name, int index = 0 ) const OFX_EXCEPTION_SPEC;
00045 
00046         /// override this to fetch a multiple values in a multi-dimension property
00047         virtual void getDoublePropertyN( const std::string& name, double* values, int count ) const OFX_EXCEPTION_SPEC;
00048 
00049         /// override this to fetch a single value at the given index.
00050         virtual void* getPointerProperty( const std::string& name, int index = 0 ) const OFX_EXCEPTION_SPEC;
00051 
00052         /// override this to fetch a multiple values in a multi-dimension property
00053         virtual void getPointerPropertyN( const std::string& name, void** values, int count ) const OFX_EXCEPTION_SPEC;
00054 
00055         /// override this to fetch the dimension size.
00056         virtual size_t getDimension( const std::string& name ) const OFX_EXCEPTION_SPEC;
00057 
00058         /// override this to handle a reset().
00059         virtual void reset( const std::string& name ) OFX_EXCEPTION_SPEC;
00060 };
00061 
00062 }
00063 }
00064 }
00065 }
00066 
00067 #endif