#ifndef _ofxsSupportPrivate_H_
#define _ofxsSupportPrivate_H_
#include "ofxsInteract.h"
#include "ofxsImageEffect.h"
#include "ofxsLog.h"
#include "ofxsMultiThread.h"
namespace OFX {
namespace Private {
extern OfxHost *gHost;
extern OfxImageEffectSuiteV1 *gEffectSuite;
extern OfxPropertySuiteV1 *gPropSuite;
extern OfxInteractSuiteV1 *gInteractSuite;
extern OfxParameterSuiteV1 *gParamSuite;
extern OfxMemorySuiteV1 *gMemorySuite;
extern OfxMultiThreadSuiteV1 *gThreadSuite;
extern OfxMessageSuiteV1 *gMessageSuite;
extern OfxMessageSuiteV2 *gMessageSuiteV2;
extern OfxProgressSuiteV1 *gProgressSuiteV1;
extern OfxProgressSuiteV2 *gProgressSuiteV2;
extern OfxTimeLineSuiteV1 *gTimeLineSuite;
extern OfxParametricParameterSuiteV1* gParametricParameterSuite;
void loadAction(void);
void unloadAction(void);
void setHost(OfxHost *host);
ImageEffect *retrieveImageEffectPointer(OfxImageEffectHandle handle);
OFX::PropertySet
fetchEffectProps(OfxImageEffectHandle handle);
typedef std::map<ContextEnum, ImageEffectDescriptor*> EffectContextMap;
typedef std::map<std::string, EffectContextMap> EffectDescriptorMap;
extern EffectDescriptorMap gEffectDescriptors;
};
namespace Validation {
struct ValueHolder {
std::string vString;
int vInt;
double vDouble;
void *vPointer;
ValueHolder(void) : vString(), vInt(0), vDouble(0.), vPointer(0) {}
ValueHolder(char *s) : vString(s), vInt(0), vDouble(0.), vPointer(0) {}
ValueHolder(const std::string &s) : vString(s), vInt(0), vDouble(0.), vPointer(0) {}
ValueHolder(int i) : vString(), vInt(i), vDouble(0.), vPointer(0) {}
ValueHolder(double d) : vString(), vInt(0), vDouble(d), vPointer(0) {}
ValueHolder(void *p) : vString(), vInt(0), vDouble(0.), vPointer(p) {}
ValueHolder &operator = (char *v) {vString = v; return *this;}
ValueHolder &operator = (std::string v) {vString = v; return *this;}
ValueHolder &operator = (void *v) {vPointer = v; return *this;}
ValueHolder &operator = (int v) {vInt = v; return *this;}
ValueHolder &operator = (double v) {vDouble = v; return *this;}
operator const char * () {return vString.c_str();}
operator std::string &() {return vString;}
operator int &() {return vInt;}
operator double &() {return vDouble;}
operator void * &() {return vPointer;}
};
enum DescriptionTag {
eDescDefault,
eDescFinished
};
class PropertyDescription
{
public :
const std::string _name;
bool _exists;
int _dimension;
OFX::PropertyTypeEnum _ilk;
std::vector<ValueHolder> _defaultValue;
public :
PropertyDescription(const char *name, OFX::PropertyTypeEnum ilk, int dimension, ...);
virtual ~PropertyDescription(void) {}
void validate(bool checkDefaults, PropertySet &propSet);
};
class PropertySetDescription {
protected :
const std::string _setName;
std::vector<PropertyDescription *> _descriptions;
std::vector<PropertyDescription *> _deleteThese;
public :
PropertySetDescription(const char *setName, ...);
virtual ~PropertySetDescription();
void addProperty(PropertyDescription *desc, bool deleteOnDestruction = true);
void validate(PropertySet &propSet, bool checkDefaults = true, bool logOrdinaryMessages = false);
};
void
validateHostProperties(OfxHost *host);
void
validatePluginDescriptorProperties(PropertySet props);
void
validatePluginInstanceProperties(PropertySet props);
void
validateClipDescriptorProperties(PropertySet props);
void
validateClipInstanceProperties(PropertySet props);
void
validateImageBaseProperties(PropertySet props);
void
validateImageProperties(PropertySet props);
#ifdef OFX_SUPPORTS_OPENGLRENDER
void
validateTextureProperties(PropertySet props);
#endif
void
validateActionArgumentsProperties(const std::string &action, PropertySet inArgs, PropertySet outArgs);
void
validateParameterProperties(ParamTypeEnum paramType,
OFX::PropertySet paramProps,
bool checkDefaults);
void initialise(void);
};
};
#endif