fw4spl
core/fwCore/include/fwCore/macros.hpp File Reference

This file defines fwCore base macros. More...

#include "fwCore/Demangler.hpp"
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/comparison/equal.hpp>
#include <boost/preprocessor/control/expr_if.hpp>
#include <boost/preprocessor/control/if.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/facilities/expand.hpp>
#include <boost/preprocessor/logical/and.hpp>
#include <boost/preprocessor/logical/not.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/seq/elem.hpp>
#include <boost/preprocessor/seq/fold_right.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/seq/seq.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/to_tuple.hpp>
#include <boost/preprocessor/seq/transform.hpp>
#include <boost/preprocessor/tuple/elem.hpp>
#include <memory>
#include <string>
#include <type_traits>
+ Include dependency graph for core/fwCore/include/fwCore/macros.hpp:

Go to the source code of this file.

Classes

class  fwTools::ClassFactory< class, class, class >
 
struct  boost::python::objects::pointer_holder< class, class >
 

Namespaces

 fwTools
 The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.
 

Macros

#define FwCoreNotUsedMacro(x)   ((void) x )
 
Smart pointers macro
#define SPTR(_cls_)   std::shared_ptr < _cls_ >
 
#define CSPTR(_cls_)   std::shared_ptr < const _cls_ >
 
#define WPTR(_cls_)   std::weak_ptr < _cls_ >
 
#define CWPTR(_cls_)   std::weak_ptr < const _cls_ >
 
#define UPTR(_cls_)   std::unique_ptr < _cls_ >
 
#define CUPTR(_cls_)   std::unique_ptr < const _cls_ >
 
Class declaration helpers

/**

#define fwCoreAllowSharedFromThis()
 Generate getSptr and getConstSptr methods. More...
 
#define fwCorePredeclare(_cls_)    BOOST_PP_SEQ_FOLD_RIGHT( __FWCORE_PREDECLARE, BOOST_PP_SEQ_NIL, _cls_)
 Generate predeclarations. More...
 
#define FW_NOINLINE
 Generate getSptr and getConstSptr methods. More...
 
#define fwCoreInterfaceMacro()   __FWCORECLASSNAMEMACRO()
 Generate getSptr and getConstSptr methods. More...
 
#define fwCoreClassnameMacro()   __FWCORECLASSNAMEMACRO(override)
 Generate getSptr and getConstSptr methods. More...
 
#define fwCoreIsTypeOfMacro(_classinfo_)
 Generate getSptr and getConstSptr methods. More...
 
#define fwCoreInterfaceIsTypeOfMacro(_classinfo_)
 Generate getSptr and getConstSptr methods. More...
 
#define fwCoreFriendClassFactoryMacro()
 Generate common code for friend class Factory. More...
 
#define fwCoreClassFactoryMacro(_classinfo_, _parameters_, _factory_)
 Generate methods for classes with one factory. More...
 
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
 Generate common construction methods for classes with one factory. More...
 
#define fwCoreClassDefinitionsWithNFactoriesMacro(_classinfo_, _factories_args_)
 Generate common construction methods for classes with several factories. More...
 
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
 Generate common code for services classes. More...
 
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
 Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...) More...
 
#define fwCoreBaseClassDefinitionsMacro(_classinfo_)
 Generate common code for a base class (Interfaces, Abstract classes, ...) More...
 

Detailed Description

This file defines fwCore base macros.

Definition in file core/fwCore/include/fwCore/macros.hpp.

Macro Definition Documentation

#define CUPTR (   _cls_)    std::unique_ptr < const _cls_ >

Expand to unique_ptr < const cls >

Definition at line 81 of file core/fwCore/include/fwCore/macros.hpp.

#define CWPTR (   _cls_)    std::weak_ptr < const _cls_ >

Expand to weak_ptr < const cls >

Definition at line 77 of file core/fwCore/include/fwCore/macros.hpp.

#define FW_NOINLINE

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 301 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreAllowSharedFromThis ( )
Value:
\
__FWCORE_TYPEDEF_SHARED_PTR_CONST_NAME __FWCORE_CONST_SPTR_FROM_THIS_FUNC_NAME() const { \
return __FWCORE_DYNAMIC_CONST_CAST_FUNC_NAME(this->::fwCore::BaseObject::shared_from_this()); \
} \ \
__FWCORE_TYPEDEF_SHARED_PTR_NAME __FWCORE_SPTR_FROM_THIS_FUNC_NAME(){ \
return __FWCORE_DYNAMIC_CAST_FUNC_NAME(this->::fwCore::BaseObject::shared_from_this()); \
}

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 270 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreBaseClassDefinitionsMacro (   _classinfo_)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \
__FWCORE_GENERATE_CAST(__FWCORE_GET_CLASSNAME(_classinfo_), __FWCORE_TYPEDEF_ROOTCLASS_NAME) \
fwCoreInterfaceMacro() \
fwCoreInterfaceIsTypeOfMacro(_classinfo_)

Generate common code for a base class (Interfaces, Abstract classes, ...)

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname

Definition at line 525 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreClassDefinitionsWithFactoryMacro (   _classinfo_,
  _parameters_,
  _factory_ 
)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \ \
/* @cond */ \
/* @endcond */ \
__FWCORE_GENERATE_FACTORIES_WITH_ONE_FACTORY(_factory_, _parameters_) \
__FWCORE_GENERATE_CAST(__FWCORE_GET_CLASSNAME(_classinfo_), __FWCORE_TYPEDEF_ROOTCLASS_NAME) \
fwCoreFriendClassFactoryMacro() \
fwCoreClassnameMacro() \
fwCoreIsTypeOfMacro(_classinfo_)

Generate common construction methods for classes with one factory.

For this macro parameters, each bracket is significant.

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname
_parameters_( types_param_factory0 ) (...) ( types_param_factoryN )
  • where types_param_factoryX can be :
    • for a 0-arg factory : ()
    • for a 1-arg of T type factory : ((T)) or ((T)(d)) where d is a default value
    • for a N-parameters factory : ((type0)) ((type1)) ... ((typeN)(default_value))
  • Several types_param_factory can be declared if a factory have several signatures
    • Example for several signatures : () ( ((int)) ) ( ((int)) ((std::string)("default")) )
_factory_A factory that can take arguments as defined in parameters arguments

Definition at line 447 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreClassDefinitionsWithNFactoriesMacro (   _classinfo_,
  _factories_args_ 
)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \ \
/* @cond */ \
\
__FWCORE_GENERATE_FACTORIES_WITH_N_FACTORIES(_factories_args_) \
/* @endcond */ \
__FWCORE_GENERATE_CAST(__FWCORE_GET_CLASSNAME(_classinfo_), __FWCORE_TYPEDEF_ROOTCLASS_NAME) \
fwCoreFriendClassFactoryMacro() \
fwCoreClassnameMacro() \
fwCoreIsTypeOfMacro(_classinfo_)

Generate common construction methods for classes with several factories.

