Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
usModule.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center (DKFZ)
6  All rights reserved.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  https://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 ============================================================================*/
21 
22 
23 #ifndef USMODULE_H
24 #define USMODULE_H
25 
26 #include "usModuleVersion.h"
27 
28 #include <vector>
29 
31 
32 class Any;
33 class CoreModuleContext;
34 struct ModuleInfo;
35 class ModuleContext;
36 class ModuleResource;
37 class ModulePrivate;
38 
39 template<class S>
41 
43 
79 {
80 
81 public:
82 
89  static const std::string& PROP_ID();
90 
97  static const std::string& PROP_NAME();
98 
106  static const std::string& PROP_LOCATION();
107 
115  static const std::string& PROP_VERSION();
116 
124  static const std::string& PROP_VENDOR();
125 
133  static const std::string& PROP_DESCRIPTION();
134 
142  static const std::string& PROP_AUTOLOAD_DIR();
143 
153  static const std::string& PROP_AUTOLOADED_MODULES();
154 
156 
166  bool IsLoaded() const;
167 
184 
206  long GetModuleId() const;
207 
218  std::string GetLocation() const;
219 
231  std::string GetName() const;
232 
245 
257  Any GetProperty(const std::string& key) const;
258 
266  std::vector<std::string> GetPropertyKeys() const;
267 
280  std::vector<ServiceReferenceU> GetRegisteredServices() const;
281 
295  std::vector<ServiceReferenceU> GetServicesInUse() const;
296 
307  ModuleResource GetResource(const std::string& path) const;
308 
332  std::vector<ModuleResource> FindResources(const std::string& path, const std::string& filePattern, bool recurse) const;
333 
334 private:
335 
336  friend class CoreModuleActivator;
337  friend class ModuleRegistry;
338  friend class ServiceReferencePrivate;
339 
340  ModulePrivate* d;
341 
342  Module();
343 
344  void Init(CoreModuleContext* coreCtx, ModuleInfo* info);
345  void Uninit();
346 
347  void Start();
348  void Stop();
349 
350  // purposely not implemented
351  Module(const Module &);
352  Module& operator=(const Module&);
353 
354 };
355 
357 
361 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const US_PREPEND_NAMESPACE(Module)& module);
365 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, US_PREPEND_NAMESPACE(Module) const * module);
366 
367 #endif // USMODULE_H
Definition: usAny.h:164
std::string GetName() const
std::vector< ModuleResource > FindResources(const std::string &path, const std::string &filePattern, bool recurse) const
ModuleResource GetResource(const std::string &path) const
static const std::string & PROP_ID()
static const std::string & PROP_VENDOR()
long GetModuleId() const
std::vector< std::string > GetPropertyKeys() const
static const std::string & PROP_AUTOLOAD_DIR()
std::string GetLocation() const
bool IsLoaded() const
static const std::string & PROP_LOCATION()
Any GetProperty(const std::string &key) const
static const std::string & PROP_NAME()
static const std::string & PROP_AUTOLOADED_MODULES()
std::vector< ServiceReferenceU > GetRegisteredServices() const
ModuleContext * GetModuleContext() const
std::vector< ServiceReferenceU > GetServicesInUse() const
ModuleVersion GetVersion() const
static const std::string & PROP_VERSION()
static const std::string & PROP_DESCRIPTION()
US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::Module &module)
ServiceReference< void > ServiceReferenceU
Definition: usModule.h:40
#define US_Core_EXPORT
Definition: usCoreExport.h:21
#define US_END_NAMESPACE
#define US_BEGIN_NAMESPACE
#define US_PREPEND_NAMESPACE(name)