Major architectural improvement to decouple interfaces from JSON implementation: **New Abstractions:** - Created IDataValue interface for type-safe data access - All interfaces now use IDataNode instead of nlohmann::json - Enables future backend flexibility (JSON, MessagePack, etc.) **Updated Interfaces:** - ISerializable: serialize() returns IDataNode, deserialize() takes IDataNode - IModule: process(), getState(), setState(), getHealthStatus() use IDataNode - IIO: Message struct and publish() use IDataNode - ITaskScheduler: scheduleTask() and getCompletedTask() use IDataNode - IModuleSystem: queryModule() uses IDataNode - IEngine: Removed JSON dependency - IDataNode: getData(), setData(), queryByProperty() use IDataValue **Benefits:** - Clean separation between interface and implementation - No JSON leakage into public APIs - Easier testing and mocking - Potential for multiple backend implementations - Better encapsulation and abstraction **Note:** Concrete implementations still use JSON internally - this is an interface-only refactoring for better architecture. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
29 lines
605 B
C++
29 lines
605 B
C++
#pragma once
|
|
|
|
#include "IDataNode.h"
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
namespace warfactory {
|
|
|
|
class SerializationRegistry;
|
|
|
|
class ASerializable {
|
|
private:
|
|
std::string instance_id;
|
|
|
|
public:
|
|
ASerializable(const std::string& id);
|
|
virtual ~ASerializable();
|
|
|
|
const std::string& getInstanceId() const { return instance_id; }
|
|
|
|
virtual std::unique_ptr<IDataNode> serialize() const = 0;
|
|
virtual void deserialize(const IDataNode& data) = 0;
|
|
|
|
protected:
|
|
void registerForSerialization();
|
|
void unregisterFromSerialization();
|
|
};
|
|
|
|
} // namespace warfactory
|