Public Types | Public Member Functions

mitk::InputDeviceRegistry Class Reference
[org.mitk.core.ext Plugin]

#include <mitkInputDeviceRegistry.h>

Inheritance diagram for mitk::InputDeviceRegistry:
Inheritance graph
[legend]
Collaboration diagram for mitk::InputDeviceRegistry:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
IInputDeviceDescriptor::Pointer 
InputDeviceDescriptorPtr

Public Member Functions

bool IsA (const std::type_info &type)
const std::type_info & GetType () const
 InputDeviceRegistry ()
 ~InputDeviceRegistry ()
InputDeviceDescriptorPtr Find (const std::string &id) const
std::vector
< InputDeviceDescriptorPtr
GetInputDevices () const

Detailed Description

Documentation in the interface.

See also:
mitk::IInputDeviceRegistry

Definition at line 36 of file mitkInputDeviceRegistry.h.


Member Typedef Documentation

Definition at line 44 of file mitkInputDeviceRegistry.h.


Constructor & Destructor Documentation

mitk::InputDeviceRegistry::InputDeviceRegistry (  )

Definition at line 25 of file mitkInputDeviceRegistry.cpp.

References berry::Platform::GetExtensionPointService(), and mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME.

{
  //initialize the registry by copying all available extension points into a local variable
  berry::IExtensionPointService::Pointer extensionPointService = berry::Platform::GetExtensionPointService();
  std::vector<berry::IConfigurationElement::Pointer> allExtensionsInputDevices 
    = extensionPointService->GetConfigurationElementsFor(mitk::CoreExtConstants::INPUTDEVICE_EXTENSION_NAME);

  for(std::vector<berry::IConfigurationElement::Pointer>::const_iterator it = allExtensionsInputDevices.begin();
    it != allExtensionsInputDevices.end();++it)
  {
    InputDeviceDescriptorPtr temp(new mitk::InputDeviceDescriptor(*it));

    // The equation with the end means, that if there is no such element and 
    // the pointer will be at end (not the last element, actually after it)
    if(this->m_ListRegisteredDevices.find(temp->GetID()) == this->m_ListRegisteredDevices.end())
    {
      m_ListRegisteredDevices.insert(std::make_pair<std::string, InputDeviceDescriptorPtr>(temp->GetID(),temp));
    }
    else
    {
      throw std::runtime_error("The Input Device ID: "+temp->GetID()+" is already registered.");
    }
  }
}
mitk::InputDeviceRegistry::~InputDeviceRegistry (  )

Definition at line 50 of file mitkInputDeviceRegistry.cpp.

{
}

Member Function Documentation

mitk::InputDeviceRegistry::InputDeviceDescriptorPtr mitk::InputDeviceRegistry::Find ( const std::string &  id ) const
See also:
mitk::IInputDeviceRegistry::Find(const std::string& id)

Definition at line 54 of file mitkInputDeviceRegistry.cpp.

{
  Poco::HashMap<std::string,InputDeviceDescriptorPtr>::ConstIterator result = this->m_ListRegisteredDevices.find(id);

  // first = key, second = element or vice versa, if inserted different in the hash map
  if(result != this->m_ListRegisteredDevices.end()) return result->second;

  return InputDeviceDescriptorPtr(0);
}
std::vector< mitk::InputDeviceRegistry::InputDeviceDescriptorPtr > mitk::InputDeviceRegistry::GetInputDevices (  ) const [virtual]
See also:
mitk::IInputDeviceRegistry´::GetInputDevices()

Implements mitk::IInputDeviceRegistry.

Definition at line 64 of file mitkInputDeviceRegistry.cpp.

{
  std::vector<mitk::InputDeviceRegistry::InputDeviceDescriptorPtr> temp;
  for(Poco::HashMap<std::string, InputDeviceDescriptorPtr>::ConstIterator it = m_ListRegisteredDevices.begin(); 
    it != m_ListRegisteredDevices.end();++it)
  {
    // first = key, second = element or vice versa, if inserted different in the hash map
    temp.push_back(it->second);
  }
  return temp;
}
const std::type_info & mitk::InputDeviceRegistry::GetType (  ) const [virtual]

Reimplemented from berry::Service.

Definition at line 82 of file mitkInputDeviceRegistry.cpp.

{
  return typeid(IInputDeviceRegistry);
}
bool mitk::InputDeviceRegistry::IsA ( const std::type_info &  type )

Definition at line 76 of file mitkInputDeviceRegistry.cpp.

References berry::Service::IsA().

{
  std::string name(GetType().name());
  return name == type.name() || berry::Service::IsA(type);
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines