OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::ConfigOptionEnum< T > Class Template Reference

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

Inheritance diagram for Slic3r::ConfigOptionEnum< T >:
Collaboration diagram for Slic3r::ConfigOptionEnum< T >:

Public Member Functions

 ConfigOptionEnum ()
 ConfigOptionEnum (T _value)
ConfigOptionType type () const override
ConfigOption * clone () const override
ConfigOptionEnum< T > & operator= (const ConfigOption *opt)
bool operator== (const ConfigOptionEnum< T > &rhs) const throw ()
bool operator< (const ConfigOptionEnum< T > &rhs) const throw ()
int getInt () const override
void setInt (int val) override
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
 operator T () const
bool operator== (const T &rhs) const throw ()
bool operator!= (const T &rhs) const throw ()
bool operator!= (const ConfigOption &rhs) const
bool operator< (const T &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 ()
static bool has (T value)
static const t_config_enum_names & get_enum_names ()
static const t_config_enum_values & get_enum_values ()
static bool from_string (const std::string &str, T &value)

Public Attributes

T value

Detailed Description

template<class T>
class Slic3r::ConfigOptionEnum< T >

Constructor & Destructor Documentation

◆ ConfigOptionEnum() [1/2]

template<class T>
Slic3r::ConfigOptionEnum< T >::ConfigOptionEnum ( )
inline
2079: ConfigOptionSingle<T>(static_cast<T>(0)) {}
Definition Config.hpp:2076
ConfigOptionSingle(T value)
Definition Config.hpp:330

References Slic3r::ConfigOptionSingle< T >::ConfigOptionSingle().

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

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

◆ ConfigOptionEnum() [2/2]

template<class T>
Slic3r::ConfigOptionEnum< T >::ConfigOptionEnum ( T _value)
inlineexplicit

References Slic3r::ConfigOptionSingle< T >::ConfigOptionSingle().

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

Reimplemented in Slic3r::ConfigOptionVector< T >, Slic3r::ConfigOptionVector< double >, Slic3r::ConfigOptionVector< FloatOrPercent >, Slic3r::ConfigOptionVector< int >, Slic3r::ConfigOptionVector< std::string >, Slic3r::ConfigOptionVector< std::vector< int > >, Slic3r::ConfigOptionVector< unsigned char >, Slic3r::ConfigOptionVector< Vec2d >, and Slic3r::ConfigOptionVector< Vec2ds >.

314 {
315 if (*this == *rhs)
316 return false;
317 *this = *rhs;
318 return true;
319 }

Referenced by Slic3r::compute_filament_override_value().

Here is the caller graph for this function:

◆ clone()

template<class T>
ConfigOption * Slic3r::ConfigOptionEnum< T >::clone ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2084{ return new ConfigOptionEnum<T>(*this); }
ConfigOptionEnum()
Definition Config.hpp:2079

References ConfigOptionEnum().

Here is the call graph for this function:

◆ deserialize()

template<class T>
bool Slic3r::ConfigOptionEnum< T >::deserialize ( const std::string & str,
bool append = false )
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2114 {
2115 UNUSED(append);
2116 return from_string(str, this->value);
2117 }
static bool from_string(const std::string &str, T &value)
Definition Config.hpp:2132
T value
Definition Config.hpp:329
#define UNUSED(x)
Definition libslic3r.h:112

References Slic3r::append(), from_string(), and UNUSED.

Here is the call graph for this function:

◆ from_string()

template<class T>
bool Slic3r::ConfigOptionEnum< T >::from_string ( const std::string & str,
T & value )
inlinestatic
2133 {
2135 auto it = enum_keys_map.find(str);
2136 if (it == enum_keys_map.end())
2137 return false;
2138 value = static_cast<T>(it->second);
2139 return true;
2140 }
static const t_config_enum_values & get_enum_values()

References get_enum_values(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::_BBS_3MF_Importer::_handle_start_config_metadata(), deserialize(), Slic3r::Preset::get_default_bed_type(), and Slic3r::GCodeThumbnails::make_and_check_thumbnail_list().

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

◆ get_enum_names()

template<class T>
const t_config_enum_names & Slic3r::ConfigOptionEnum< T >::get_enum_names ( )
static

Referenced by Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::convert_to_nvt_type(), Slic3r::PrintConfigDef::handle_legacy_composite(), serialize(), Slic3r::AppConfig::set_defaults(), Slic3r::GUI::set_prefered_map_mode(), and Slic3r::GUI::validate_thumbnails_string().

Here is the caller graph for this function:

◆ get_enum_values()

◆ getBool()

virtual bool Slic3r::ConfigOption::getBool ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionBool.

296{ throw BadOptionTypeException("Calling ConfigOption::getBool on a non-boolean ConfigOption"); }

Referenced by Slic3r::_BBS_3MF_Exporter::_add_model_config_file_to_archive(), Slic3r::GUI::MenuFactory::append_menu_items_flush_options(), Slic3r::Print::apply(), Slic3r::GUI::PartPlate::estimate_wipe_tower_footprint(), Slic3r::GUI::PartPlate::get_extruders(), Slic3r::GUI::PartPlate::get_extruders_under_cli(), Slic3r::GUI::PartPlate::get_object_filament_extruders(), and Slic3r::GUI::ArrangeJob::prepare_wipe_tower().

Here is the caller graph for this function:

◆ getFloat()

virtual double Slic3r::ConfigOption::getFloat ( ) const
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionFloat.

295{ throw BadOptionTypeException("Calling ConfigOption::getFloat on a non-float ConfigOption"); }

Referenced by Slic3r::estimate_wipe_tower_first_layer_outline(), Slic3r::GUI::PartPlate::estimate_wipe_tower_footprint(), Slic3r::GUI::PartPlate::get_object_filament_extruders(), Slic3r::GUI::get_string_value(), Slic3r::CLI::run(), Slic3r::client::MyContext::scalar_variable_to_expr(), Slic3r::client::MyContext::vector_element_to_expr(), and Slic3r::GUI::PartPlate::wipe_tower_obstacles().

Here is the caller graph for this function:

◆ getInt()

template<class T>
int Slic3r::ConfigOptionEnum< T >::getInt ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOption.

2088{ return (int)this->value; }

◆ has()

template<class T>
bool Slic3r::ConfigOptionEnum< T >::has ( T value)
inlinestatic
2120 {
2121 for (const auto &kvp : ConfigOptionEnum<T>::get_enum_values())
2122 if (kvp.second == value)
2123 return true;
2124 return false;
2125 }

References get_enum_values(), and Slic3r::ConfigOptionSingle< T >::value.

Referenced by Slic3r::GUI::GLCanvas3D::reload_scene().

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

◆ hash()

template<class T>
size_t Slic3r::ConfigOptionSingle< T >::hash ( ) const
throw ( )
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

353{ return std::hash<T>{}(this->value); }
Definition Config.hpp:327

◆ is_nil()

◆ is_scalar()

bool Slic3r::ConfigOption::is_scalar ( ) const
inlineinherited

◆ is_vector()

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

References is_scalar().

Referenced by Slic3r::client::MyContext::copy_vector_variable_to_vector_variable(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::GUI::Tab::options_list_storage_key(), Slic3r::DynamicConfig::read_cli(), Slic3r::client::MyContext::scalar_variable_new_from_scalar_expression(), Slic3r::client::MyContext::vector_variable_element_assign_scalar(), and Slic3r::client::MyContext::vector_variable_new_from_copy().

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

◆ nullable()

◆ operator T()

template<class T>
Slic3r::ConfigOptionSingle< T >::operator T ( ) 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]

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

◆ operator<() [1/2]

template<class T>
bool Slic3r::ConfigOptionEnum< T >::operator< ( const ConfigOptionEnum< T > & rhs) const
throw ( )
inline
2087{ return int(this->value) < int(rhs.value); }

References ConfigOptionEnum().

Here is the call graph for this function:

◆ operator<() [2/2]

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

◆ operator=()

template<class T>
ConfigOptionEnum< T > & Slic3r::ConfigOptionEnum< T >::operator= ( const ConfigOption * opt)
inline
2085{ this->set(opt); return *this; }
void set(const ConfigOption *rhs) override
Definition Config.hpp:2099

References ConfigOptionEnum(), and set().

Here is the call graph for this function:

◆ operator==() [1/3]

template<class T>
bool Slic3r::ConfigOptionEnum< T >::operator== ( const ConfigOption & rhs) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2092 {
2093 if (rhs.type() != this->type())
2094 throw ConfigurationError("ConfigOptionEnum<T>: Comparing incompatible types");
2095 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
2096 return this->value == (T)rhs.getInt();
2097 }
int getInt() const override
Definition Config.hpp:2088
ConfigOptionType type() const override
Definition Config.hpp:2083

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

Here is the call graph for this function:

◆ operator==() [2/3]

template<class T>
bool Slic3r::ConfigOptionEnum< T >::operator== ( const ConfigOptionEnum< T > & rhs) const
throw ( )
inline
2086{ return this->value == rhs.value; }

References ConfigOptionEnum().

Here is the call graph for this function:

◆ operator==() [3/3]

template<class T>
bool Slic3r::ConfigOptionSingle< T >::operator== ( const T & rhs) const
throw ( )
inlineinherited
349{ return this->value == rhs; }

◆ overriden_by()

virtual bool Slic3r::ConfigOption::overriden_by ( const ConfigOption * rhs) const
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionVector< T >, Slic3r::ConfigOptionVector< double >, Slic3r::ConfigOptionVector< FloatOrPercent >, Slic3r::ConfigOptionVector< int >, Slic3r::ConfigOptionVector< std::string >, Slic3r::ConfigOptionVector< std::vector< int > >, Slic3r::ConfigOptionVector< unsigned char >, Slic3r::ConfigOptionVector< Vec2d >, and Slic3r::ConfigOptionVector< Vec2ds >.

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

References nullable().

Here is the call graph for this function:

◆ serialize()

template<class T>
std::string Slic3r::ConfigOptionEnum< T >::serialize ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2107 {
2109 assert(static_cast<int>(this->value) < int(names.size()));
2110 return names[static_cast<int>(this->value)];
2111 }
static const t_config_enum_names & get_enum_names()

References get_enum_names().

Here is the call graph for this function:

◆ set()

template<class T>
void Slic3r::ConfigOptionEnum< T >::set ( const ConfigOption * rhs)
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2099 {
2100 if (rhs->type() != this->type())
2101 throw ConfigurationError("ConfigOptionEnum<T>: Assigning an incompatible type");
2102 // rhs could be of the following type: ConfigOptionEnumGeneric or ConfigOptionEnum<T>
2103 this->value = (T)rhs->getInt();
2104 }

References 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()

template<class T>
void Slic3r::ConfigOptionEnum< T >::setInt ( int val)
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOption.

2089{ this->value = T(val); }

◆ static_type()

template<class T>
ConfigOptionType Slic3r::ConfigOptionEnum< T >::static_type ( )
inlinestatic
2082{ return coEnum; }

References Slic3r::coEnum.

Referenced by type().

Here is the caller graph for this function:

◆ type()

template<class T>
ConfigOptionType Slic3r::ConfigOptionEnum< T >::type ( ) const
inlineoverridevirtual

Implements Slic3r::ConfigOption.

2083{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:2082

References static_type().

Here is the call graph for this function:

Member Data Documentation

◆ value

template<class T>
T Slic3r::ConfigOptionSingle< T >::value
inherited

Referenced by ConfigOptionSingle(), Slic3r::GUI::Sidebar::Sidebar(), Slic3r::_BBS_3MF_Importer::_extract_project_embedded_presets_from_archive(), Slic3r::Print::_make_wipe_tower(), Slic3r::GUI::ObjectTableSettings::add_missed_options(), Slic3r::append_bed_exclude_volumes(), Slic3r::WipeTowerIntegration::append_tcr(), Slic3r::Print::apply(), Slic3r::GCodeProcessor::apply_config(), Slic3r::GCodeProcessor::apply_config(), Slic3r::GUI::ConfigManipulation::apply_null_fff_config(), Slic3r::apply_to_print_region_config(), Slic3r::GUI::MainFrame::available_print_actions(), Slic3r::GUI::belt_calib_rotation_params(), Slic3r::GUI::PartPlate::belt_open_y(), Slic3r::GUI::ColourPicker::BUILD(), Slic3r::GUI::StaticText::BUILD(), Slic3r::GUI::TextCtrl::BUILD(), Slic3r::GUI::build_plate_tilt_up_direction(), Slic3r::GUI::GuideFrame::BuildProfileJson(), Slic3r::GUI::MainFrame::can_send_gcode(), Slic3r::color_penetration_layers(), Slic3r::compute_filament_override_value(), Slic3r::GUI::ObjectGridTable::construct_object_configs(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::GLGizmoRotate3D::data_changed(), Slic3r::PrinterPresetCollection::default_preset_for(), Slic3r::GUI::GridCellComboBoxRenderer::Draw(), Slic3r::GUI::GridCellFilamentsRenderer::Draw(), Slic3r::GUI::GridCellSupportRenderer::Draw(), Slic3r::GUI::ensure_belt_purge_tower(), Slic3r::GUI::PartPlate::estimate_wipe_tower_polygon(), Slic3r::WipeTower2::extract_wipe_volumes(), Slic3r::first_positive(), Slic3r::PrintRegion::flow(), Slic3r::ConfigOptionEnum< T >::from_string(), Slic3r::GUI::CreatePrinterPresetDialog::generate_process_presets_data(), Slic3r::ConfigBase::get_abs_value(), Slic3r::get_bed_excluded_regions_by_extruder(), Slic3r::GUI::Plater::get_enable_wrapping_detection(), Slic3r::PresetBundle::get_full_flush_matrix(), Slic3r::get_instance_arrange_poly(), Slic3r::GUI::get_min_flush_volumes(), Slic3r::PrintHost::get_print_host_webui(), Slic3r::PresetBundle::get_printer_names_by_printer_type_and_nozzle(), Slic3r::anonymous_namespace{SL1.cpp}::get_raster_params(), Slic3r::GUI::ObjectGridTable::GetValue(), Slic3r::handle_legacy_project_loaded(), Slic3r::ConfigOptionEnum< T >::has(), Slic3r::has_bed_exclude_volumes(), Slic3r::GUI::PartPlate::imex_wipe_tower_hull(), Slic3r::PresetBundle::import_json_presets(), Slic3r::GUI::MainFrame::init_menubar_as_editor(), Slic3r::PrintObject::invalidate_state_by_config_options(), load_default_gcodes_to_config(), Slic3r::GUI::Plater::priv::load_files(), Slic3r::GUI::PartPlateList::load_from_3mf_structure(), Slic3r::ConfigBase::load_from_json(), Slic3r::PresetCollection::load_project_embedded_presets(), Slic3r::PresetCollection::load_user_preset(), Slic3r::min_object_distance(), Slic3r::DynamicPrintConfig::normalize_fdm(), Slic3r::DynamicPrintConfig::normalize_fdm_2(), Slic3r::GUI::PartPlateList::notify_instance_update(), Slic3r::GUI::TabPrinter::on_preset_loaded(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::Tab::on_value_change(), operator==(), Slic3r::prime_tower_is_printed(), Slic3r::GUI::GLCanvas3D::reload_scene(), Slic3r::GUI::GCodeViewer::render_markers(), Slic3r::PresetCollection::resolve_user_preset(), Slic3r::resolve_wipe_tower_type(), Slic3r::CLI::run(), Slic3r::client::MyContext::scalar_variable_to_expr(), Slic3r::GUI::Plater::send_gcode_legacy(), set(), Slic3r::GUI::Plater::set_bed_shape(), Slic3r::GUI::CalibUtils::set_for_auto_pa_model_and_config(), Slic3r::GUI::PointCtrl::set_value(), Slic3r::GUI::ObjectGridTable::SetValue(), Slic3r::GUI::ObjectGridTable::SetValueAsBool(), Slic3r::GUI::ObjectGridTable::SetValueAsDouble(), Slic3r::GUI::ObjectGridTable::SetValueAsLong(), Slic3r::GUI::SelectMachineDialog::Show(), Slic3r::GUI::SelectMachineDialog::slicing_with_fila_switch(), Slic3r::GUI::ObjectGridTable::sort_by_col(), Slic3r::GUI::ObjectGridTable::sort_by_default(), Slic3r::PresetBundle::sync_ams_list(), Slic3r::GUI::TabPrint::toggle_options(), Slic3r::GUI::ConfigManipulation::toggle_print_fff_options(), Slic3r::AvoidCrossingPerimeters::travel_to(), Slic3r::GUI::ConfigManipulation::update_print_fff_config(), Slic3r::GUI::ObjectGridTable::update_value_to_object(), Slic3r::GUI::SelectMachineDialog::use_dynamic_nozzle_map(), and Slic3r::DynamicPrintConfig::validate().


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