CAD Exchanger SDK
cadex::Base_Settings Class Reference

The Base_Settings class defines a container of global CAD Exchanger parameters. More...

Public Types

enum  Id { ConcurrentMode, Common_ConcurrentMode = ConcurrentMode, UseExceptions, UserDefined = 10000 }
 Describes values used to identify CAD Exchanger settings. More...
 

Public Member Functions

void SetValue (const Id theId, int theVal)
 Sets integer parameter value. More...
 
void SetValue (const Id theId, double theVal)
 Sets double parameter value. More...
 
void SetValue (const Id theId, bool theVal)
 Sets boolean parameter value. More...
 
void SetValue (const Id theId, const UTF16 *theVal)
 Sets string parameter value. More...
 
int IntValue (const Id theId, int theDefaultVal) const
 Returns integer parameter value. More...
 
double DoubleValue (const Id theId, double theDefaultVal) const
 Returns double parameter value. More...
 
bool BoolValue (const Id theId, bool theDefaultVal) const
 Returns boolean parameter value. More...
 
const UTF16StringValue (const Id theId, const UTF16 *theDefaultVal) const
 Returns string parameter value.
 

Static Public Member Functions

static const std::shared_ptr< Base_Settings > & Default ()
 Returns global settings object. More...
 

Protected Member Functions

 Base_Settings ()
 Constructor. More...
 

Detailed Description

The Base_Settings class defines a container of global CAD Exchanger parameters.

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

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

Setting support several types of parameters:

  • integer;
  • boolean;
  • double.

Each parameter is given an id specified by the Base_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 CAD Exchanger versions (except UserDefined value). As new ids appear they may be inserted between existing ones.
const auto& aSettings = Base_Settings::Default();
const int aUserMaxPrecisionId = Base_Settings::UserDefined + 2;
aSettings->SetValue (aUserMaxPrecisionId, 0.1);
bool anIsConcurrent = aSettings->BoolValue (Base_Settings::Common_ConcurrentMode, true);

Member Enumeration Documentation

◆ Id

Describes values used to identify CAD Exchanger settings.

Enumerator
Common_ConcurrentMode 

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

UseExceptions 

(bool) If True then functions of the SDK can throw exceptions. By default is false.

See also
Error handling

Constructor & Destructor Documentation

◆ Base_Settings()

cadex::Base_Settings::Base_Settings ( )
protected

Constructor.

Initializes with parameters with default values.

Member Function Documentation

◆ BoolValue()

bool cadex::Base_Settings::BoolValue ( const Id  theId,
bool  theDefaultValue 
) const

Returns boolean parameter value.

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

◆ Default()

const std::shared_ptr< Base_Settings > & cadex::Base_Settings::Default ( )
static

Returns global settings object.

In multi-threaded applications, when you call this method for the first time ensure that there are no race conditions.

◆ DoubleValue()

double cadex::Base_Settings::DoubleValue ( const Id  theId,
double  theDefaultValue 
) const

Returns double parameter value.

Returns a 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::Base_Settings::IntValue ( const Id  theId,
int  theDefaultValue 
) const

Returns integer parameter value.

Returns a 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::Base_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().

◆ SetValue() [2/4]

void cadex::Base_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() [3/4]

void cadex::Base_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() [4/4]

void cadex::Base_Settings::SetValue ( const Id  theId,
const UTF16 theValue 
)

Sets string parameter value.

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

See also
StringValue().