OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ConfigOptionEnumGeneric Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp>

Inheritance diagram for Slic3r::ConfigOptionEnumGeneric:
Collaboration diagram for Slic3r::ConfigOptionEnumGeneric:

Public Member Functions

 ConfigOptionEnumGeneric (const t_config_enum_values *keys_map=nullptr)
 ConfigOptionEnumGeneric (const t_config_enum_values *keys_map, int value)
ConfigOptionType type () const override
ConfigOption * clone () const override
ConfigOptionEnumGeneric & operator= (const ConfigOption *opt)
bool operator== (const ConfigOptionEnumGeneric &rhs) const throw ()
bool operator< (const ConfigOptionEnumGeneric &rhs) const throw ()
bool operator== (const ConfigOption &rhs) const override
void set (const ConfigOption *rhs) override
std::string serialize () const override
bool deserialize (const std::string &str, bool append=false) override
int getInt () const override
void setInt (int val) override
bool operator== (const ConfigOptionInt &rhs) const throw ()
 operator int () const
bool operator!= (const int &rhs) const throw ()
bool operator!= (const ConfigOption &rhs) const
bool operator< (const int &rhs) const throw ()
size_t hash () const override throw ()
virtual double getFloat () const
virtual bool getBool () const
bool is_scalar () const
bool is_vector () const
virtual bool nullable () const
virtual bool is_nil () const
virtual bool overriden_by (const ConfigOption *rhs) const
virtual bool apply_override (const ConfigOption *rhs, std::vector< int > &default_index)

Static Public Member Functions

static ConfigOptionType static_type ()

Public Attributes

const t_config_enum_values * keys_map
int value

Private Member Functions

template<class Archive>
void serialize (Archive &ar)

Friends

class cereal::access

Detailed Description

Constructor & Destructor Documentation

◆ ConfigOptionEnumGeneric() [1/2]

Slic3r::ConfigOptionEnumGeneric::ConfigOptionEnumGeneric ( const t_config_enum_values * keys_map = nullptr)
inline
2149: keys_map(keys_map) {}
const t_config_enum_values * keys_map
Definition Config.hpp:2152

References keys_map.

Referenced by clone(), operator<(), operator=(), operator==(), and set().

Here is the caller graph for this function:

◆ ConfigOptionEnumGeneric() [2/2]

Slic3r::ConfigOptionEnumGeneric::ConfigOptionEnumGeneric ( const t_config_enum_values * keys_map,
int value )
inlineexplicit
ConfigOptionInt()
Definition Config.hpp:1021
int value
Definition Config.hpp:329

References Slic3r::ConfigOptionInt::ConfigOptionInt(), keys_map, and Slic3r::ConfigOptionSingle< int >::value.

Here is the call graph for this function:

Member Function Documentation

◆ apply_override()

virtual bool Slic3r::ConfigOption::apply_override ( const ConfigOption * rhs,
std::vector< int > & default_index )
inlinevirtualinherited
314 {
315 if (*this == *rhs)
316 return false;
317 *this = *rhs;
318 return true;
319 }
Definition Config.hpp:327

◆ clone()

ConfigOption * Slic3r::ConfigOptionEnumGeneric::clone ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2156{ return new ConfigOptionEnumGeneric(*this); }
ConfigOptionEnumGeneric(const t_config_enum_values *keys_map=nullptr)
Definition Config.hpp:2149

References ConfigOptionEnumGeneric().

Here is the call graph for this function:

◆ deserialize()

bool Slic3r::ConfigOptionEnumGeneric::deserialize ( const std::string & str,
bool append = false )
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2190 {
2191 UNUSED(append);
2192 auto it = this->keys_map->find(str);
2193 if (it == this->keys_map->end())
2194 return false;
2195 this->value = it->second;
2196 return true;
2197 }
#define UNUSED(x)
Definition libslic3r.h:112
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:157

References Slic3r::append(), and UNUSED.

Here is the call graph for this function:

◆ getBool()

virtual bool Slic3r::ConfigOption::getBool ( ) const
inlinevirtualinherited
296{ throw BadOptionTypeException("Calling ConfigOption::getBool on a non-boolean ConfigOption"); }

◆ getFloat()

virtual double Slic3r::ConfigOption::getFloat ( ) const
inlinevirtualinherited
295{ throw BadOptionTypeException("Calling ConfigOption::getFloat on a non-float ConfigOption"); }

◆ getInt()

int Slic3r::ConfigOptionInt::getInt ( ) const
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

1027{ return this->value; }

Referenced by Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::ModelInstance::get_arrange_polygon(), and Slic3r::GUI::ObjectGridTable::GetValueAsLong().

Here is the caller graph for this function:

◆ hash()

size_t Slic3r::ConfigOptionSingle< int >::hash ( ) const
throw ( )
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

353{ return std::hash<T>{}(this->value); }

◆ is_nil()

virtual bool Slic3r::ConfigOption::is_nil ( ) const
inlinevirtualinherited
306{ return false; }

◆ is_scalar()

bool Slic3r::ConfigOption::is_scalar ( ) const
inlineinherited
301{ return (int(this->type()) & int(coVectorType)) == 0; }
virtual ConfigOptionType type() const=0

◆ is_vector()

