openmanus.cpp/include/tool_collection.h

52 lines
1.1 KiB
C
Raw Permalink Normal View History

2025-03-10 02:38:39 +08:00
#ifndef OPENMANUS_TOOL_COLLECTION_H
#define OPENMANUS_TOOL_COLLECTION_H
#include <string>
#include <vector>
#include <memory>
#include <unordered_map>
#include "tool_base.h"
namespace openmanus {
/**
* @class ToolCollection
* @brief
*/
class ToolCollection {
public:
ToolCollection();
~ToolCollection() = default;
/**
* @brief
* @param tool
*/
void addTool(std::unique_ptr<ToolBase> tool);
/**
* @brief
* @param name
* @return nullptr
*/
ToolBase* getTool(const std::string& name);
/**
* @brief
* @return
*/
std::vector<std::string> getToolNames() const;
/**
* @brief
* @return
*/
size_t size() const { return tools_.size(); }
private:
std::unordered_map<std::string, std::unique_ptr<ToolBase>> tools_;
};
} // namespace openmanus
#endif // OPENMANUS_TOOL_COLLECTION_H