- Remove old 10-engine system (engines/ directory deleted) - Implement C++ triple interface architecture: * IEngine: Execution coordination (Debug → Production) * IModuleSystem: Strategy pattern (Sequential → Threaded → Cluster) * IModule: Pure game logic interface (200-300 lines per module) * IIO: Communication transport (Intra → Local → Network) - Add autonomous module structure: * modules/factory/: Production logic with autonomous build * modules/economy/: Market simulation with autonomous build * modules/logistic/: Supply chain with autonomous build * Each module: CLAUDE.md + CMakeLists.txt + shared/ + build/ - Benefits for Claude Code development: * Ultra-focused contexts (200 lines vs 50K+ lines) * Autonomous builds (cmake . from module directory) * Hot-swappable infrastructure without logic changes * Parallel development across multiple Claude instances 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
69 lines
1.7 KiB
C++
69 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <functional>
|
|
#include <nlohmann/json.hpp>
|
|
|
|
using json = nlohmann::json;
|
|
|
|
namespace warfactory {
|
|
|
|
/**
|
|
* @brief Input/Output interface - swappable transport
|
|
*
|
|
* IntraIO -> Same process (direct call)
|
|
* LocalIO -> Same machine (named pipes/sockets)
|
|
* NetworkIO -> Network/Internet (TCP/WebSocket)
|
|
*/
|
|
class IIO {
|
|
public:
|
|
virtual ~IIO() = default;
|
|
|
|
/**
|
|
* @brief Initialize IO with configuration
|
|
* @param config Transport-specific configuration
|
|
*/
|
|
virtual void initialize(const json& config) = 0;
|
|
|
|
/**
|
|
* @brief Send JSON message
|
|
* @param message JSON data to send
|
|
* @param target Target identifier (module name, endpoint, etc.)
|
|
*/
|
|
virtual void send(const json& message, const std::string& target) = 0;
|
|
|
|
/**
|
|
* @brief Receive JSON message (blocking)
|
|
* @return Received JSON message
|
|
*/
|
|
virtual json receive() = 0;
|
|
|
|
/**
|
|
* @brief Check if message available (non-blocking)
|
|
* @return true if message ready to receive
|
|
*/
|
|
virtual bool hasMessage() const = 0;
|
|
|
|
/**
|
|
* @brief Set message handler for async operation
|
|
* @param handler Function to call when message received
|
|
*/
|
|
virtual void setMessageHandler(std::function<void(const json&)> handler) = 0;
|
|
|
|
/**
|
|
* @brief Start async message processing
|
|
*/
|
|
virtual void startAsync() = 0;
|
|
|
|
/**
|
|
* @brief Stop async processing and cleanup
|
|
*/
|
|
virtual void shutdown() = 0;
|
|
|
|
/**
|
|
* @brief Get IO type identifier
|
|
*/
|
|
virtual std::string getType() const = 0;
|
|
};
|
|
|
|
} // namespace warfactory
|