Medical Imaging Interaction Toolkit  2016.11.0
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,
6  Division of Medical and Biological Informatics
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  http://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 
30 US_BEGIN_NAMESPACE
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 
78 class US_Core_EXPORT Module
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 
356 US_END_NAMESPACE
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
ServiceReference< void > ServiceReferenceU
Definition: usModule.h:40
static void info(const char *fmt,...)
Definition: svm.cpp:100
US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::Module &module)
Definition: usAny.h:163
static std::string GetName(std::string fileName, std::string suffix)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.