IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Macros
DynamicTemplateSrcMacro.h File Reference

Macro set to manage dynamic template objects (source part) More...

#include <IPSDKUtil/Dynamic/DynamicSrcMacro.h>
#include <IPSDKUtil/TemplateMacro.h>
#include <IPSDKUtil/Logger/IPSDKUtilLog.h>
#include <boost/preprocessor/seq.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/thread/lock_guard.hpp>
#include <boost/make_shared.hpp>
#include <memory>

Go to the source code of this file.

Macros

#define IPSDK_TEMPLATE_CLASSID_MACRO_TRUE(state, type)   state ", " BOOST_PP_STRINGIZE(type)
 [INTERNAL] macro for expanding class id string
 
#define IPSDK_TEMPLATE_CLASSID_MACRO_FALSE(state, type)   state BOOST_PP_STRINGIZE(type)
 [INTERNAL] macro for expanding class id string
 
#define IPSDK_TEMPLATE_CLASSID_MACRO(s, state, type)
 [INTERNAL] macro for expanding class id string More...
 
#define IPSDK_TEMPLATE_CLASSID(className, seqT)
 macro allowing to construct full template name for class More...
 
#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC(className, seqT)
 macro enabling dynamic properties on template class More...
 
#define IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC(className, seqT)
 macro enabling dynamic properties on abstract template class
 
#define IPSDK_IMPLEMENT_TEMPLATE_COPY_SUPPORT(className, seqT)
 macro enabling copy support for templates More...
 
#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITH_COPY(className, seqT)
 macro enabling dynamic properties on template class More...
 
#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITHOUT_COPY(className, seqT)
 macro enabling dynamic properties on template class More...
 
#define IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC_WITH_COPY(className, seqT)   IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC(className, seqT)
 macro enabling dynamic properties on abstract template class
 
#define IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC_WITHOUT_COPY(className, seqT)
 macro enabling dynamic properties on abstract template class More...
 
#define IPSDK_EXPORT_TEMPLATE_DYNAMIC_MACRO(r, Seq, seqT)
 [INTERNAL] macro for exporting template class specializations
 
#define IPSDK_EXPORT_TEMPLATE_DYNAMIC(libraryName, namespaceSeq, className, TYPE_SEQ)
 macro for exporting template class specializations More...
 
#define IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC_MACRO(r, Seq, seqT)
 [INTERNAL] macro for exporting abstract template class specializations More...
 
#define IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC(libraryName, namespaceSeq, className, TYPE_SEQ)
 macro for exporting template abstract class specializations More...
 
#define IPSDK_IMPLEMENT_TEMPLATE_COPY(className, seqT, baseClassName)
 macro enabling object copy More...
 

Detailed Description

Macro set to manage dynamic template objects (source part)

Author
E. Noirfalise
Date
2013/2/15

Macro Definition Documentation

◆ IPSDK_TEMPLATE_CLASSID_MACRO

#define IPSDK_TEMPLATE_CLASSID_MACRO (   s,
  state,
  type 
)
Value:
BOOST_PP_IF(BOOST_PP_SUB(s, 2), \
#define IPSDK_TEMPLATE_CLASSID_MACRO_FALSE(state, type)
[INTERNAL] macro for expanding class id string
Definition: DynamicTemplateSrcMacro.h:36
#define IPSDK_TEMPLATE_CLASSID_MACRO_TRUE(state, type)
[INTERNAL] macro for expanding class id string
Definition: DynamicTemplateSrcMacro.h:31

[INTERNAL] macro for expanding class id string

◆ IPSDK_TEMPLATE_CLASSID

#define IPSDK_TEMPLATE_CLASSID (   className,
  seqT 
)
Value:
BOOST_PP_SEQ_FOLD_LEFT(IPSDK_TEMPLATE_CLASSID_MACRO, \
BOOST_PP_STRINGIZE(className) "<", \
seqT) \
">"
#define IPSDK_TEMPLATE_CLASSID_MACRO(s, state, type)
[INTERNAL] macro for expanding class id string
Definition: DynamicTemplateSrcMacro.h:41

macro allowing to construct full template name for class

◆ IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC

#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC (   className,
  seqT 
)
Value:
static ipsdk::BaseDynamicObject* className##NewCreatorFcn() { \
return new className<IPSDK_TEMPLATE_ARGS(seqT)>(); \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
static ipsdk::DynamicObjectPtr className##SharedCreatorFcn() { \
return boost::make_shared<className<IPSDK_TEMPLATE_ARGS(seqT)> >(); \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
struct className##DynamicRegistrator { \
className##DynamicRegistrator(); \
~className##DynamicRegistrator(); \
static className##DynamicRegistrator g_classRegistrator; \
};
Base class for dynamic objects.
Definition: BaseDynamicObject.h:28
boost::shared_ptr< BaseDynamicObject > DynamicObjectPtr
shared pointer to a BaseDynamicObject
Definition: DynamicObjectTypes.h:22
#define IPSDK_TEMPLATE_PARAMS(seqT)
macro allowing to enumerate template parameters.
Definition: TemplateMacro.h:57

