Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ParameterSchemaRegistry.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
5#include <map>
6#include <memory>
7#include "./../../third_party/nlohmann/json.hpp"
8#include "PrefabLoader.h"
9
10namespace Olympe
11{
12 using json = nlohmann::json;
13
15 {
16 public:
18
19 // Schema registration and retrieval
21 void UnregisterSchema(const std::string& componentName);
22 bool HasSchema(const std::string& componentName) const;
23
24 const ComponentSchema* GetSchema(const std::string& componentName) const;
25 const std::vector<ComponentSchema>& GetAllSchemas() const;
26
27 // Bulk operations
28 void LoadSchemasFromFile(const std::string& filePath);
29 void LoadSchemasFromDirectory(const std::string& directoryPath);
30 void ClearAllSchemas();
31
32 // Filtering and search
33 std::vector<std::string> GetSchemaNames() const;
34 std::vector<ComponentSchema> GetSchemasByCategory(const std::string& category) const;
35 std::vector<ComponentSchema> SearchSchemas(const std::string& query) const;
36
37 // Categories
38 std::vector<std::string> GetCategories() const;
39 std::vector<ComponentSchema> GetSchemasInCategory(const std::string& category) const;
40
41 // Parameter definitions
43 const std::string& componentName,
44 const std::string& parameterName) const;
45
46 std::vector<ParameterDefinition> GetParametersForComponent(
47 const std::string& componentName) const;
48
49 // Validation
50 bool ValidateComponent(const ComponentData& component) const;
52 const std::string& componentName,
53 const std::string& parameterName,
54 const std::string& value) const;
55
56 // Caching and performance
58 void ClearCache();
59
60 // Statistics
61 size_t GetSchemaCount() const;
62 size_t GetCategoryCount() const;
63 size_t GetTotalParameterCount() const;
64
65 // Deprecated schemas
66 bool IsSchemaDeprecated(const std::string& componentName) const;
67 std::vector<ComponentSchema> GetDeprecatedSchemas() const;
68
69 private:
72
73 // Prevent copying
76
77 std::vector<ComponentSchema> m_schemas;
78 std::map<std::string, size_t> m_schemaIndex;
79 std::map<std::string, std::vector<size_t>> m_categoryIndex;
80
81 void UpdateIndices();
83 };
84}
nlohmann::json json
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
std::vector< std::string > GetSchemaNames() const
bool IsSchemaDeprecated(const std::string &componentName) const
std::vector< ComponentSchema > SearchSchemas(const std::string &query) const
bool ValidateComponent(const ComponentData &component) const
void UnregisterSchema(const std::string &componentName)
bool ValidateParameter(const std::string &componentName, const std::string &parameterName, const std::string &value) const
std::map< std::string, size_t > m_schemaIndex
const ParameterDefinition * GetParameterDefinition(const std::string &componentName, const std::string &parameterName) const
ParameterSchemaRegistry(const ParameterSchemaRegistry &)=delete
std::vector< ComponentSchema > m_schemas
std::vector< std::string > GetCategories() const
static ParameterSchemaRegistry & Get()
std::map< std::string, std::vector< size_t > > m_categoryIndex
bool HasSchema(const std::string &componentName) const
std::vector< ComponentSchema > GetSchemasInCategory(const std::string &category) const
void RegisterSchema(const ComponentSchema &schema)
const std::vector< ComponentSchema > & GetAllSchemas() const
void LoadSchemasFromDirectory(const std::string &directoryPath)
static ParameterSchemaRegistry * s_instance
std::vector< ComponentSchema > GetSchemasByCategory(const std::string &category) const
const ComponentSchema * GetSchema(const std::string &componentName) const
std::vector< ParameterDefinition > GetParametersForComponent(const std::string &componentName) const
ParameterSchemaRegistry & operator=(const ParameterSchemaRegistry &)=delete
std::vector< ComponentSchema > GetDeprecatedSchemas() const
void LoadSchemasFromFile(const std::string &filePath)
< Provides AssetID and INVALID_ASSET_ID
nlohmann::json json