/usr/include/OTB-5.8/otbWrapperApplicationFactory.h is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbWrapperApplicationFactory_h
#define otbWrapperApplicationFactory_h
#include "otbWrapperApplicationFactoryBase.h"
#include "itkVersion.h"
namespace otb
{
namespace Wrapper
{
template < class TApplication >
class ITK_ABI_EXPORT ApplicationFactory : public ApplicationFactoryBase
{
public:
/** Standard class typedefs. */
typedef ApplicationFactory Self;
typedef ApplicationFactoryBase Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Class methods used to interface with the registered factories. */
const char* GetITKSourceVersion(void) const ITK_OVERRIDE
{
return ITK_SOURCE_VERSION;
}
const char* GetDescription(void) const ITK_OVERRIDE
{
return "ApplicationFactory";
}
/** Method for class instantiation. */
itkFactorylessNewMacro(Self);
/** Run-time type information (and related methods). */
itkTypeMacro(ApplicationFactory, ApplicationFactoryBase);
void SetClassName(const char* name)
{
// remove namespace, only keep class name
std::string tmpName(name);
std::string::size_type pos = tmpName.rfind("::");
if (pos != std::string::npos)
{
tmpName = tmpName.substr(pos+2);
}
m_ClassName.assign(tmpName);
}
protected:
ApplicationFactory()
{
}
~ApplicationFactory() ITK_OVERRIDE
{
}
/** This method is provided by sub-classes of ObjectFactoryBase.
* It should create the named itk object or return 0 if that object
* is not supported by the factory implementation. */
LightObject::Pointer CreateObject(const char* itkclassname ) ITK_OVERRIDE
{
LightObject::Pointer ret;
if ( m_ClassName == itkclassname)
ret = TApplication::New().GetPointer();
return ret;
}
/** This method creates all the objects with the new class of
* itkclass name, which are provide by this object
*/
std::list<LightObject::Pointer>
CreateAllObject(const char* itkclassname) ITK_OVERRIDE
{
const std::string applicationClass("otbWrapperApplication");
std::list<LightObject::Pointer> list;
if ( m_ClassName == itkclassname ||
applicationClass == itkclassname )
list.push_back(TApplication::New().GetPointer());
return list;
}
private:
ApplicationFactory(const Self &); //purposely not implemented
void operator =(const Self&); //purposely not implemented
std::string m_ClassName;
};
} // end namespace Wrapper
} //end namespace otb
#if (defined(WIN32) || defined(_WIN32))
# define OTB_APP_EXPORT __declspec(dllexport)
#else
# define OTB_APP_EXPORT
#endif
#define OTB_APPLICATION_EXPORT( ApplicationType ) \
typedef otb::Wrapper::ApplicationFactory<ApplicationType> ApplicationFactoryType; \
static ApplicationFactoryType::Pointer staticFactory; \
extern "C" \
{ \
OTB_APP_EXPORT itk::ObjectFactoryBase* itkLoad() \
{ \
staticFactory = ApplicationFactoryType::New(); \
staticFactory->SetClassName(#ApplicationType); \
return staticFactory; \
} \
}
#endif // otbWrapperApplication_h_
|