macro enabling dynamic properties on template class

◆ IPSDK_IMPLEMENT_TEMPLATE_COPY_SUPPORT

#define IPSDK_IMPLEMENT_TEMPLATE_COPY_SUPPORT (   className,
  seqT 
)
Value:
className<IPSDK_TEMPLATE_ARGS(seqT)>::className(const className<IPSDK_TEMPLATE_ARGS(seqT)>& object) { \
if (this != &object) { \
this->initCtorCopy(object); \
copy(object); \
} \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
className<IPSDK_TEMPLATE_ARGS(seqT)>& \
className<IPSDK_TEMPLATE_ARGS(seqT)>::operator= (const className<IPSDK_TEMPLATE_ARGS(seqT)>& object) { \
copy(object); \
return *this; \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::BaseDynamicObject* className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicate() const { \
std::auto_ptr<className> pObject; \
pObject.reset(static_cast<className*>(createNew())); \
pObject->copy(*this); \
return pObject.release(); \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::DynamicObjectPtr className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicateShared() const { \
boost::shared_ptr<className> pObject(boost::make_shared<className>()); \
pObject->copy(*this); \
return pObject; \
}
boost::shared_ptr< BaseDynamicObject > DynamicObjectPtr
shared pointer to a BaseDynamicObject
Definition: DynamicObjectTypes.h:22
#define IPSDK_TEMPLATE_PARAMS(seqT)
macro allowing to enumerate template parameters.
Definition: TemplateMacro.h:57

macro enabling copy support for templates

◆ IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITH_COPY

#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITH_COPY (   className,
  seqT 
)
Value:
IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC(className, seqT)
#define IPSDK_IMPLEMENT_TEMPLATE_COPY_SUPPORT(className, seqT)
macro enabling copy support for templates
Definition: DynamicTemplateSrcMacro.h:81

macro enabling dynamic properties on template class

◆ IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITHOUT_COPY

#define IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC_WITHOUT_COPY (   className,
  seqT 
)
Value:
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::BaseDynamicObject* className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicate() const { \
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
return 0; \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::DynamicObjectPtr className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicateShared() const { \
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
} \
IPSDK_IMPLEMENT_TEMPLATE_DYNAMIC(className, seqT)
Base class for dynamic objects.
Definition: BaseDynamicObject.h:28
IPSDK_FORCEINLINE void copy(T *dest, const T *src, ipUInt64 nbElts)
copy function; copies the &#39;nbElts&#39; of the source buffer to the destination buffer, using the instruction set passed as template argument
Definition: copy.h:36
boost::shared_ptr< BaseDynamicObject > DynamicObjectPtr
shared pointer to a BaseDynamicObject
Definition: DynamicObjectTypes.h:22
#define IPSDK_TEMPLATE_ARGS(seqT)
macro allowing to enumerate template arguments.
Definition: TemplateMacro.h:94
Class s is not copiable, can&#39;t copy object.
Definition: IPSDKUtilLogMessages.h:40
#define IPSDK_TEMPLATE_PARAMS(seqT)
macro allowing to enumerate template parameters.
Definition: TemplateMacro.h:57

macro enabling dynamic properties on template class

◆ IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC_WITHOUT_COPY

#define IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC_WITHOUT_COPY (   className,
  seqT 
)
Value:
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::BaseDynamicObject* className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicate() const { \
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
return 0; \
} \
IPSDK_TEMPLATE_PARAMS(seqT) \
ipsdk::DynamicObjectPtr className<IPSDK_TEMPLATE_ARGS(seqT)>::duplicateShared() const { \
(className<IPSDK_TEMPLATE_ARGS(seqT)>::getTypeName())); \
} \
IPSDK_IMPLEMENT_ABSTRACT_TEMPLATE_DYNAMIC(className, seqT)
Base class for dynamic objects.
Definition: BaseDynamicObject.h:28
IPSDK_FORCEINLINE void copy(T *dest, const T *src, ipUInt64 nbElts)
copy function; copies the &#39;nbElts&#39; of the source buffer to the destination buffer, using the instruction set passed as template argument
Definition: copy.h:36
boost::shared_ptr< BaseDynamicObject > DynamicObjectPtr
shared pointer to a BaseDynamicObject
Definition: DynamicObjectTypes.h:22
#define IPSDK_TEMPLATE_ARGS(seqT)
macro allowing to enumerate template arguments.
Definition: TemplateMacro.h:94
Class s is not copiable, can&#39;t copy object.
Definition: IPSDKUtilLogMessages.h:40
#define IPSDK_TEMPLATE_PARAMS(seqT)
macro allowing to enumerate template parameters.
Definition: TemplateMacro.h:57

macro enabling dynamic properties on abstract template class

◆ IPSDK_EXPORT_TEMPLATE_DYNAMIC

