| 29 | } |
| 30 | |
| 31 | ExecutableBase::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 |