Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ParameterSchemaRegistry Class Reference

#include <ParameterSchema.h>

Public Member Functions

 ParameterSchemaRegistry (const ParameterSchemaRegistry &)=delete
 
ParameterSchemaRegistryoperator= (const ParameterSchemaRegistry &)=delete
 
 ParameterSchemaRegistry (ParameterSchemaRegistry &&)=delete
 
ParameterSchemaRegistryoperator= (ParameterSchemaRegistry &&)=delete
 
void InitializeBuiltInSchemas ()
 
bool LoadFromJSON (const std::string &filepath)
 
bool LoadSchemaFromFile (const std::string &filepath)
 
size_t GetSchemaCount () const
 
const ParameterSchemaEntryFindParameterSchema (const std::string &parameterName) const
 
const ComponentSchemaGetComponentSchema (const std::string &componentType) const
 
bool ValidateParameter (const std::string &parameterName, const ComponentParameter &param) const
 
void RegisterParameterSchema (const ParameterSchemaEntry &entry)
 
void DiscoverComponentSchema (const ComponentDefinition &componentDef)
 
void DiscoverSchemasFromPrefab (const PrefabBlueprint &prefab)
 

Static Public Member Functions

static ParameterSchemaRegistryGetInstance ()
 

Private Member Functions

 ParameterSchemaRegistry ()=default
 
 ~ParameterSchemaRegistry ()=default
 
void EnsureInitialized ()
 
void AutoRegisterParameter (const std::string &componentType, const std::string &paramName, ComponentParameter::Type paramType, const ComponentParameter &defaultValue)
 
ComponentParameter::Type StringToParameterType (const std::string &typeStr) const
 
ComponentParameter ParseDefaultValue (const nlohmann::json &valueJson, ComponentParameter::Type type) const
 

Private Attributes

bool isInitialized_ = false
 
std::map< std::string, ComponentSchemacomponentSchemas_
 
std::map< std::string, std::string > parameterToComponent_
 
std::map< std::string, std::string > aliasToParameter_
 

Detailed Description

Definition at line 67 of file ParameterSchema.h.

Constructor & Destructor Documentation

◆ ParameterSchemaRegistry() [1/3]

ParameterSchemaRegistry::ParameterSchemaRegistry ( const ParameterSchemaRegistry )
delete

◆ ParameterSchemaRegistry() [2/3]

ParameterSchemaRegistry::ParameterSchemaRegistry ( ParameterSchemaRegistry &&  )
delete

◆ ParameterSchemaRegistry() [3/3]

ParameterSchemaRegistry::ParameterSchemaRegistry ( )
privatedefault

◆ ~ParameterSchemaRegistry()

ParameterSchemaRegistry::~ParameterSchemaRegistry ( )
privatedefault

Member Function Documentation

◆ AutoRegisterParameter()

void ParameterSchemaRegistry::AutoRegisterParameter ( const std::string &  componentType,
const std::string &  paramName,
ComponentParameter::Type  paramType,
const ComponentParameter defaultValue 
)
private

Definition at line 714 of file ParameterSchema.cpp.

References GetComponentTypeID_Static(), and RegisterParameterSchema().

Referenced by DiscoverComponentSchema().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DiscoverComponentSchema()

void ParameterSchemaRegistry::DiscoverComponentSchema ( const ComponentDefinition componentDef)

Definition at line 673 of file ParameterSchema.cpp.

References AutoRegisterParameter(), componentSchemas_, GetComponentTypeID_Static(), and SYSTEM_LOG.

Referenced by DiscoverSchemasFromPrefab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DiscoverSchemasFromPrefab()

void ParameterSchemaRegistry::DiscoverSchemasFromPrefab ( const PrefabBlueprint prefab)

Definition at line 706 of file ParameterSchema.cpp.

References DiscoverComponentSchema(), and GetComponentTypeID_Static().

Referenced by PrefabScanner::ParsePrefab().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnsureInitialized()

void ParameterSchemaRegistry::EnsureInitialized ( )
private

Definition at line 19 of file ParameterSchema.cpp.

References InitializeBuiltInSchemas(), isInitialized_, and SYSTEM_LOG.

Referenced by GetInstance().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ FindParameterSchema()

const ParameterSchemaEntry * ParameterSchemaRegistry::FindParameterSchema ( const std::string &  parameterName) const

Definition at line 559 of file ParameterSchema.cpp.

References aliasToParameter_, componentSchemas_, GetComponentTypeID_Static(), ComponentSchema::parameters, and parameterToComponent_.

Referenced by ValidateParameter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetComponentSchema()

const ComponentSchema * ParameterSchemaRegistry::GetComponentSchema ( const std::string &  componentType) const

Definition at line 596 of file ParameterSchema.cpp.

References componentSchemas_, and GetComponentTypeID_Static().

Referenced by ParseParameterWithSchema().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInstance()

static ParameterSchemaRegistry & ParameterSchemaRegistry::GetInstance ( )
inlinestatic

◆ GetSchemaCount()

size_t ParameterSchemaRegistry::GetSchemaCount ( ) const

Definition at line 554 of file ParameterSchema.cpp.

References parameterToComponent_.

Referenced by PrefabScanner::Initialize().

+ Here is the caller graph for this function:

◆ InitializeBuiltInSchemas()

void ParameterSchemaRegistry::InitializeBuiltInSchemas ( )

◆ LoadFromJSON()

bool ParameterSchemaRegistry::LoadFromJSON ( const std::string &  filepath)

◆ LoadSchemaFromFile()

bool ParameterSchemaRegistry::LoadSchemaFromFile ( const std::string &  filepath)

Definition at line 370 of file ParameterSchema.cpp.

References LoadFromJSON().

+ Here is the call graph for this function:

◆ operator=() [1/2]

ParameterSchemaRegistry & ParameterSchemaRegistry::operator= ( const ParameterSchemaRegistry )
delete

◆ operator=() [2/2]

ParameterSchemaRegistry & ParameterSchemaRegistry::operator= ( ParameterSchemaRegistry &&  )
delete

◆ ParseDefaultValue()

ComponentParameter ParameterSchemaRegistry::ParseDefaultValue ( const nlohmann::json valueJson,
ComponentParameter::Type  type 
) const
private

◆ RegisterParameterSchema()

void ParameterSchemaRegistry::RegisterParameterSchema ( const ParameterSchemaEntry entry)

Definition at line 650 of file ParameterSchema.cpp.

References componentSchemas_, ComponentSchema::componentType, GetComponentTypeID_Static(), and parameterToComponent_.

Referenced by AutoRegisterParameter(), InitializeBuiltInSchemas(), and LoadFromJSON().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ StringToParameterType()

ComponentParameter::Type ParameterSchemaRegistry::StringToParameterType ( const std::string &  typeStr) const
private

◆ ValidateParameter()

bool ParameterSchemaRegistry::ValidateParameter ( const std::string &  parameterName,
const ComponentParameter param 
) const

Member Data Documentation

◆ aliasToParameter_

std::map<std::string, std::string> ParameterSchemaRegistry::aliasToParameter_
private

Definition at line 136 of file ParameterSchema.h.

Referenced by FindParameterSchema(), and InitializeBuiltInSchemas().

◆ componentSchemas_

std::map<std::string, ComponentSchema> ParameterSchemaRegistry::componentSchemas_
private

◆ isInitialized_

bool ParameterSchemaRegistry::isInitialized_ = false
private

Definition at line 118 of file ParameterSchema.h.

Referenced by EnsureInitialized().

◆ parameterToComponent_

std::map<std::string, std::string> ParameterSchemaRegistry::parameterToComponent_
private

The documentation for this class was generated from the following files: