Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ConfigOptionFloat Class Reference

#include <src/libslic3r/Config.hpp>

+ Inheritance diagram for Slic3r::ConfigOptionFloat:
+ Collaboration diagram for Slic3r::ConfigOptionFloat:

Public Member Functions

 ConfigOptionFloat ()
 
 ConfigOptionFloat (double _value)
 
ConfigOptionType type () const override
 
double getFloat () const override
 
ConfigOptionclone () const override
 
bool operator== (const ConfigOptionFloat &rhs) const throw ()
 
bool operator< (const ConfigOptionFloat &rhs) const throw ()
 
std::string serialize () const override
 
bool deserialize (const std::string &str, bool append=false) override
 
ConfigOptionFloatoperator= (const ConfigOption *opt)
 
 operator double () const
 
void set (const ConfigOption *rhs) override
 
bool operator== (const ConfigOption &rhs) const override
 
bool operator== (const double &rhs) const throw ()
 
bool operator!= (const double &rhs) const throw ()
 
bool operator!= (const ConfigOption &rhs) const
 
bool operator< (const double &rhs) const throw ()
 
size_t hash () const override throw ()
 
virtual int getInt () const
 
virtual bool getBool () const
 
virtual void setInt (int)
 
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)
 

Static Public Member Functions

static ConfigOptionType static_type ()
 

Public Attributes

double value
 

Private Member Functions

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

Friends

class cereal::access
 

Detailed Description

Constructor & Destructor Documentation

◆ ConfigOptionFloat() [1/2]

Slic3r::ConfigOptionFloat::ConfigOptionFloat ( )
inline
557: ConfigOptionSingle<double>(0) {}

Referenced by clone().

+ Here is the caller graph for this function:

◆ ConfigOptionFloat() [2/2]

Slic3r::ConfigOptionFloat::ConfigOptionFloat ( double  _value)
inlineexplicit
558: ConfigOptionSingle<double>(_value) {}

Member Function Documentation

◆ apply_override()

virtual bool Slic3r::ConfigOption::apply_override ( const ConfigOption rhs)
inlinevirtualinherited

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

290 {
291 if (*this == *rhs)
292 return false;
293 *this = *rhs;
294 return true;
295 }

Referenced by Slic3r::print_config_diffs().

+ Here is the caller graph for this function:

◆ clone()

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

Implements Slic3r::ConfigOption.

Reimplemented in Slic3r::ConfigOptionPercent, and Slic3r::ConfigOptionFloatOrPercent.

563{ return new ConfigOptionFloat(*this); }
ConfigOptionFloat()
Definition Config.hpp:557

References ConfigOptionFloat().

+ Here is the call graph for this function:

◆ deserialize()

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

Implements Slic3r::ConfigOption.

Reimplemented in Slic3r::ConfigOptionPercent, and Slic3r::ConfigOptionFloatOrPercent.

575 {
576 UNUSED(append);
577 std::istringstream iss(str);
578 iss >> this->value;
579 return !iss.fail();
580 }
double value
Definition Config.hpp:305
#define UNUSED(x)
Definition libslic3r.h:74
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:110

References Slic3r::append(), UNUSED, and Slic3r::ConfigOptionSingle< double >::value.

+ Here is the call graph for this function:

◆ getBool()

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

Reimplemented in Slic3r::ConfigOptionBool.

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

Referenced by Slic3r::client::MyContext::scalar_variable_to_expr().

+ Here is the caller graph for this function:

◆ getFloat()

double Slic3r::ConfigOptionFloat::getFloat ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOption.

562{ return this->value; }

References Slic3r::ConfigOptionSingle< double >::value.

Referenced by Slic3r::get_slice_params().

+ Here is the caller graph for this function:

◆ getInt()

virtual int Slic3r::ConfigOption::getInt ( ) const
inlinevirtualinherited

◆ hash()

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

Implements Slic3r::ConfigOption.

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

◆ is_nil()

◆ is_scalar()

bool Slic3r::ConfigOption::is_scalar ( ) const
inlineinherited
277{ return (int(this->type()) & int(coVectorType)) == 0; }
virtual ConfigOptionType type() const =0
@ coVectorType
Definition Config.hpp:161

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

Referenced by Slic3r::PresetBundle::full_fff_config(), Slic3r::client::MyContext::is_nil_test(), Slic3r::ConfigOption::is_vector(), Slic3r::client::MyContext::legacy_variable_expansion(), Slic3r::PresetBundle::load_config_file_config(), Slic3r::client::MyContext::scalar_variable_assign_scalar(), Slic3r::client::MyContext::scalar_variable_to_expr(), Slic3r::client::MyContext::vector_variable_assign_array(), Slic3r::client::MyContext::vector_variable_assign_initializer_list(), and Slic3r::client::MyContext::vector_variable_new_from_array().

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

◆ is_vector()

◆ nullable()

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

◆ operator double()

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

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

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

◆ operator<() [1/2]

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

◆ operator<() [2/2]

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

◆ operator=()

ConfigOptionFloat & Slic3r::ConfigOptionFloat::operator= ( const ConfigOption opt)
inline
583 {
584 this->set(opt);
585 return *this;
586 }
void set(const ConfigOption *rhs) override
Definition Config.hpp:309

References Slic3r::ConfigOptionSingle< double >::set().

+ Here is the call graph for this function:

◆ operator==() [1/3]

bool Slic3r::ConfigOptionSingle< double >::operator== ( const ConfigOption rhs) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

318 {
319 if (rhs.type() != this->type())
320 throw ConfigurationError("ConfigOptionSingle: Comparing incompatible types");
321 assert(dynamic_cast<const ConfigOptionSingle<T>*>(&rhs));
322 return this->value == static_cast<const ConfigOptionSingle<T>*>(&rhs)->value;
323 }

◆ operator==() [2/3]

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

◆ operator==() [3/3]

bool Slic3r::ConfigOptionSingle< double >::operator== ( const double &  rhs) const
throw (
)
inlineinherited
325{ 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< unsigned char >, and Slic3r::ConfigOptionVector< Vec2d >.

285 {
286 assert(! this->nullable() && ! rhs->nullable());
287 return *this != *rhs;
288 }
virtual bool nullable() const
Definition Config.hpp:280

References Slic3r::ConfigOption::nullable().

Referenced by Slic3r::print_config_diffs().

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

◆ serialize() [1/2]

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

Implements Slic3r::ConfigOption.

Reimplemented in Slic3r::ConfigOptionPercent, and Slic3r::ConfigOptionFloatOrPercent.

568 {
569 std::ostringstream ss;
570 ss << this->value;
571 return ss.str();
572 }

References Slic3r::ConfigOptionSingle< double >::value.

◆ serialize() [2/2]

template<class Archive >
void Slic3r::ConfigOptionFloat::serialize ( Archive &  ar)
inlineprivate
590{ ar(cereal::base_class<ConfigOptionSingle<double>>(this)); }

◆ set()

void Slic3r::ConfigOptionSingle< double >::set ( const ConfigOption rhs)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

310 {
311 if (rhs->type() != this->type())
312 throw ConfigurationError("ConfigOptionSingle: Assigning an incompatible type");
313 assert(dynamic_cast<const ConfigOptionSingle<T>*>(rhs));
314 this->value = static_cast<const ConfigOptionSingle<T>*>(rhs)->value;
315 }

◆ setInt()

virtual void Slic3r::ConfigOption::setInt ( int  )
inlinevirtualinherited

Reimplemented in Slic3r::ConfigOptionInt, and Slic3r::ConfigOptionEnum< T >.

273{ throw BadOptionTypeException("Calling ConfigOption::setInt on a non-int ConfigOption"); }

◆ static_type()

static ConfigOptionType Slic3r::ConfigOptionFloat::static_type ( )
inlinestatic
560{ return coFloat; }
@ coFloat
Definition Config.hpp:164

References Slic3r::coFloat.

Referenced by type().

+ Here is the caller graph for this function:

◆ type()

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

Implements Slic3r::ConfigOption.

Reimplemented in Slic3r::ConfigOptionPercent, and Slic3r::ConfigOptionFloatOrPercent.

561{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:560

References static_type().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ cereal::access

friend class cereal::access
friend

Member Data Documentation

◆ value

double Slic3r::ConfigOptionSingle< double >::value
inherited

The documentation for this class was generated from the following file: