00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
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, ...);
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