MCPcopy Create free account
hub / github.com/MOLAorg/mola / nameServerImpl

Method nameServerImpl

mola_kernel/src/MinimalModuleContainer.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31ExecutableBase::Ptr MinimalModuleContainer::nameServerImpl(const std::string& name)
32{
33 // Special syntax to sequentially access all existing modules:
34 // If the requested name has the format: "[" + <i>, return the i-th
35 // module, or nullptr if out of range.
36 // This is used by ExecutableBase::findService()
37 if (name.size() >= 2 && name[0] == '[')
38 {
39 const auto idx = std::stoul(name.substr(1));
40 if (idx >= modules_.size())
41 {
42 return ExecutableBase::Ptr();
43 }
44 else
45 {
46 auto it = modules_.begin();
47 std::advance(it, idx);
48 return *it;
49 }
50 }
51 // non numeric search not implemented in this minimal container
52 return ExecutableBase::Ptr();
53}
54
55} // namespace mola

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected