* \ingroup MicroServices * * \brief Returns the module context of the calling module. * * This function allows easy access to the ModuleContext instance from * inside a C++ Micro Services module. * * \return The ModuleContext of the calling module. */
| 39 | * \return The ModuleContext of the calling module. |
| 40 | */ |
| 41 | static inline ModuleContext* GetModuleContext() |
| 42 | { |
| 43 | Module* module = ModuleRegistry::GetModule(US_STR(US_MODULE_NAME)); |
| 44 | if (module) |
| 45 | { |
| 46 | return module->GetModuleContext(); |
| 47 | } |
| 48 | MITK_WARN << "Module '" << US_STR(US_MODULE_NAME) << "' unknown. " |
| 49 | "The calling module probably misses a US_MODULE_NAME compile definition " |
| 50 | "and/or a call to US_INITIALIZE_MODULE in one of its source files."; |
| 51 | return nullptr; |
| 52 | } |
| 53 | |
| 54 | } |
| 55 |