Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ofxsSupportPrivate.h

Go to the documentation of this file.
00001 /*
00002 OFX Support Library, a library that skins the OFX plug-in API with C++ classes.
00003 Copyright (C) 2004-2005 The Foundry Visionmongers Ltd
00004 Author Bruno Nicoletti bruno@thefoundry.co.uk
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 Foundry Visionmongers 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 The Foundry Visionmongers Ltd
00030 1 Wardour St
00031 London W1D 6PA
00032 England
00033 
00034 
00035 
00036 */
00037 
00038 #ifndef _ofxsSupportPrivate_H_
00039 #define _ofxsSupportPrivate_H_
00040 
00041 #include "ofxsInteract.h"
00042 #include "ofxsImageEffect.h"
00043 #include "ofxsLog.h"
00044 #include "ofxsMultiThread.h"
00045 
00048 namespace OFX {
00049 
00051   FieldEnum mapStrToFieldEnum(const std::string &str)  throw(std::invalid_argument);
00052 
00054 
00055   ContextEnum mapToContextEnum(const std::string &s) throw(std::invalid_argument);
00056 
00057   namespace Private {
00059     extern OfxHost *gHost;
00060 
00062     extern OfxImageEffectSuiteV1 *gEffectSuite;
00063 
00065     extern OfxPropertySuiteV1    *gPropSuite;
00066 
00068     extern OfxInteractSuiteV1    *gInteractSuite;
00069 
00071     extern OfxParameterSuiteV1   *gParamSuite;
00072 
00074     extern OfxMemorySuiteV1      *gMemorySuite;
00075 
00077     extern OfxMultiThreadSuiteV1 *gThreadSuite;
00078 
00080     extern OfxMessageSuiteV1     *gMessageSuite;
00081 
00083     extern OfxProgressSuiteV1     *gProgressSuite;
00084 
00086     extern OfxTimeLineSuiteV1     *gTimeLineSuite;
00087 
00089     void loadAction(void);
00090 
00092     void unloadAction(void);
00093 
00096     void setHost(OfxHost *host);
00097 
00099     ImageEffect *retrieveImageEffectPointer(OfxImageEffectHandle handle);
00100 
00102     OFX::PropertySet
00103       fetchEffectProps(OfxImageEffectHandle handle);
00104 
00106     typedef std::map<ContextEnum, ImageEffectDescriptor*> EffectContextMap;
00107     typedef std::map<std::string, EffectContextMap> EffectDescriptorMap;
00108     extern EffectDescriptorMap gEffectDescriptors;
00109   };
00110 
00112   namespace Validation {
00113 
00118     struct ValueHolder {
00119       std::string  vString;
00120       int    vInt;
00121       double vDouble;
00122       void  *vPointer;
00123 
00124       ValueHolder(void) {}
00125       ValueHolder(char  *s) : vString(s) {}
00126       ValueHolder(const std::string &s) : vString(s) {}
00127       ValueHolder(int    i) : vInt(i) {}
00128       ValueHolder(double d) : vDouble(d) {}
00129       ValueHolder(void  *p) : vPointer(p) {}
00130 
00131       ValueHolder &operator = (char *v)  {vString = v; return *this;}
00132       ValueHolder &operator = (std::string v)  {vString = v; return *this;}
00133       ValueHolder &operator = (void *v)  {vPointer = v; return *this;}
00134       ValueHolder &operator = (int v)    {vInt = v; return *this;}
00135       ValueHolder &operator = (double v) {vDouble = v; return *this;}
00136 
00137       operator const char * () {return vString.c_str();}
00138       operator std::string &() {return vString;}
00139       operator int    &() {return vInt;}
00140       operator double &() {return vDouble;}
00141       operator void * &() {return vPointer;}
00142     };
00143 
00145     enum DescriptionTag {
00146       eDescDefault,  
00147       eDescFinished  
00148     };
00149 
00151     class PropertyDescription
00152     {
00153     public :
00155       std::string _name;
00156 
00158       bool _exists;
00159 
00161       int      _dimension;
00162 
00164       OFX::PropertyTypeEnum _ilk;
00165 
00167       std::vector<ValueHolder> _defaultValue; 
00168 
00169     public :
00171       PropertyDescription(char *name, OFX::PropertyTypeEnum ilk, int dimension, ...);
00172 
00174       virtual ~PropertyDescription(void) {}
00175 
00177       void validate(bool checkDefaults, PropertySet &propSet);
00178     };
00179 
00181     class PropertySetDescription {
00182     protected :
00184       std::string           _setName;
00185 
00187       std::vector<PropertyDescription *> _descriptions;
00188 
00190       std::vector<PropertyDescription *> _deleteThese;
00191 
00192     public :
00198       PropertySetDescription(char *setName, ...);// [PropertyDescription *v, int nSetToThese]
00199 
00201       virtual ~PropertySetDescription();
00202 
00204       void addProperty(PropertyDescription *desc, bool deleteOnDestruction = true);
00205 
00207       void validate(PropertySet &propSet, bool checkDefaults = true, bool logOrdinaryMessages = false); 
00208     };
00209 
00210 
00212     void
00213       validateHostProperties(OfxHost *host);
00214 
00216     void
00217       validatePluginDescriptorProperties(PropertySet props);
00218 
00220     void
00221       validatePluginInstanceProperties(PropertySet props);
00222 
00224     void
00225       validateClipDescriptorProperties(PropertySet props);
00226 
00228     void
00229       validateClipInstanceProperties(PropertySet props);
00230 
00232     void
00233       validateImageProperties(PropertySet props);
00234 
00236     void
00237       validateActionArgumentsProperties(const std::string &action, PropertySet inArgs, PropertySet outArgs);
00238 
00240     void
00241       validateParameterProperties(ParamTypeEnum paramType, 
00242       OFX::PropertySet paramProps,
00243       bool checkDefaults);
00244 
00246     void initialise(void);
00247   };
00248 
00249 };
00250 
00251 #endif

Generated on Thu Oct 9 13:03:49 2008 for OFX Support by  doxygen 1.3.9.1