For this macro parameters, each bracket is significant.

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname
_factories_args_((factory0, types_param_factory0)) ((factory1, types_param_factory1) ... ((factoryN, types_param_factoryN))
  • where types_param_factoryX can be :
    • for a 0-arg factory : ()
    • for a 1-arg of T type factory : ((T)) or ((T)(d)) where d is a default value
    • for a N-parameters factory : ((type0)) ((type1)) ... ((typeN)(default_value))

Definition at line 476 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreClassFactoryMacro (   _classinfo_,
  _parameters_,
  _factory_ 
)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \ \
/* @cond */ \
/* @endcond */ \
__FWCORE_GENERATE_FACTORIES_WITH_ONE_FACTORY(_factory_, _parameters_) \
fwCoreFriendClassFactoryMacro() \

Generate methods for classes with one factory.

For this macro parameters, each bracket is significant.

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname
_parameters_( types_param_factory0 ) (...) ( types_param_factoryN )
  • where types_param_factoryX can be :
    • for a 0-arg factory : ()
    • for a 1-arg of T type factory : ((T)) or ((T)(d)) where d is a default value
    • for a N-parameters factory : ((type0)) ((type1)) ... ((typeN)(default_value))
  • Several types_param_factory can be declared if a factory have several signatures
    • Example for several signatures : () ( ((int)) ) ( ((int)) ((std::string)("default")) )
_factory_A factory that can take arguments as defined in parameters arguments

Definition at line 419 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreClassnameMacro ( )    __FWCORECLASSNAMEMACRO(override)

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 327 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreFriendClassFactoryMacro ( )
Value:
friend class ::boost::serialization::access; \
template<class, class> \
friend struct ::boost::python::objects::pointer_holder; \
template<class, class, class> \
friend class ::fwTools::ClassFactory; \
friend class ::fwTools::Factory;

Generate common code for friend class Factory.

Definition at line 392 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreInterfaceIsTypeOfMacro (   _classinfo_)
Value:
__FWCOREISTYPEOFMACRO(_classinfo_) \
__FWCOREISAMACRO()

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 358 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreInterfaceMacro ( )    __FWCORECLASSNAMEMACRO()

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 326 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreIsTypeOfMacro (   _classinfo_)
Value:
__FWCOREISTYPEOFMACRO(_classinfo_) \
__FWCOREISAMACRO(override)

Generate getSptr and getConstSptr methods.

These methods use 'shared_from_this' to get a shared pointer and cast it to required type

Definition at line 355 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreNonInstanciableClassDefinitionsMacro (   _classinfo_)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \
__FWCORE_GENERATE_CAST(__FWCORE_GET_CLASSNAME(_classinfo_), __FWCORE_TYPEDEF_ROOTCLASS_NAME) \
fwCoreClassnameMacro() \
fwCoreIsTypeOfMacro(_classinfo_)

Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname

Definition at line 511 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCorePredeclare (   _cls_)    BOOST_PP_SEQ_FOLD_RIGHT( __FWCORE_PREDECLARE, BOOST_PP_SEQ_NIL, _cls_)

Generate predeclarations.

Parameters
_cls_Class to predeclare, in the form (some)(namespace)(class)

Example : fwCorePredeclare( (fwData)(Image) ) expands to : namespace fwData { class Image; }

Definition at line 292 of file core/fwCore/include/fwCore/macros.hpp.

#define fwCoreServiceClassDefinitionsMacro (   _classinfo_)
Value:
__FWCORE_CLASS_TYPEDEFS(_classinfo_) \
__FWCORE_GENERATE_CAST(__FWCORE_GET_CLASSNAME(_classinfo_), __FWCORE_TYPEDEF_ROOTCLASS_NAME) \
fwCoreFriendClassFactoryMacro() \
fwCoreClassnameMacro() \
fwCoreIsTypeOfMacro(_classinfo_)

Generate common code for services classes.

Parameters
_classinfo_Class information in the form : (classname)(baseclassname) or (classname). baseclassname is only required for a non-base class, and should not be used if baseclassname == classname

Definition at line 496 of file core/fwCore/include/fwCore/macros.hpp.

#define SPTR (   _cls_)    std::shared_ptr < _cls_ >

Expand to shared_ptr < cls >

Definition at line 71 of file core/fwCore/include/fwCore/macros.hpp.

Referenced by fwServices::add(), fwRuntime::profile::Initializer::apply(), fwCom::Signal< R(A...) >::asyncEmit(), fwData::Composite::at(), fwDataCamp::visitor::CompareObjects::CompareObjects(), fwGdcmIO::helper::DicomSeries::complete(), uiGenericQt::action::SShowAbout::configuring(), fwServices::registry::Proxy::connect(), fwGdcmIO::reader::ie::Image::correctImageOrientation(), fwRuntime::io::BundleDescriptorReader::createBundles(), fwGdcmIO::writer::tid::Fiducial::createFiducial(), fwZip::WriteDirArchive::createFile(), fwZip::WriteZipArchive::createFile(), fwGdcmIO::writer::tid::Measurement::createMeasurement(), fwRuntime::io::ProfileReader::createProfile(), fwGdcmIO::writer::tid::MeasurementReport::createRootNode(), fwServices::registry::Proxy::disconnect(), fwGdcmIO::helper::StructuredReport::dumpSRNode(), fwGdcmIO::helper::DicomSeries::fillSeries(), vtkGdcmIO::helper::ImageDicomStream::get(), fwDcmtkIO::reader::main::ImageLazyStream::get(), fwDcmtkIO::reader::rgblookup::ImageRGBLookupLazyStream::get(), fwAtoms::Object::getAttributes(), fwMemory::BufferObject::LockBase< T >::getBuffer(), fwMemory::BufferObject::getBufferPointer(), fwMemory::BufferManager::getBufferStats(), fwZip::ReadZipArchive::getComment(), fwServices::AppConfigManager::getConfigRoot(), fwData::Composite::getDataContainer(), fwData::Vector::getDataContainer(), fwAtomsPatch::VersionsManager::getDefault(), fwDataCamp::visitor::CompareObjects::getDifferences(), fwData::Object::getField(), fwZip::ReadDirArchive::getFile(), fwZip::ReadZipArchive::getFile(), fwThread::Worker::getFuture(), fwData::Reconstruction::getImage(), fwServices::IService::getInOut(), fwData::Reconstruction::getMaterial(), fwData::Reconstruction::getMesh(), fwData::Object::getMutex(), fwCom::Signal< R(A...) >::getNumberOfConnections(), fwDataCamp::getObject(), fwServices::IService::getObject(), fwServices::registry::ObjectService::getObjects(), fwServices::IService::getOutput(), fwServices::registry::ObjectService::getServices(), fwServices::OSR::getServices(), fwGdcmIO::reader::Series::getSpatialFiducialsReferencedSeriesInstance(), fwGdcmIO::reader::Series::getStructuredReportReferencedSeriesInstance(), fwMemory::BufferManager::getUpdatedSignal(), fwRuntime::Bundle::getVersion(), ctrlSelection::wrapper::SImageSignalForwarder::info(), fwGdcmIO::reader::SeriesDB::isDicomDirAvailable(), fwAtomsFilter::isSeriesKnown(), fwTools::Type::isSigned(), fwZip::IWriteArchive::leafClassname(), fwZip::IReadArchive::leafClassname(), fwMDSemanticPatch::PatchLoader::loadPatches(), fwMemory::BufferManager::lockBuffer(), fwMemory::BufferManager::lockBufferImpl(), fwCom::Slots::operator()(), fwActivities::registry::Activities::parseBundleInformation(), fwGdcmIO::helper::DicomSeriesWriter::processWrite(), fwGdcmIO::helper::DicomSeriesWriter::processWriteArchive(), fwZip::WriteZipArchive::putFile(), fwGdcmIO::reader::Series::read(), fwGdcmIO::reader::iod::ComprehensiveSRIOD::read(), fwGdcmIO::reader::iod::SpatialFiducialsIOD::read(), fwGdcmIO::reader::iod::CTMRImageIOD::read(), fwGdcmIO::reader::iod::SurfaceSegmentationIOD::read(), fwGdcmIO::reader::ie::Image::readImageBuffer(), fwGdcmIO::reader::ie::Image::readImagePixelModule(), fwGdcmIO::reader::ie::Image::readImagePlaneModule(), fwGdcmIO::reader::tid::Fiducial::readNode(), fwGdcmIO::reader::tid::Measurement::readNode(), fwGdcmIO::helper::StructuredReport::readSR(), fwGdcmIO::reader::tid::MeasurementReport::readSR(), fwGdcmIO::reader::ie::Document::readSR(), fwGdcmIO::helper::StructuredReport::readSubNode(), fwGdcmIO::reader::ie::Surface::readSurfaceSegmentationAndSurfaceMeshModules(), fwGdcmIO::container::DicomInstance::readUIDFromDicomSeries(), fwDataCamp::visitor::RecursiveLock::RecursiveLock(), fwMemory::BufferManager::restoreBuffer(), fwGdcmIO::reader::Series::setBufferRotationEnabled(), fwGdcmIO::reader::SeriesDB::setBufferRotationEnabled(), vtkGdcmIO::ImageSeriesWriter::setCompressionTypes(), fwData::Object::setDefaultField(), fwGdcmIO::writer::Series::setFiducialsExportMode(), fwGdcmIO::reader::SeriesDB::setLogger(), fwDataTools::fieldHelper::MedicalImageHelpers::setPixel(), fwGdcmIO::container::DicomInstance::setSOPInstanceUIDContainer(), fwDcmtkIO::SeriesDBReader::setSupportedSOPClassContainer(), fwTools::Type::setType(), fwGui::dialog::LocationDialog::show(), fwRuntime::profile::Profile::start(), fwRuntime::Bundle::start(), ioITK::InrImageReaderService::stopping(), ioITK::SInrSeriesDBReader::stopping(), fwRenderQt::SRender::stopping(), fwRuntime::Convert::toXmlString(), fwGdcmIO::writer::iod::CTMRImageIOD::write(), fwGdcmIO::writer::iod::SpatialFiducialsIOD::write(), fwGdcmIO::writer::iod::ComprehensiveSRIOD::write(), fwGdcmIO::writer::iod::SurfaceSegmentationIOD::write(), fwGdcmIO::writer::SurfaceSegmentation::write(), fwGdcmIO::writer::Series::write(), fwGdcmIO::container::sr::DicomSRNode::writeContentSequence(), fwGdcmIO::writer::ie::Image::writeImagePlaneModule(), fwGdcmIO::writer::ie::Image::writeImagePlaneModuleSpecificTags(), fwGdcmIO::writer::ie::Document::writeSRDocumentContentModule(), fwGdcmIO::writer::ie::Surface::writeSurfaceSegmentationAndSurfaceMeshModules(), fwGdcmIO::reader::ie::Image::~Image(), and fwCom::Signal< R(A...) >::~Signal().

#define UPTR (   _cls_)    std::unique_ptr < _cls_ >

Expand to unique_ptr < cls >

Definition at line 79 of file core/fwCore/include/fwCore/macros.hpp.

#define WPTR (   _cls_)    std::weak_ptr < _cls_ >

Expand to weak_ptr < cls >

Definition at line 75 of file core/fwCore/include/fwCore/macros.hpp.

Referenced by fwMemory::BufferObject::LockBase< T >::reset().