21 #ifndef otbWrapperApplicationFactory_h
22 #define otbWrapperApplicationFactory_h
25 #include "itkVersion.h"
33 template <
class TApplication>
46 return ITK_SOURCE_VERSION;
51 return "ApplicationFactory";
55 itkFactorylessNewMacro(Self);
63 std::string tmpName(name);
64 std::string::size_type pos = tmpName.rfind(
"::");
65 if (pos != std::string::npos)
67 tmpName = tmpName.substr(pos + 2);
69 m_ClassName.assign(tmpName);
84 LightObject::Pointer
CreateObject(
const char* itkclassname)
override
86 LightObject::Pointer ret;
87 if (m_ClassName == itkclassname)
88 ret = TApplication::New().GetPointer();
97 std::list<LightObject::Pointer>
CreateAllObject(
const char* itkclassname)
override
99 const std::string applicationClass(
"otbWrapperApplication");
100 std::list<LightObject::Pointer> list;
101 if (m_ClassName == itkclassname || applicationClass == itkclassname)
102 list.push_back(TApplication::New().GetPointer());
110 void operator=(
const Self&) =
delete;
118 #if (defined(WIN32) || defined(_WIN32))
119 #define OTB_APP_EXPORT __declspec(dllexport)
121 #define OTB_APP_EXPORT
124 #define OTB_APPLICATION_EXPORT(ApplicationType) \
125 typedef otb::Wrapper::ApplicationFactory<ApplicationType> ApplicationFactoryType; \
126 static ApplicationFactoryType::Pointer staticFactory; \
128 OTB_APP_EXPORT itk::ObjectFactoryBase* itkLoad() \
130 staticFactory = ApplicationFactoryType::New(); \
131 staticFactory->SetClassName(#ApplicationType); \
132 return staticFactory; \
137 #endif // otbWrapperApplication_h_