bool Slic3r::ConfigOption::is_vector ( ) const
inlineinherited
302{ return ! this->is_scalar(); }
bool is_scalar() const
Definition Config.hpp:301

◆ nullable()

virtual bool Slic3r::ConfigOption::nullable ( ) const
inlinevirtualinherited
304{ return false; }

◆ operator int()

Slic3r::ConfigOptionSingle< int >::operator int ( ) const
inlineinherited
331{ return this->value; }

◆ operator!=() [1/2]

bool Slic3r::ConfigOption::operator!= ( const ConfigOption & rhs) const
inlineinherited
299{ return ! (*this == rhs); }

◆ operator!=() [2/2]

bool Slic3r::ConfigOptionSingle< int >::operator!= ( const int & rhs) const
throw ( )
inlineinherited
350{ return this->value != rhs; }

◆ operator<() [1/2]

bool Slic3r::ConfigOptionEnumGeneric::operator< ( const ConfigOptionEnumGeneric & rhs) const
throw ( )
inline
2159{ return this->value < rhs.value; }

References ConfigOptionEnumGeneric().

Here is the call graph for this function:

◆ operator<() [2/2]

bool Slic3r::ConfigOptionSingle< int >::operator< ( const int & rhs) const
throw ( )
inlineinherited
351{ return this->value < rhs; }

◆ operator=()

ConfigOptionEnumGeneric & Slic3r::ConfigOptionEnumGeneric::operator= ( const ConfigOption * opt)
inline
2157{ this->set(opt); return *this; }
void set(const ConfigOption *rhs) override
Definition Config.hpp:2169

References ConfigOptionEnumGeneric(), and set().

Here is the call graph for this function:

◆ operator==() [1/3]

bool Slic3r::ConfigOptionEnumGeneric::operator== ( const ConfigOption & rhs) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2162 {
2163 if (rhs.type() != this->type())
2164 throw ConfigurationError("ConfigOptionEnumGeneric: Comparing incompatible types");
2165 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
2166 return this->value == rhs.getInt();
2167 }

References Slic3r::ConfigOption::getInt(), and Slic3r::ConfigOption::type().

Here is the call graph for this function:

◆ operator==() [2/3]

bool Slic3r::ConfigOptionEnumGeneric::operator== ( const ConfigOptionEnumGeneric & rhs) const
throw ( )
inline
2158{ return this->value == rhs.value; }

References ConfigOptionEnumGeneric().

Here is the call graph for this function:

◆ operator==() [3/3]

bool Slic3r::ConfigOptionInt::operator== ( const ConfigOptionInt & rhs) const
throw ( )
inlineinherited
1031{ return this->value == rhs.value; }

References ConfigOptionInt().

Here is the call graph for this function:

◆ overriden_by()

virtual bool Slic3r::ConfigOption::overriden_by ( const ConfigOption * rhs) const
inlinevirtualinherited
309 {
310 assert(! this->nullable() && ! rhs->nullable());
311 return *this != *rhs;
312 }
virtual bool nullable() const
Definition Config.hpp:304

◆ serialize() [1/2]

std::string Slic3r::ConfigOptionEnumGeneric::serialize ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2182 {
2183 for (const auto &kvp : *this->keys_map)
2184 if (kvp.second == this->value)
2185 return kvp.first;
2186 return std::string();
2187 }

◆ serialize() [2/2]

template<class Archive>
void Slic3r::ConfigOptionEnumGeneric::serialize ( Archive & ar)
inlineprivate
2201{ ar(cereal::base_class<ConfigOptionInt>(this)); }

◆ set()

void Slic3r::ConfigOptionEnumGeneric::set ( const ConfigOption * rhs)
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2169 {
2170 if (rhs->type() != this->type())
2171 throw ConfigurationError("ConfigOptionEnumGeneric: Assigning an incompatible type");
2172 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
2173 this->value = rhs->getInt();
2174 // Orca: options embedded in a StaticPrintConfig are constructed without a keys_map;
2175 // adopt the source's so a later serialize() can emit names.
2176 if (this->keys_map == nullptr)
2177 if (auto rhs_generic = dynamic_cast<const ConfigOptionEnumGeneric *>(rhs))
2178 this->keys_map = rhs_generic->keys_map;
2179 }

References ConfigOptionEnumGeneric(), Slic3r::ConfigOption::getInt(), and Slic3r::ConfigOption::type().

Referenced by operator=().

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

◆ setInt()

void Slic3r::ConfigOptionInt::setInt ( int val)
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

1028{ this->value = val; }

◆ static_type()

ConfigOptionType Slic3r::ConfigOptionEnumGeneric::static_type ( )
inlinestatic
2154{ return coEnum; }
@ coEnum
Definition Config.hpp:214

References Slic3r::coEnum.

Referenced by type().

Here is the caller graph for this function:

◆ type()

ConfigOptionType Slic3r::ConfigOptionEnumGeneric::type ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2155{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:2154

References static_type().

Here is the call graph for this function:

◆ cereal::access

friend class cereal::access
friend

References cereal::access.

Referenced by cereal::access.

Member Data Documentation

◆ keys_map

const t_config_enum_values* Slic3r::ConfigOptionEnumGeneric::keys_map

◆ value


The documentation for this class was generated from the following file:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Config.hpp