TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/OfxhHost.hpp
Go to the documentation of this file.
00001 /*
00002  * Software License :
00003  *
00004  * Copyright (c) 2007-2009, The Open Effects Association Ltd.  All Rights Reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions are met:
00008  *
00009  * Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  * Redistributions in binary form must reproduce the above copyright notice,
00012  *    this list of conditions and the following disclaimer in the documentation
00013  *    and/or other materials provided with the distribution.
00014  * Neither the name The Open Effects Association Ltd, nor the names of its
00015  *    contributors may be used to endorse or promote products derived from this
00016  *    software without specific prior written permission.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00019  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00020  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00021  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00022  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00023  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00024  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00025  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00026  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00027  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00028  */
00029 #ifndef _TUTTLE_HOST_OFX_HOST_HPP_
00030 #define _TUTTLE_HOST_OFX_HOST_HPP_
00031 
00032 #include "property/OfxhSet.hpp"
00033 
00034 #include <ofxCore.h>
00035 #include <ofxImageEffect.h>
00036 #include <ofxTimeLine.h>
00037 
00038 #include <string>
00039 
00040 namespace tuttle {
00041 namespace host {
00042 namespace ofx {
00043 
00044 // a plugin what we use
00045 class OfxhPlugin;
00046 
00047 // a param descriptor
00048 namespace attribute {
00049 class OfxhParamDescriptor;
00050 }
00051 
00052 /**
00053  * Base class for all objects passed to a plugin by the 'setHost' function
00054  * passed back by any plug-in.
00055  */
00056 class OfxhHost
00057 {
00058 protected:
00059         OfxHost _host;
00060         property::OfxhSet _properties;
00061 
00062 public:
00063         OfxhHost();
00064         virtual ~OfxhHost() = 0;
00065 
00066         /// get the props on this host
00067         const property::OfxhSet& getProperties() const { return _properties; }
00068         property::OfxhSet&       getProperties()       { return _properties; }
00069 
00070         /**
00071          * fetch a suite
00072          * The base class returns the following suites
00073          *    PropertySuite
00074          *    MemorySuite
00075          */
00076         virtual void* fetchSuite( const char* suiteName, const int suiteVersion );
00077 
00078         /// get the C API handle that is passed across the API to represent this host
00079         OfxHost* getHandle();
00080 
00081         /// is my magic number valid?
00082         bool verifyMagic() { return true; }
00083 
00084         #ifndef SWIG
00085 
00086         /// override this to handle do post-construction initialisation on a Param::Descriptor
00087         virtual void initDescriptor( attribute::OfxhParamDescriptor& ) const {}
00088 
00089         /// vmessage
00090         virtual OfxStatus vmessage( const char* type,
00091                                     const char* id,
00092                                     const char* format,
00093                                     va_list     args ) const = 0;
00094         #endif
00095 };
00096 
00097 }
00098 }
00099 }
00100 
00101 #endif
00102