SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModuleDescriptionLookup.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 #ifndef MODULE_DESCRIPTION_LOOKUP_H
30 #define MODULE_DESCRIPTION_LOOKUP_H
31 
34 #include <boost/functional/factory.hpp>
35 #include <Modules/Factory/share.h>
36 
37 namespace SCIRun {
38  namespace Modules {
39  namespace Factory {
40 
42  {
43  public:
47  private:
48 
49  struct ModuleLookupInfoLess
50  {
51  bool operator()(const Dataflow::Networks::ModuleLookupInfo& lhs, const Dataflow::Networks::ModuleLookupInfo& rhs) const
52  {
53  return lhs.module_name_ < rhs.module_name_;
54  }
55  };
56 
57  typedef std::map<Dataflow::Networks::ModuleLookupInfo, Dataflow::Networks::ModuleDescription, ModuleLookupInfoLess> Lookup;
58  Lookup lookup_;
59  bool includeTestingModules_;
60 
61  /// @todo: remove this function and use static MLI from each module
62  template <class ModuleType>
63  void addModuleDesc(const std::string& name, const std::string& category, const std::string& package, const std::string& status, const std::string& desc)
64  {
65  Dataflow::Networks::ModuleLookupInfo info(name, category, package);
66  addModuleDesc<ModuleType>(info, status, desc);
67  }
68 
69  template <class ModuleType>
70  void addModuleDesc(const Dataflow::Networks::ModuleLookupInfo& info, const std::string& status, const std::string& desc)
71  {
73  description.lookupInfo_ = info;
74 
77  description.maker_ = boost::factory<ModuleType*>();
78  description.moduleStatus_ = status;
79  description.moduleInfo_ = desc;
80 
81  lookup_[info] = description;
82 
83  descMap_[info.package_name_][info.category_name_][info.module_name_] = description;
84  }
85 
86  template <class ModuleType>
87  void addModuleDesc(const std::string& status, const std::string& desc)
88  {
89  addModuleDesc<ModuleType>(ModuleType::staticInfo_, status, desc);
90  }
91 
92  void addEssentialModules();
93  void addTestingModules();
94  void addBundleModules();
95  void addBrainSpecificModules();
96  void addMoreModules();
97  };
98  }
99  }
100 }
101 
102 #endif
ModuleLookupInfo lookupInfo_
Definition: ModuleDescription.h:115
Definition: ModuleDescription.h:99
Definition: ModuleDescriptionLookup.h:41
Dataflow::Networks::ModuleDescriptionMap descMap_
Definition: ModuleDescriptionLookup.h:46
#define SCISHARE
Definition: share.h:39
static std::vector< SCIRun::Dataflow::Networks::OutputPortDescription > outputs()
Definition: Module.h:771
std::string module_name_
Definition: ModuleDescription.h:105
const char * name[]
Definition: BoostGraphExampleTests.cc:87
std::vector< InputPortDescription > input_ports_
Definition: ModuleDescription.h:119
std::map< std::string, std::map< std::string, std::map< std::string, ModuleDescription > > > ModuleDescriptionMap
Definition: NetworkFwd.h:88
std::string package_name_
Definition: ModuleDescription.h:103
std::string moduleInfo_
Definition: ModuleDescription.h:118
Definition: ModuleDescription.h:111
ModuleMaker maker_
Definition: ModuleDescription.h:126
std::string category_name_
Definition: ModuleDescription.h:104
std::string moduleStatus_
Definition: ModuleDescription.h:117
static std::vector< SCIRun::Dataflow::Networks::InputPortDescription > inputs()
Definition: Module.h:681
std::vector< OutputPortDescription > output_ports_
Definition: ModuleDescription.h:120