Sound Bakery  v0.1.0
Open-source audio middleware for games
Loading...
Searching...
No Matches
SB::Engine::NamedParameter Class Reference

Holds discrete named integer values. More...

#include <parameter.h>

Inheritance diagram for SB::Engine::NamedParameter:
Collaboration diagram for SB::Engine::NamedParameter:

Public Member Functions

 NamedParameter ()
 Creates a NamedParameter with min and max values.
 
SB::Core::DatabasePtr< NamedParameterValueaddNewValue (const std::string_view name)
 Adds a new value to the parameter.
 
std::unordered_set< SB::Core::DatabasePtr< NamedParameterValue > > getValues ()
 Gets all named values in this parameter.
 
void setSelectedValue (SB::Core::DatabasePtr< NamedParameterValue > value)
 Sets the parameter value with a DatabasePtr, ensuring the value exists in this parameter.
 
SB::Core::DatabasePtr< NamedParameterValuegetSelectedValue () const
 Get the selected value as a DatabasePtr.
 
- Public Member Functions inherited from SB::Engine::Parameter< SB_ID >
 Parameter (SB_ID min, SB_ID max)
 Creates a Parameter with min and max values set.
 
SB_ID get () const
 Get the current value of the parameter.
 
SB_ID getDefault () const
 
void set (SB_ID value)
 Set the value of the parameter.
 
void setDefault (SB_ID value)
 
ParameterProperty::PropertyChangedDelegategetDelegate ()
 Get the parameter delegate that fires when changing the value.
 
LocalParameter createLocalParameterFromThis () const
 Copies this Parameter to a runtime version, suitable for handling unique variations per game object etc.
 
- Public Member Functions inherited from SB::Core::DatabaseObject
SB_ID getDatabaseID () const
 
void setDatabaseID (SB_ID id)
 
std::string_view getDatabaseName () const
 
void setDatabaseName (std::string_view name)
 
bool getEditorHidden () const
 
void setEditorHidden (bool hidden)
 
 operator SB_ID () const
 
- Public Member Functions inherited from SB::Core::Object
template<typename T >
TtryConvertObject () noexcept
 Gets the most derived type of this object and upcasts it to T.
 
template<typename T >
const TtryConvertObject () const noexcept
 
rttr::type getType () const
 
- Public Member Functions inherited from SB::Core::ObjectUtilities
SB::Engine::SystemgetSystem () const
 
sc_systemgetChef () const
 
ma_enginegetMini () const
 
- Public Member Functions inherited from SB::Core::DatabaseObjectUtilities
virtual void onLoaded ()
 
virtual void onProjectLoaded ()
 
virtual void onDestroy ()
 

Additional Inherited Members

- Public Types inherited from SB::Engine::Parameter< SB_ID >
using ParameterProperty = SB::Core::Property< SB_ID >
 Defines the underlying property type used to store and broadcast values.
 
using LocalParameter = std::pair< SB_ID, ParameterProperty >
 Defines the type used for passing local versions/variations of this parameter.
 
using LocalParameterValuePair = std::pair< SB_ID, SB_ID >
 Defines an ID to a parameter and a value for that parameter.
 
- Public Attributes inherited from SB::Core::ObjectUtilities
std::string m_debugName
 
- Protected Attributes inherited from SB::Engine::Parameter< SB_ID >
SB_ID m_defaultValue
 
SB::Core::Property< SB_ID > m_property
 

Detailed Description

Holds discrete named integer values.

Constructor & Destructor Documentation

◆ NamedParameter()

SB::Engine::NamedParameter::NamedParameter ( )
inline

Creates a NamedParameter 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

◆ addNewValue()

SB::Core::DatabasePtr< NamedParameterValue > SB::Engine::NamedParameter::addNewValue ( 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

◆ getSelectedValue()

SB::Core::DatabasePtr< NamedParameterValue > SB::Engine::NamedParameter::getSelectedValue ( ) const
inline

Get the selected value as a DatabasePtr.

Mainly used in reflection and for displaying in the editor.

Returns

◆ getValues()

std::unordered_set< SB::Core::DatabasePtr< NamedParameterValue > > SB::Engine::NamedParameter::getValues ( )
inline

Gets all named values in this parameter.

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

◆ setSelectedValue()

void SB::Engine::NamedParameter::setSelectedValue ( SB::Core::DatabasePtr< NamedParameterValue 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: