MCPcopy Create free account
hub / github.com/MITK/MITK / AutoLoadModules

Function AutoLoadModules

Modules/CppMicroServices/src/usUtils.cpp:160–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160std::vector<std::string> AutoLoadModules(const ModuleInfo& moduleInfo)
161{
162 std::vector<std::string> loadedModules;
163
164 if (moduleInfo.autoLoadDir.empty())
165 {
166 return loadedModules;
167 }
168
169 ModuleSettings::PathList autoLoadPaths = ModuleSettings::GetAutoLoadPaths();
170
171 std::size_t indexOfLastSeparator = moduleInfo.location.find_last_of(DIR_SEP);
172 std::string moduleBasePath = moduleInfo.location.substr(0, indexOfLastSeparator);
173
174 for (ModuleSettings::PathList::iterator i = autoLoadPaths.begin();
175 i != autoLoadPaths.end(); ++i)
176 {
177 if (*i == ModuleSettings::CURRENT_MODULE_PATH())
178 {
179 // Load all modules from a directory located relative to this modules location
180 // and named after this modules library name.
181 *i = moduleBasePath;
182 }
183 }
184
185 // We could have introduced a duplicate above, so remove it.
186 std::sort(autoLoadPaths.begin(), autoLoadPaths.end());
187 autoLoadPaths.erase(std::unique(autoLoadPaths.begin(), autoLoadPaths.end()), autoLoadPaths.end());
188 for (ModuleSettings::PathList::iterator i = autoLoadPaths.begin();
189 i != autoLoadPaths.end(); ++i)
190 {
191 if (i->empty()) continue;
192 std::vector<std::string> paths = AutoLoadModulesFromPath(*i, moduleInfo.autoLoadDir);
193 loadedModules.insert(loadedModules.end(), paths.begin(), paths.end());
194 }
195 return loadedModules;
196}
197
198}
199

Callers 1

StartMethod · 0.85

Calls 5

AutoLoadModulesFromPathFunction · 0.85
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected