Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
sbk::engine::named_parameter Class Reference

Holds discrete named integer values. More...

#include <parameter.h>

Inheritance diagram for sbk::engine::named_parameter:
Collaboration diagram for sbk::engine::named_parameter:

Public Member Functions

 named_parameter ()
 Creates a named_parameter with min and max values.
 
sbk::core::database_ptr< named_parameter_valueadd_new_value (const std::string_view name)
 Adds a new value to the parameter.
 
std::unordered_set< sbk::core::database_ptr< named_parameter_value > > get_values ()
 Gets all named values in this parameter.
 
void set_selected_value (sbk::core::database_ptr< named_parameter_value > value)
 Sets the parameter value with a DatabasePtr, ensuring the value exists in this parameter.
 
sbk::core::database_ptr< named_parameter_valueget_selected_value () const
 Get the selected value as a DatabasePtr.
 
- Public Member Functions inherited from sbk::engine::parameter< sbk_id >
 parameter (sbk_id min, sbk_id max)
 Creates a parameter with min and max values set.
 
sbk_id get () const
 Get the current value of the parameter.
 
sbk_id get_default () const
 
void set (sbk_id value)
 Set the value of the parameter.
 
void set_default (sbk_id value)
 
parameter_property::property_changed_delegate & get_delegate ()
 Get the parameter delegate that fires when changing the value.
 
local_parameter create_local_parameter_from_this () const
 Copies this parameter to a runtime version, suitable for handling unique variations per game object etc.
 
- Public Member Functions inherited from sbk::core::database_object
auto get_database_id () const -> sbk_id
 
auto get_database_name () const -> std::string_view
 
auto get_editor_hidden () const -> bool
 
auto set_database_id (sbk_id id) -> void
 
auto set_database_name (std::string_view name) -> void
 
auto set_editor_hidden (bool hidden) -> void
 
 operator sbk_id () const
 
auto get_on_update_id () -> MulticastDelegate< sbk_id, sbk_id > &
 
auto get_on_update_name () -> MulticastDelegate< std::string_view, std::string_view > &
 
- Public Member Functions inherited from sbk::core::object
template<typename T >
auto casted_shared_from_this () -> std::shared_ptr< T >
 
template<typename T >
auto try_convert_object () noexcept -> T *
 Gets the most derived type of this object and upcasts it to T.
 
template<typename T >
auto try_convert_object () const noexcept -> const T *
 Const version of try_convert_object.
 
auto destroy () -> void
 
auto get_object_type () const -> rttr::type
 
auto get_owner () const -> object_owner *
 
auto get_owner_object () const -> object *
 
auto get_on_destroy () -> MulticastDelegate< object * > &
 
auto get_flags () const -> object_flags
 
auto set_flags (object_flags flagsToSet) -> void
 
auto clear_flags (object_flags flagsToClear) -> void
 
auto has_flag (object_flags flagsToCheck) -> bool
 
template<class archive_class >
void serialize (archive_class &archive, const unsigned int fileVersion)
 
- Public Member Functions inherited from sbk::core::object_owner
auto create_runtime_object (const rttr::type &type) -> std::shared_ptr< object >
 
auto create_database_object (const rttr::type &type, bool addToDatabase=true) -> std::shared_ptr< database_object >
 
template<typename T >
auto create_runtime_object () -> std::shared_ptr< T >
 
template<typename T >
auto create_database_object (bool addToDatabase=true) -> std::shared_ptr< T >
 
auto add_reference_to_object (std::shared_ptr< database_object > &object) -> void
 
auto remove_object (const std::shared_ptr< object > &object) -> std::vector< std::shared_ptr< sbk::core::object > >::iterator
 
auto destroy_all () -> void
 
auto get_objects () -> std::vector< std::shared_ptr< object > > &
 
auto get_objects () const -> const std::vector< std::shared_ptr< object > > &
 
auto get_objects_size () const -> std::size_t
 

Additional Inherited Members

- Public Types inherited from sbk::engine::parameter< sbk_id >
using parameter_property = sbk::core::property< sbk_id >
 Defines the underlying property type used to store and broadcast values.
 
using local_parameter = std::pair< sbk_id, parameter_property >
 Defines the type used for passing local versions/variations of this parameter.
 
using local_parameter_value_pair = std::pair< sbk_id, sbk_id >
 Defines an ID to a parameter and a value for that parameter.
 

Detailed Description

Holds discrete named integer values.

Each named_parameter_value is a database object, therefore holding a unique ID.

The named_parameter stores the unique id as its parameter value.

Constructor & Destructor Documentation

◆ named_parameter()

sbk::engine::named_parameter::named_parameter ( )
inline

Creates a named_parameter with min and max values.

Warning
Weird parentheses wrapping is required here for Windows min and max macro workaround. See https://stackoverflow.com/questions/40492414/why-does-stdnumeric-limitslong-longmax-fail

Member Function Documentation

◆ add_new_value()

sbk::core::database_ptr< named_parameter_value > sbk::engine::named_parameter::add_new_value ( const std::string_view  name)
inline

Adds a new value to the parameter.

Parameters
nameName of the parameter value
Returns
The newly created parameter value that's in the database

◆ get_selected_value()

sbk::core::database_ptr< named_parameter_value > sbk::engine::named_parameter::get_selected_value ( ) const
inline

Get the selected value as a DatabasePtr.

Mainly used in reflection and for displaying in the editor.

Returns

◆ get_values()

std::unordered_set< sbk::core::database_ptr< named_parameter_value > > sbk::engine::named_parameter::get_values ( )
inline

Gets all named values in this parameter.

If none exists, ensures at least the "None" value exists.

◆ set_selected_value()

void sbk::engine::named_parameter::set_selected_value ( sbk::core::database_ptr< named_parameter_value value)
inline

Sets the parameter value with a DatabasePtr, ensuring the value exists in this parameter.

Internally sets the parameter with the DatabasePtr's ID.

Parameters
value

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