Hide menu
Loading...
Searching...
No Matches

The Settings class defines a container of global Manufacturing Toolkit parameters. More...

#include <cadex/Utilities/Settings.hxx>

Public Types

enum class  Id { ConcurrentMode , UserDefined = 10000 }
 Describes values used to identify Manufacturing Toolkit settings. More...
 

Public Member Functions

void SetValue (const Id theId, int theVal)
 Sets integer parameter value.
 
void SetValue (const Id theId, double theVal)
 Sets double parameter value.
 
void SetValue (const Id theId, bool theVal)
 Sets boolean parameter value.
 
void SetValue (const Id theId, const UTF16String &theVal)
 Sets string parameter value.
 
int IntValue (const Id theId, int theDefaultVal) const
 Returns integer parameter value.
 
double DoubleValue (const Id theId, double theDefaultVal) const
 Returns double parameter value.
 
bool BoolValue (const Id theId, bool theDefaultVal) const
 Returns boolean parameter value.
 
UTF16String StringValue (const Id theId, const UTF16String &theDefaultVal) const
 Returns string parameter value.
 

Static Public Member Functions

static Settings Instance ()
 Returns global settings object.
 

Detailed Description

The Settings class defines a container of global Manufacturing Toolkit parameters.

The settings class is a singleton, there is only one object which is returned by Instance().

Parameters can be set with SetValue() and retrieved with respective Value() methods.

Setting support several types of parameters:

Each parameter is given an id specified by the Settings::Id enumeration. To extend with your own id's make sure you use UserDefined value and greater.

Warning
Do not rely on preservation of id's from between Manufacturing Toolkit versions (except UserDefined value). As new ids appear they may be inserted between existing ones.
using namespace Utilities;
auto& aSettings = Settings::Instance();
auto aUserValueId = Settings::Id (static_cast<int> (Settings::Id::UserDefined) + 2);
aSettings.SetValue (aUserValueId, 0.5);
bool anIsConcurrent = aSettings.BoolValue (Settings::Id::ConcurrentMode, true);
static Settings Instance()
Returns global settings object.
Definition Settings.cxx:124
Id
Describes values used to identify Manufacturing Toolkit settings.
Definition Settings.hxx:37

Member Enumeration Documentation

◆ Id

enum class cadex::Utilities::Settings::Id
strong

Describes values used to identify Manufacturing Toolkit settings.

Enumerator
ConcurrentMode 

(bool) If True then algorithms which can be run in parallel (e.g. conversion, meshing or recognition) will be executed in parallel on multi-core computers. By default is true.

Member Function Documentation

◆ BoolValue()

bool cadex::Utilities::Settings::BoolValue ( const Id theId,
bool theDefaultValue ) const

Returns boolean parameter value.

Returns a bool value for the parameter with theId which has already been registered with SetValue(). If such id has not been registered yet, returns theDefaultValue.

◆ DoubleValue()

double cadex::Utilities::Settings::DoubleValue ( const Id theId,
double theDefaultValue ) const

Returns double parameter value.

Returns a double value for the parameter with theId which has already been registered with SetValue(). If such id has not been registered yet, returns theDefaultValue.

◆ IntValue()

int cadex::Utilities::Settings::IntValue ( const Id theId,
int theDefaultValue ) const

Returns integer parameter value.

Returns an integer value for the parameter with theId which has already been registered with SetValue(). If such id has not been registered yet, returns theDefaultValue.

◆ SetValue() [1/4]

void cadex::Utilities::Settings::SetValue ( const Id theId,
bool theValue )

Sets boolean parameter value.

If the bool parameter with the same id has already been registered, it will be overwritten.

See also
Value().

◆ SetValue() [2/4]

void cadex::Utilities::Settings::SetValue ( const Id theId,
const UTF16String & theValue )

Sets string parameter value.

If the string parameter with the same id has already been registered, it will be overwritten.

See also
StringValue().

◆ SetValue() [3/4]

void cadex::Utilities::Settings::SetValue ( const Id theId,
double theValue )

Sets double parameter value.

If the double parameter with the same id has already been registered, it will be overwritten.

See also
Value().

◆ SetValue() [4/4]

void cadex::Utilities::Settings::SetValue ( const Id theId,
int theValue )

Sets integer parameter value.

If the integer parameter with the same id has already been registered, it will be overwritten.

See also
Value().

◆ StringValue()

UTF16String cadex::Utilities::Settings::StringValue ( const Id theId,
const UTF16String & theDefaultVal ) const

Returns string parameter value.

Returns a string value for the parameter with theId which has already been registered with SetValue(). If such id has not been registered yet, returns theDefaultValue.