Medical Imaging Interaction Toolkit  2024.06.00
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 
155  ~Module();
156 
166  bool IsLoaded() const;
167 
184 
206  long GetModuleId() const;
207 
218  std::string GetLocation() const;
219 
231  std::string GetName() const;
232 
244  ModuleVersion GetVersion() const;
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
us::ModuleRegistry
Definition: usModuleRegistry.h:41
usModuleVersion.h
ModuleContext
Definition: usModuleContext.h:91
us::GetModuleContext
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
Definition: usGetModuleContext.h:50
us::ServiceReferenceU
ServiceReference< void > ServiceReferenceU
Definition: usModule.h:40
us::ServiceReference
Definition: usModule.h:40
us::ModuleVersion
Definition: usModuleVersion.h:49
us::Any
Definition: usAny.h:163
us::Module
Definition: usModule.h:78
US_BEGIN_NAMESPACE
#define US_BEGIN_NAMESPACE
Definition: usGlobalConfig.h:76
us::ModuleResource
Definition: usModuleResource.h:55
operator<<
US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::Module &module)
US_END_NAMESPACE
#define US_END_NAMESPACE
Definition: usGlobalConfig.h:77
US_PREPEND_NAMESPACE
#define US_PREPEND_NAMESPACE(name)
Definition: usGlobalConfig.h:74
us::ModuleInfo
Definition: usModuleInfo.h:38
US_Core_EXPORT
#define US_Core_EXPORT
Definition: usCoreExport.h:21