humanus.cpp/flow/flow_factory.h

25 lines
710 B
C
Raw Normal View History

2025-03-16 17:17:01 +08:00
#ifndef HUMANUS_FLOW_FACTORY_H
#define HUMANUS_FLOW_FACTORY_H
#include "base.h"
2025-03-19 18:44:54 +08:00
#include "agent/base.h"
2025-03-16 22:56:03 +08:00
#include "planning.h"
2025-03-16 17:17:01 +08:00
namespace humanus {
// Factory for creating different types of flows with support for multiple agents
struct FlowFactory {
2025-03-16 22:56:03 +08:00
template<typename... Args>
static std::unique_ptr<BaseFlow> create_flow(FlowType flow_type, Args&&... args) {
2025-03-16 17:17:01 +08:00
switch (flow_type) {
case FlowType::PLANNING:
2025-03-16 22:56:03 +08:00
return std::make_unique<PlanningFlow>(std::forward<Args>(args)...);
2025-03-16 17:17:01 +08:00
default:
throw std::invalid_argument("Unknown flow type: " + std::to_string(static_cast<int>(flow_type)));
}
}
};
}
#endif // HUMANUS_FLOW_FACTORY_H