#define IPSDK_EXPORT_TEMPLATE_DYNAMIC (   libraryName,
  namespaceSeq,
  className,
  TYPE_SEQ 
)
Value:
BOOST_PP_SEQ_FOR_EACH(IPSDK_EXPORT_TEMPLATE_DYNAMIC_MACRO, \
(IPSDK_LIB_API(libraryName)) \
(IPSDK_START_NAMESPACE(namespaceSeq)) \
(className) \
(IPSDK_END_NAMESPACE(namespaceSeq)) \
(IPSDK_FULL_NAMESPACE_STR(namespaceSeq)), \
TYPE_SEQ)
#define IPSDK_LIB_API(libraryName)
macro allowing to format macro name used to retrieve a library api macro given its base name ...
#define IPSDK_FULL_NAMESPACE_STR(namespaceSeq)
macro allowing to retrieve string associated to a namespace sequence
Definition: BaseMacros.h:106
#define IPSDK_EXPORT_TEMPLATE_DYNAMIC_MACRO(r, Seq, seqT)
[INTERNAL] macro for exporting template class specializations
Definition: DynamicTemplateSrcMacro.h:169
#define IPSDK_START_NAMESPACE(namespaceSeq)
macro allowing to print namespaces begining
Definition: BaseMacros.h:74
#define IPSDK_END_NAMESPACE(namespaceSeq)
macro allowing to print namespaces ending
Definition: BaseMacros.h:83

macro for exporting template class specializations

◆ IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC_MACRO

#define IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC_MACRO (   r,
  Seq,
  seqT 
)
Value:
BOOST_PP_SEQ_ELEM(1, Seq) \
template <> BOOST_PP_SEQ_ELEM(0, Seq) \
const std::string& BOOST_PP_SEQ_ELEM(2, Seq)<IPSDK_TEMPLATE_VALUES(seqT)>::getTypeName() { \
boost::lock_guard<boost::mutex> lock(TypeNameMutex::get()); \
static const std::string g_typeName(BOOST_PP_SEQ_ELEM(4, Seq) \
IPSDK_TEMPLATE_CLASSID(BOOST_PP_SEQ_ELEM(2, Seq), seqT)); \
return g_typeName; \
} \
template <> BOOST_PP_SEQ_ELEM(0, Seq) \
const std::string& BOOST_PP_SEQ_ELEM(2, Seq)<IPSDK_TEMPLATE_VALUES(seqT)>::getClassName() const { \
return BOOST_PP_SEQ_ELEM(2, Seq)<IPSDK_TEMPLATE_VALUES(seqT)>::getTypeName(); \
} \
BOOST_PP_SEQ_ELEM(3, Seq) \
template class BOOST_PP_SEQ_ELEM(0, Seq) BOOST_PP_SEQ_ELEM(2, Seq)<IPSDK_TEMPLATE_VALUES(seqT)>;
#define IPSDK_TEMPLATE_VALUES(seqT)
macro allowing to enumerate template values.
Definition: TemplateMacro.h:107
#define IPSDK_TEMPLATE_CLASSID(className, seqT)
macro allowing to construct full template name for class
Definition: DynamicTemplateSrcMacro.h:48

[INTERNAL] macro for exporting abstract template class specializations

◆ IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC

#define IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC (   libraryName,
  namespaceSeq,
  className,
  TYPE_SEQ 
)
Value:
(IPSDK_LIB_API(libraryName)) \
(IPSDK_START_NAMESPACE(namespaceSeq)) \
(className) \
(IPSDK_END_NAMESPACE(namespaceSeq)) \
(IPSDK_FULL_NAMESPACE_STR(namespaceSeq)), \
TYPE_SEQ)
#define IPSDK_LIB_API(libraryName)
macro allowing to format macro name used to retrieve a library api macro given its base name ...
#define IPSDK_FULL_NAMESPACE_STR(namespaceSeq)
macro allowing to retrieve string associated to a namespace sequence
Definition: BaseMacros.h:106
#define IPSDK_START_NAMESPACE(namespaceSeq)
macro allowing to print namespaces begining
Definition: BaseMacros.h:74
#define IPSDK_END_NAMESPACE(namespaceSeq)
macro allowing to print namespaces ending
Definition: BaseMacros.h:83
#define IPSDK_EXPORT_ABSTRACT_TEMPLATE_DYNAMIC_MACRO(r, Seq, seqT)
[INTERNAL] macro for exporting abstract template class specializations
Definition: DynamicTemplateSrcMacro.h:234

macro for exporting template abstract class specializations

◆ IPSDK_IMPLEMENT_TEMPLATE_COPY

#define IPSDK_IMPLEMENT_TEMPLATE_COPY (   className,
  seqT,
  baseClassName 
)
Value:
const className<IPSDK_TEMPLATE_ARGS(seqT)>* pObject = \
static_cast<const className<IPSDK_TEMPLATE_ARGS(seqT)>*>(&object); \
Base class for dynamic objects.
Definition: BaseDynamicObject.h:28
IPSDK_FORCEINLINE void copy(T *dest, const T *src, ipUInt64 nbElts)
copy function; copies the &#39;nbElts&#39; of the source buffer to the destination buffer, using the instruction set passed as template argument
Definition: copy.h:36
#define IPSDK_TEMPLATE_PARAMS(seqT)
macro allowing to enumerate template parameters.
Definition: TemplateMacro.h:57

macro enabling object copy