Katana Plug-in APIs 0.1

FnRenderOutputLocationPlugin.h

00001 #ifndef FnRenderOutputLocationPlugin_H
00002 #define FnRenderOutputLocationPlugin_H
00003 
00004 #include <FnPluginSystem/FnPluginSystem.h>
00005 #include <FnPluginSystem/FnPlugin.h>
00006 #include <FnAttribute/FnAttribute.h>
00007 
00008 #include <FnRenderOutputLocation/suite/FnRenderOutputLocationSuite.h>
00009 #include <FnRenderOutputLocation/FnRenderOutputLocationAPI.h>
00010 #include <FnGeolib/op/FnGeolibCookInterface.h>
00011 #include <FnPlatform/internal/UniquePtr.h>
00012 
00013 #include <vector>
00014 #include <string>
00015 #include <memory>
00016 
00018 
00019 namespace Foundry
00020 {
00021 namespace Katana
00022 {
00023     class FNRENDEROUTPUTLOCATION_API FnRenderOutputLocationPlugin
00024     {
00025     public:
00026         FnRenderOutputLocationPlugin() {}
00027         virtual ~FnRenderOutputLocationPlugin() {}
00028 
00029         static FnAttribute::GroupAttribute getLocationSettingsAttr(
00030                 const std::string & outputType,
00031                 const FnAttribute::GroupAttribute & incomingOutputAttr);
00032 
00033         virtual std::string computeFilePath(
00034                 const FnAttribute::GroupAttribute & outputAttrs,
00035                 const FnAttribute::GroupAttribute & locationAttrs,
00036                 const FnAttribute::GroupAttribute & renderSettingsAttrs,
00037                 const FnAttribute::GroupAttribute & imageInfo,
00038                 bool makeVersionTemplate) = 0;
00039 
00040         virtual std::string computeLocation(
00041                 const FnAttribute::GroupAttribute & outputAttrs,
00042                 const FnAttribute::GroupAttribute & locationAttrs,
00043                 const FnAttribute::GroupAttribute & renderSettingsAttrs,
00044                 const FnAttribute::GroupAttribute & imageInfo) = 0;
00045 
00046         static FnPlugStatus setHost(FnPluginHost *host);
00047         static FnPluginHost *getHost();
00048 
00049         static FnRenderOutputLocationPluginSuite_v2 createSuite(
00050                 FnRenderOutputLocationPluginHandle (*create)(),
00051                 FnAttributeHandle (*getLocationSettingsAttr)(
00052                     const char * outputType,
00053                     FnAttributeHandle incomingOutputAttr));
00054         static FnRenderOutputLocationPluginHandle newPluginHandle(
00055                 FnRenderOutputLocationPlugin * renderOutputLocationPlugin);
00056 
00057         static void flush();
00058 
00059         static unsigned int _apiVersion;
00060         static const char* _apiName;
00061 
00062     private:
00063         static FnPluginHost *_host;
00064     };
00065 
00066 } // namespace Katana
00067 } // namespace Foundry
00068 
00069 namespace FnKat = Foundry::Katana;
00070 
00071 // Plugin Registering Macro.
00072 
00073 #define DEFINE_RENDEROUTPUTLOCATION_PLUGIN(PLUGIN_CLASS)                       \
00074                                                                                \
00075     FnPlugin PLUGIN_CLASS##_plugin;                                            \
00076                                                                                \
00077     FnRenderOutputLocationPluginHandle PLUGIN_CLASS##_create()                 \
00078     {                                                                          \
00079         return Foundry::Katana::FnRenderOutputLocationPlugin::newPluginHandle( \
00080             PLUGIN_CLASS::create());                                           \
00081     }                                                                          \
00082                                                                                \
00083     FnAttributeHandle PLUGIN_CLASS##_getLocationSettingsAttr(                  \
00084         const char * outputType, FnAttributeHandle incomingOutputAttr)         \
00085     {                                                                          \
00086         FnAttribute::GroupAttribute attr =                                     \
00087             PLUGIN_CLASS::getLocationSettingsAttr(                             \
00088                 outputType,                                                    \
00089                 FnAttribute::Attribute::CreateAndRetain(incomingOutputAttr));  \
00090         return attr.getRetainedHandle();                                       \
00091     }                                                                          \
00092                                                                                \
00093     FnRenderOutputLocationPluginSuite_v2 PLUGIN_CLASS##_suite =                \
00094         Foundry::Katana::FnRenderOutputLocationPlugin::createSuite(            \
00095             PLUGIN_CLASS##_create, PLUGIN_CLASS##_getLocationSettingsAttr);    \
00096                                                                                \
00097     const void* PLUGIN_CLASS##_getSuite()                                      \
00098     {                                                                          \
00099         return &PLUGIN_CLASS##_suite;                                          \
00100     }
00101 
00102 struct FnRenderOutputLocationPluginStruct
00103 {
00104 public:
00105     FnRenderOutputLocationPluginStruct(
00106         Foundry::Katana::FnRenderOutputLocationPlugin * renderOutputLocationPlugin) :
00107             _renderOutputLocationPlugin(renderOutputLocationPlugin) {}
00108     ~FnRenderOutputLocationPluginStruct() {}
00109 
00110     Foundry::Katana::FnRenderOutputLocationPlugin & getRenderOutputLocationPlugin()
00111     {
00112         return *_renderOutputLocationPlugin;
00113     }
00114 
00115 private:
00116     FnPlatform::internal::UniquePtr<
00117         Foundry::Katana::FnRenderOutputLocationPlugin>::type
00118             _renderOutputLocationPlugin;
00119 };
00120 
00122 
00123 #endif // FnRenderOutputLocationPlugin_H
 All Classes Functions Variables Typedefs Enumerations Enumerator