Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usModule.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef USMODULE_H
15 #define USMODULE_H
16 
17 #include <usModuleVersion.h>
18 
19 #include <vector>
20 
21 namespace us {
22 
23 class Any;
24 class CoreModuleContext;
25 struct ModuleInfo;
26 class ModuleContext;
27 class ModuleResource;
28 class ModulePrivate;
29 
30 template<class S>
31 class ServiceReference;
32 
34 
70 {
71 
72 public:
73 
80  static const std::string& PROP_ID();
81 
88  static const std::string& PROP_NAME();
89 
97  static const std::string& PROP_LOCATION();
98 
106  static const std::string& PROP_VERSION();
107 
115  static const std::string& PROP_VENDOR();
116 
124  static const std::string& PROP_DESCRIPTION();
125 
133  static const std::string& PROP_AUTOLOAD_DIR();
134 
144  static const std::string& PROP_AUTOLOADED_MODULES();
145 
148 
158  bool IsLoaded() const;
159 
176 
198  long GetModuleId() const;
199 
210  std::string GetLocation() const;
211 
223  std::string GetName() const;
224 
237 
249  Any GetProperty(const std::string& key) const;
250 
258  std::vector<std::string> GetPropertyKeys() const;
259 
272  std::vector<ServiceReferenceU> GetRegisteredServices() const;
273 
287  std::vector<ServiceReferenceU> GetServicesInUse() const;
288 
299  ModuleResource GetResource(const std::string& path) const;
300 
324  std::vector<ModuleResource> FindResources(const std::string& path, const std::string& filePattern, bool recurse) const;
325 
326 private:
327 
328  friend class CoreModuleActivator;
329  friend class ModuleRegistry;
330  friend class ServiceReferencePrivate;
331 
332  ModulePrivate* d;
333 
334  Module();
335 
336  void Init(CoreModuleContext* coreCtx, ModuleInfo* info);
337  void Uninit();
338 
339  void Start();
340  void Stop();
341 
342  // purposely not implemented
343  Module(const Module &);
344  Module& operator=(const Module&);
345 
346 };
347 
348 }
349 
358 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, const us::Module& module);
367 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, us::Module const * module);
368 
369 #endif // USMODULE_H
#define MITKCPPMICROSERVICES_EXPORT
An Any class represents a general type and is capable of storing any type, supporting type-safe extra...
Definition: usAny.h:145
Here we handle all the modules that are loaded in the framework.
Represents a resource (text file, image, etc.) embedded in a CppMicroServices module.
Version identifier for CppMicroServices modules.
Represents a CppMicroServices module.
Definition: usModule.h:70
std::string GetName() const
Returns the name of this module as specified by the US_CREATE_MODULE CMake macro. The module name tog...
std::vector< ModuleResource > FindResources(const std::string &path, const std::string &filePattern, bool recurse) const
Returns resources in this module.
ModuleResource GetResource(const std::string &path) const
Returns the resource at the specified path in this module. The specified path is always relative to t...
static const std::string & PROP_ID()
Returns the property key for looking up this module's id. The property value is of type long.
static const std::string & PROP_VENDOR()
Returns the property key with a value of module.vendor for looking up this module's vendor informatio...
long GetModuleId() const
Returns this module's unique identifier. This module is assigned a unique identifier by the framework...
std::vector< std::string > GetPropertyKeys() const
Returns a list of top-level property keys for this module.
static const std::string & PROP_AUTOLOAD_DIR()
Returns the property key with a value of module.autoload_dir for looking up this module's auto-load d...
std::string GetLocation() const
Returns this module's location.
bool IsLoaded() const
Returns this module's current state.
static const std::string & PROP_LOCATION()
Returns the property key for looking up this module's location in the file system....
~Module()
Destructor.
Any GetProperty(const std::string &key) const
Returns the value of the specified property for this module. The method returns an empty Any if the p...
static const std::string & PROP_NAME()
Returns the property key for looking up this module's name. The property value is of type std::string...
static const std::string & PROP_AUTOLOADED_MODULES()
Returns the property key with a value of module.autoloaded_modules for looking up this module's auto-...
std::vector< ServiceReferenceU > GetRegisteredServices() const
Returns this module's ServiceReference list for all services it has registered or an empty list if th...
ModuleContext * GetModuleContext() const
Returns this module's ModuleContext. The returned ModuleContext can be used by the caller to act on b...
std::vector< ServiceReferenceU > GetServicesInUse() const
Returns this module's ServiceReference list for all services it is using or returns an empty list if ...
ModuleVersion GetVersion() const
Returns the version of this module as specified by the US_INITIALIZE_MODULE CMake macro....
static const std::string & PROP_VERSION()
Returns the property key with a value of module.version for looking up this module's version identifi...
static const std::string & PROP_DESCRIPTION()
Returns the property key with a value of module.description for looking up this module's description....
ServiceReference< void > ServiceReferenceU
Definition: usModule.h:31
MITKCPPMICROSERVICES_EXPORT std::ostream & operator<<(std::ostream &os, const us::Module &module)
Stream output operator for Module references.
This class is not intended to be used directly. It is exported to support the CppMicroServices module...
Definition: usModuleInfo.h:31