refactor: reorganize project structure with modern C++ namespace organization
- Restructure include/ and src/ directories with logical grouping - Move core components to spore/core/ (NodeContext, NetworkManager, TaskManager, ClusterManager, ApiServer) - Move services to spore/services/ (NodeService, NetworkService, ClusterService, TaskService) - Move types to spore/types/ (NodeInfo, ApiTypes, Config) - Move internal components to spore/internal/ (Globals) - Update all #include statements to use new namespace paths - Update platformio.ini build filters for all environments - Update all example files to use new include paths - Maintain backward compatibility for public API - Improve code organization, maintainability, and scalability This reorganization follows modern C++ project structure patterns and provides clear separation between public API, internal implementation, and utilities. All examples compile successfully with the new structure.
This commit is contained in:
51
include/spore/Spore.h
Normal file
51
include/spore/Spore.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include "core/NodeContext.h"
|
||||
#include "core/NetworkManager.h"
|
||||
#include "core/ClusterManager.h"
|
||||
#include "core/ApiServer.h"
|
||||
#include "core/TaskManager.h"
|
||||
#include "Service.h"
|
||||
|
||||
class Spore {
|
||||
public:
|
||||
Spore();
|
||||
Spore(std::initializer_list<std::pair<String, String>> initialLabels);
|
||||
~Spore();
|
||||
|
||||
// Core lifecycle methods
|
||||
void setup();
|
||||
void begin();
|
||||
void loop();
|
||||
|
||||
// Service management
|
||||
void addService(std::shared_ptr<Service> service);
|
||||
void addService(Service* service);
|
||||
|
||||
// Access to core components
|
||||
NodeContext& getContext() { return ctx; }
|
||||
NetworkManager& getNetwork() { return network; }
|
||||
TaskManager& getTaskManager() { return taskManager; }
|
||||
ClusterManager& getCluster() { return cluster; }
|
||||
ApiServer& getApiServer() { return apiServer; }
|
||||
|
||||
|
||||
private:
|
||||
void initializeCore();
|
||||
void registerCoreServices();
|
||||
void startApiServer();
|
||||
|
||||
NodeContext ctx;
|
||||
NetworkManager network;
|
||||
TaskManager taskManager;
|
||||
ClusterManager cluster;
|
||||
ApiServer apiServer;
|
||||
|
||||
std::vector<std::shared_ptr<Service>> services;
|
||||
bool initialized;
|
||||
bool apiServerStarted;
|
||||
};
|
||||
Reference in New Issue
Block a user