AutoForge / cpp /include /dag_engine.h
NOT-OMEGA's picture
Upload 68 files
6a0ff33 verified
Raw
History Blame Contribute Delete
1.27 kB
#pragma once
/**
* AutoForge DAG Engine
*
* Minimal skeleton for Phase 1.
* Full task scheduling will be implemented in Phase 2.
*/
#include <string>
#include <vector>
#include <unordered_map>
#include <functional>
#include <mutex>
namespace autoforge {
/// Represents a single node in the execution DAG.
struct DAGNode {
std::string id;
std::string name;
std::string type; // e.g., "plan", "code", "test", "analyze"
std::vector<std::string> deps; // IDs of dependency nodes
};
/// DAG execution engine — schedules and runs task nodes.
class DAGEngine {
public:
DAGEngine();
~DAGEngine();
/// Get the engine version string.
static std::string version();
/// Add a node to the DAG.
void add_node(const DAGNode& node);
/// Get the number of nodes in the DAG.
size_t node_count() const;
/// Clear all nodes.
void clear();
/// Validate that the DAG has no cycles. Returns true if valid.
bool validate() const;
/// Execute the DAG (Phase 2 — currently a no-op).
/// Returns true on success.
bool execute();
private:
std::vector<DAGNode> nodes_;
std::unordered_map<std::string, size_t> index_;
mutable std::mutex mutex_;
};
} // namespace autoforge