fw4spl
fwTools::fwID Class Reference

Defines ID for fwTools::Object. It is used to associate ID with object. More...

#include <fwID.hpp>

+ Inheritance diagram for fwTools::fwID:

Public Types

enum  Policy { EMPTY = 1, GENERATE, MUST_EXIST }
 
typedef std::string IDType
 

Public Member Functions

virtual bool isA (const std::string &type) const
 

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
static FWTOOLS_API bool exist (IDType _id)
 
static FWTOOLS_API std::shared_ptr< ::fwTools::ObjectgetObject (IDType requestID)
 Retrieve the object attached to the given id. Return a null sptr if no correspondence exist. More...
 

Protected Member Functions

FWTOOLS_API bool hasID () const
 Return true if the object has an id set. More...
 
FWTOOLS_API IDType getID (Policy policy=GENERATE) const
 Returns the id of the object. If it is not set and the policy value is. More...
 
virtual FWTOOLS_API void setID (IDType newID)
 Set a newID for the object, (newID must not exist in fwID), the oldest one is released. More...
 
FWTOOLS_API void resetID ()
 Release the id for the object. More...
 
 fwID ()
 Constructor : does nothing.
 

Demangling methods

virtual const std::string & getLeafClassname () const
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Detailed Description

Defines ID for fwTools::Object. It is used to associate ID with object.

Definition at line 26 of file fwID.hpp.

Member Enumeration Documentation

Enumerator
EMPTY 

return an empty id if no one set

GENERATE 

generate a new id if necessary

MUST_EXIST 

throw an exception if object has not id.

Definition at line 34 of file fwID.hpp.

Member Function Documentation

bool fwTools::fwID::exist ( IDType  _id)
static

Test if the given id exist (i.e recorded in fwID dictionary)

Parameters
[in]_id: the id to test.
Returns
true iff the given id is recorded in fwID dictionary.
Note
This method is thread-safe.

Definition at line 33 of file fwID.cpp.

Referenced by fwGui::GuiRegistry::actionServiceSetActive(), fwGui::GuiRegistry::actionServiceSetExecutable(), fwGui::GuiRegistry::actionServiceSetVisible(), fwGui::GuiRegistry::actionServiceStarting(), fwGui::GuiRegistry::actionServiceStopping(), fwGui::ActionCallbackBase::check(), ctrlSelection::BookmarkSrv::configuring(), fwGui::ActionCallbackBase::execute(), fwServices::get(), fwServices::AppConfigManager::getConfigRoot(), getID(), fwGui::registrar::MenuBarRegistrar::manage(), fwGui::registrar::MenuRegistrar::manage(), fwGui::registrar::ViewRegistrar::manage(), fwGui::registrar::ToolBarRegistrar::manage(), fwGui::registrar::ViewRegistrar::manageMenuBar(), fwGui::registrar::ViewRegistrar::manageToolBar(), guiQt::SSignalShortcut::starting(), preferences::Plugin::stop(), gui::action::SStarter::stopping(), fwGui::registrar::MenuBarRegistrar::unmanage(), fwGui::registrar::MenuRegistrar::unmanage(), fwGui::registrar::ViewRegistrar::unmanage(), fwGui::registrar::ToolBarRegistrar::unmanage(), fwGui::registrar::ViewRegistrar::unmanageMenuBar(), fwGui::registrar::ViewRegistrar::unmanageToolBar(), fwGui::GuiRegistry::unregisterActionSIDToParentSID(), fwGui::GuiRegistry::unregisterSIDContainer(), fwGui::GuiRegistry::unregisterSIDMenu(), fwGui::GuiRegistry::unregisterSIDMenuBar(), fwGui::GuiRegistry::unregisterSIDToolBar(), gui::action::SBooleanSlotCaller::updating(), gui::action::SSlotCaller::updating(), gui::action::SModifyLayout::updating(), ctrlSelection::ImageUpdateAxis::updating(), and gui::action::SStarter::updating().

+ Here is the caller graph for this function:

fwID::IDType fwTools::fwID::getID ( Policy  policy = GENERATE) const
protected

Returns the id of the object. If it is not set and the policy value is.

  • EMPTY then an empty id is returned
  • GENERATE (default) then a new ID will be generated (and recorded ) using the pattern "CLASSNAME-NUM". NUM is always increasing
  • MUST_EXIST then an exception Failed is raised
    Note
    We consider an object be constant whatever if its id is generated.
    This method is thread-safe.

Definition at line 78 of file fwID.cpp.

References EMPTY, exist(), GENERATE, getClassname(), and MUST_EXIST.

Referenced by fwServices::IService::configure(), gui::action::SSlotCaller::configuring(), fwServices::helper::Config::createProxy(), fwRenderQt::SRender::getAspectRatioMode(), fwServices::IService::getAutoConnections(), fwServices::AppConfigManager::getConfigRoot(), fwServices::IService::getObject(), fwServices::IService::getObjectId(), fwRenderQt::IAdaptor::getScene2DRender(), fwRenderVTK::IAdaptor::initialize(), fwGui::IGuiContainerSrv::initialize(), fwServices::helper::Config::parseConnections(), fwServices::IService::reconfiguring(), guiQt::editor::SActivityView::starting(), gui::action::SConfigLauncher::starting(), visuVTKAdaptor::SImage::updateImageOpacity(), visuVTKAdaptor::SModelSeries::updateNormalMode(), and uiMedDataQt::SSeriesViewer::updating().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool fwTools::fwID::hasID ( ) const
protected

Return true if the object has an id set.

Note
This method is thread-safe.

Definition at line 48 of file fwID.cpp.

void fwTools::fwID::resetID ( )
protected

Release the id for the object.

Note
This method is thread-safe

Definition at line 134 of file fwID.cpp.

void fwTools::fwID::setID ( IDType  newID)
protectedvirtual

Set a newID for the object, (newID must not exist in fwID), the oldest one is released.

Warning
Cannot set a empty ID.
Note
This method is thread-safe.

Definition at line 56 of file fwID.cpp.

References OSLM_FATAL_IF.


The documentation for this class was generated from the following files: