Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::ConfigOptionPercentsTempl< NULLABLE > Class Template Reference

#include <src/libslic3r/Config.hpp>

+ Inheritance diagram for Slic3r::ConfigOptionPercentsTempl< NULLABLE >:
+ Collaboration diagram for Slic3r::ConfigOptionPercentsTempl< NULLABLE >:

Public Member Functions

 ConfigOptionPercentsTempl ()
 
 ConfigOptionPercentsTempl (size_t n, double value)
 
 ConfigOptionPercentsTempl (std::initializer_list< double > il)
 
 ConfigOptionPercentsTempl (const std::vector< double > &vec)
 
 ConfigOptionPercentsTempl (std::vector< double > &&vec)
 
ConfigOptionType type () const override
 
ConfigOptionclone () const override
 
ConfigOptionPercentsTemploperator= (const ConfigOption *opt)
 
bool operator== (const ConfigOptionPercentsTempl &rhs) const throw ()
 
bool operator< (const ConfigOptionPercentsTempl &rhs) const throw ()
 
std::string serialize () const override
 
std::vector< std::string > vserialize () const override
 
bool operator== (const ConfigOptionFloatsTempl &rhs) const throw ()
 
bool operator== (const ConfigOption &rhs) const override
 
bool operator== (const std::vector< double > &rhs) const throw ()
 
bool operator< (const ConfigOptionFloatsTempl &rhs) const throw ()
 
bool nullable () const override
 
bool is_nil () const override
 
bool is_nil (size_t idx) const override
 
bool deserialize (const std::string &str, bool append=false) override
 
void set (const ConfigOption *rhs) override
 
void set (const std::vector< const ConfigOption * > &rhs) override
 
void set_at (const ConfigOption *rhs, size_t i, size_t j) override
 
const double & get_at (size_t i) const
 
double & get_at (size_t i)
 
void resize (size_t n, const ConfigOption *opt_default=nullptr) override
 
void clear () override
 
size_t size () const override
 
bool empty () const override
 
bool operator!= (const std::vector< double > &rhs) const throw ()
 
bool operator!= (const ConfigOption &rhs) const
 
size_t hash () const override throw ()
 
bool overriden_by (const ConfigOption *rhs) const override
 
bool apply_override (const ConfigOption *rhs) override
 
virtual int getInt () const
 
virtual double getFloat () const
 
virtual bool getBool () const
 
virtual void setInt (int)
 
bool is_scalar () const
 
bool is_vector () const
 

Static Public Member Functions

static ConfigOptionType static_type ()
 
static double nil_value ()
 

Public Attributes

std::vector< double > values
 

Protected Member Functions

void serialize_single_value (std::ostringstream &ss, const double v) const
 
ConfigOptionType scalar_type () const
 

Static Protected Member Functions

static bool vectors_equal (const std::vector< double > &v1, const std::vector< double > &v2)
 
static bool vectors_lower (const std::vector< double > &v1, const std::vector< double > &v2)
 

Private Member Functions

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

Friends

class cereal::access
 

Detailed Description

template<bool NULLABLE>
class Slic3r::ConfigOptionPercentsTempl< NULLABLE >

Constructor & Destructor Documentation

◆ ConfigOptionPercentsTempl() [1/5]

template<bool NULLABLE>
Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl ( )
inline
959: ConfigOptionFloatsTempl<NULLABLE>() {}

Referenced by Slic3r::ConfigOptionPercentsTempl< NULLABLE >::clone().

+ Here is the caller graph for this function:

◆ ConfigOptionPercentsTempl() [2/5]

template<bool NULLABLE>
Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl ( size_t  n,
double  value 
)
inlineexplicit
960: ConfigOptionFloatsTempl<NULLABLE>(n, value) {}

◆ ConfigOptionPercentsTempl() [3/5]

template<bool NULLABLE>
Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl ( std::initializer_list< double >  il)
inlineexplicit
961: ConfigOptionFloatsTempl<NULLABLE>(std::move(il)) {}

◆ ConfigOptionPercentsTempl() [4/5]

template<bool NULLABLE>
Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl ( const std::vector< double > &  vec)
inlineexplicit
962: ConfigOptionFloatsTempl<NULLABLE>(vec) {}

◆ ConfigOptionPercentsTempl() [5/5]

template<bool NULLABLE>
Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl ( std::vector< double > &&  vec)
inlineexplicit
963: ConfigOptionFloatsTempl<NULLABLE>(std::move(vec)) {}

Member Function Documentation

◆ apply_override()

bool Slic3r::ConfigOptionVector< double >::apply_override ( const ConfigOption rhs)
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

515 {
516 if (this->nullable())
517 throw ConfigurationError("Cannot override a nullable ConfigOption.");
518 if (rhs->type() != this->type())
519 throw ConfigurationError("ConfigOptionVector.apply_override() applied to different types.");
520 auto rhs_vec = static_cast<const ConfigOptionVector<T>*>(rhs);
521 if (! rhs->nullable()) {
522 // Overridding a non-nullable object with another non-nullable object.
523 if (this->values != rhs_vec->values) {
524 this->values = rhs_vec->values;
525 return true;
526 }
527 return false;
528 }
529 size_t i = 0;
530 size_t cnt = std::min(this->size(), rhs_vec->size());
531 bool modified = false;
532 for (; i < cnt; ++ i)
533 if (! rhs_vec->is_nil(i) && this->values[i] != rhs_vec->values[i]) {
534 this->values[i] = rhs_vec->values[i];
535 modified = true;
536 }
537 for (; i < rhs_vec->size(); ++ i)
538 if (! rhs_vec->is_nil(i)) {
539 if (this->values.empty())
540 this->values.resize(i + 1);
541 else
542 this->values.resize(i + 1, this->values.front());
543 this->values[i] = rhs_vec->values[i];
544 modified = true;
545 }
546 return modified;
547 }
virtual bool nullable() const
Definition Config.hpp:280
size_t size() const override
Definition Config.hpp:471
std::vector< double > values
Definition Config.hpp:382

◆ clear()

void Slic3r::ConfigOptionVector< double >::clear ( )
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

470{ this->values.clear(); }

◆ clone()

template<bool NULLABLE>
ConfigOption * Slic3r::ConfigOptionPercentsTempl< NULLABLE >::clone ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOptionFloatsTempl< NULLABLE >.

967{ return new ConfigOptionPercentsTempl(*this); }
ConfigOptionPercentsTempl()
Definition Config.hpp:959

References Slic3r::ConfigOptionPercentsTempl< NULLABLE >::ConfigOptionPercentsTempl().

+ Here is the call graph for this function:

◆ deserialize()

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::deserialize ( const std::string &  str,
bool  append = false 
)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

646 {
647 if (! append)
648 this->values.clear();
649 std::istringstream is(str);
650 std::string item_str;
651 while (std::getline(is, item_str, ',')) {
652 boost::trim(item_str);
653 if (item_str == "nil") {
654 if (NULLABLE)
655 this->values.push_back(nil_value());
656 else
657 throw ConfigurationError("Deserializing nil into a non-nullable object");
658 } else {
659 std::istringstream iss(item_str);
660 double value;
661 iss >> value;
662 this->values.push_back(value);
663 }
664 }
665 return true;
666 }
static double nil_value()
Definition Config.hpp:617
void append(std::vector< T, Alloc > &dest, const std::vector< T, Alloc2 > &src)
Definition libslic3r.h:110

References Slic3r::append(), and Slic3r::ConfigOptionFloatsTempl< NULLABLE >::nil_value().

+ Here is the call graph for this function:

◆ empty()

bool Slic3r::ConfigOptionVector< double >::empty ( ) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

472{ return this->values.empty(); }

◆ get_at() [1/2]

double & Slic3r::ConfigOptionVector< double >::get_at ( size_t  i)
inlineinherited
442{ return const_cast<T&>(std::as_const(*this).get_at(i)); }

◆ get_at() [2/2]

const double & Slic3r::ConfigOptionVector< double >::get_at ( size_t  i) const
inlineinherited
437 {
438 assert(! this->values.empty());
439 return (i < this->values.size()) ? this->values[i] : this->values.front();
440 }

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

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

Reimplemented in Slic3r::ConfigOptionFloat.

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

Referenced by Slic3r::GUI::TabSLAMaterial::build(), Slic3r::GUI::get_string_value(), Slic3r::client::MyContext::scalar_variable_to_expr(), and Slic3r::GUI::Sidebar::update_sliced_info_sizer().

+ Here is the caller graph for this function:

◆ getInt()

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

◆ hash()

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

Implements Slic3r::ConfigOption.

485 {
486 std::hash<T> hasher;
487 size_t seed = 0;
488 for (const auto &v : this->values)
489 boost::hash_combine(seed, hasher(v));
490 return seed;
491 }
Definition args.hpp:18

◆ is_nil() [1/2]

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::is_nil ( ) const
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

619{ for (auto v : this->values) if (! std::isnan(v)) return false; return true; }
if(!(yy_init))
Definition lexer.c:1190
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool() isnan(const half &a)
Definition Half.h:434
STL namespace.

References Slic3r::ConfigOptionVector< double >::values.

◆ is_nil() [2/2]

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::is_nil ( size_t  idx) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

620{ return std::isnan(this->values[idx < values.size() ? idx : 0]); }

References Slic3r::ConfigOptionVector< double >::values.

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

◆ nil_value()

template<bool NULLABLE>
static double Slic3r::ConfigOptionFloatsTempl< NULLABLE >::nil_value ( )
inlinestaticinherited
617{ return std::numeric_limits<double>::quiet_NaN(); }

Referenced by Slic3r::ConfigOptionFloatsTempl< NULLABLE >::deserialize(), and Slic3r::GUI::Field::get_value_by_opt_type().

+ Here is the caller graph for this function:

◆ nullable()

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::nullable ( ) const
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

615{ return NULLABLE; }

◆ operator!=() [1/2]

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

◆ operator!=() [2/2]

bool Slic3r::ConfigOptionVector< double >::operator!= ( const std::vector< double > &  rhs) const
throw (
)
inlineinherited
483{ return this->values != rhs; }

◆ operator<() [1/2]

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator< ( const ConfigOptionFloatsTempl< NULLABLE > &  rhs) const
throw (
)
inlineinherited
607{ return vectors_lower(this->values, rhs.values); }
static bool vectors_lower(const std::vector< double > &v1, const std::vector< double > &v2)
Definition Config.hpp:698

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_lower().

+ Here is the call graph for this function:

◆ operator<() [2/2]

template<bool NULLABLE>
bool Slic3r::ConfigOptionPercentsTempl< NULLABLE >::operator< ( const ConfigOptionPercentsTempl< NULLABLE > &  rhs) const
throw (
)
inline
970{ return ConfigOptionFloatsTempl<NULLABLE>::vectors_lower(this->values, rhs.values); }

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_lower().

+ Here is the call graph for this function:

◆ operator=()

template<bool NULLABLE>
ConfigOptionPercentsTempl & Slic3r::ConfigOptionPercentsTempl< NULLABLE >::operator= ( const ConfigOption opt)
inline
968{ this->set(opt); return *this; }
void set(const ConfigOption *rhs) override
Definition Config.hpp:384

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

+ Here is the call graph for this function:

◆ operator==() [1/4]

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator== ( const ConfigOption rhs) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOption.

608 {
609 if (rhs.type() != this->type())
610 throw ConfigurationError("ConfigOptionFloatsTempl: Comparing incompatible types");
611 assert(dynamic_cast<const ConfigOptionVector<double>*>(&rhs));
612 return vectors_equal(this->values, static_cast<const ConfigOptionVector<double>*>(&rhs)->values);
613 }
static bool vectors_equal(const std::vector< double > &v1, const std::vector< double > &v2)
Definition Config.hpp:686

References Slic3r::ConfigOption::type(), Slic3r::ConfigOptionVector< double >::values, and Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_equal().

+ Here is the call graph for this function:

◆ operator==() [2/4]

template<bool NULLABLE>
bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator== ( const ConfigOptionFloatsTempl< NULLABLE > &  rhs) const
throw (
)
inlineinherited
606{ return vectors_equal(this->values, rhs.values); }

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_equal().

+ Here is the call graph for this function:

◆ operator==() [3/4]

template<bool NULLABLE>
bool Slic3r::ConfigOptionPercentsTempl< NULLABLE >::operator== ( const ConfigOptionPercentsTempl< NULLABLE > &  rhs) const
throw (
)
inline
969{ return ConfigOptionFloatsTempl<NULLABLE>::vectors_equal(this->values, rhs.values); }

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_equal().

+ Here is the call graph for this function:

◆ operator==() [4/4]

bool Slic3r::ConfigOptionVector< double >::operator== ( const std::vector< double > &  rhs) const
throw (
)
inlineinherited
482{ return this->values == rhs; }

◆ overriden_by()

bool Slic3r::ConfigOptionVector< double >::overriden_by ( const ConfigOption rhs) const
inlineoverridevirtualinherited

Reimplemented from Slic3r::ConfigOption.

495 {
496 if (this->nullable())
497 throw ConfigurationError("Cannot override a nullable ConfigOption.");
498 if (rhs->type() != this->type())
499 throw ConfigurationError("ConfigOptionVector.overriden_by() applied to different types.");
500 auto rhs_vec = static_cast<const ConfigOptionVector<T>*>(rhs);
501 if (! rhs->nullable())
502 // Overridding a non-nullable object with another non-nullable object.
503 return this->values != rhs_vec->values;
504 size_t i = 0;
505 size_t cnt = std::min(this->size(), rhs_vec->size());
506 for (; i < cnt; ++ i)
507 if (! rhs_vec->is_nil(i) && this->values[i] != rhs_vec->values[i])
508 return true;
509 for (; i < rhs_vec->size(); ++ i)
510 if (! rhs_vec->is_nil(i))
511 return true;
512 return false;
513 }

◆ resize()

void Slic3r::ConfigOptionVector< double >::resize ( size_t  n,
const ConfigOption opt_default = nullptr 
)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

447 {
448 assert(opt_default == nullptr || opt_default->is_vector());
449// assert(opt_default == nullptr || dynamic_cast<ConfigOptionVector<T>>(opt_default));
450 assert(! this->values.empty() || opt_default != nullptr);
451 if (n == 0)
452 this->values.clear();
453 else if (n < this->values.size())
454 this->values.erase(this->values.begin() + n, this->values.end());
455 else if (n > this->values.size()) {
456 if (this->values.empty()) {
457 if (opt_default == nullptr)
458 throw ConfigurationError("ConfigOptionVector::resize(): No default value provided.");
459 if (opt_default->type() != this->type())
460 throw ConfigurationError("ConfigOptionVector::resize(): Extending with an incompatible type.");
461 this->values.resize(n, static_cast<const ConfigOptionVector<T>*>(opt_default)->values.front());
462 } else {
463 // Resize by duplicating the last value.
464 this->values.resize(n, this->values./*back*/front());
465 }
466 }
467 }

◆ scalar_type()

ConfigOptionType Slic3r::ConfigOptionVectorBase::scalar_type ( ) const
inlineprotectedinherited
369{ return static_cast<ConfigOptionType>(this->type() - coVectorType); }
ConfigOptionType
Definition Config.hpp:160

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

Referenced by Slic3r::ConfigOptionVector< T >::set(), and Slic3r::ConfigOptionVector< T >::set_at().

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

◆ serialize() [1/2]

template<bool NULLABLE>
std::string Slic3r::ConfigOptionPercentsTempl< NULLABLE >::serialize ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOptionFloatsTempl< NULLABLE >.

973 {
974 std::ostringstream ss;
975 for (const double &v : this->values) {
976 if (&v != &this->values.front())
977 ss << ",";
978 this->serialize_single_value(ss, v);
979 if (! std::isnan(v))
980 ss << "%";
981 }
982 std::string str = ss.str();
983 return str;
984 }
void serialize_single_value(std::ostringstream &ss, const double v) const
Definition Config.hpp:675

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::serialize_single_value(), and Slic3r::ConfigOptionVector< double >::values.

+ Here is the call graph for this function:

◆ serialize() [2/2]

template<bool NULLABLE>
template<class Archive >
void Slic3r::ConfigOptionPercentsTempl< NULLABLE >::serialize ( Archive &  ar)
inlineprivate
1005{ ar(cereal::base_class<ConfigOptionFloatsTempl<NULLABLE>>(this)); }

◆ serialize_single_value()

template<bool NULLABLE>
void Slic3r::ConfigOptionFloatsTempl< NULLABLE >::serialize_single_value ( std::ostringstream &  ss,
const double  v 
) const
inlineprotectedinherited
675 {
676 if (std::isfinite(v))
677 ss << v;
678 else if (std::isnan(v)) {
679 if (NULLABLE)
680 ss << "nil";
681 else
682 throw ConfigurationError("Serializing NaN");
683 } else
684 throw ConfigurationError("Serializing invalid number");
685 }

Referenced by Slic3r::ConfigOptionFloatsTempl< NULLABLE >::serialize(), Slic3r::ConfigOptionPercentsTempl< NULLABLE >::serialize(), Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vserialize(), and Slic3r::ConfigOptionPercentsTempl< NULLABLE >::vserialize().

+ Here is the caller graph for this function:

◆ set() [1/2]

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

Implements Slic3r::ConfigOption.

385 {
386 if (rhs->type() != this->type())
387 throw ConfigurationError("ConfigOptionVector: Assigning an incompatible type");
388 assert(dynamic_cast<const ConfigOptionVector<T>*>(rhs));
389 this->values = static_cast<const ConfigOptionVector<T>*>(rhs)->values;
390 }

◆ set() [2/2]

void Slic3r::ConfigOptionVector< double >::set ( const std::vector< const ConfigOption * > &  rhs)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

397 {
398 this->values.clear();
399 this->values.reserve(rhs.size());
400 for (const ConfigOption *opt : rhs) {
401 if (opt->type() == this->type()) {
402 auto other = static_cast<const ConfigOptionVector<T>*>(opt);
403 if (other->values.empty())
404 throw ConfigurationError("ConfigOptionVector::set(): Assigning from an empty vector");
405 this->values.emplace_back(other->values.front());
406 } else if (opt->type() == this->scalar_type())
407 this->values.emplace_back(static_cast<const ConfigOptionSingle<T>*>(opt)->value);
408 else
409 throw ConfigurationError("ConfigOptionVector::set():: Assigning an incompatible type");
410 }
411 }
ConfigOptionType scalar_type() const
Definition Config.hpp:369

◆ set_at()

void Slic3r::ConfigOptionVector< double >::set_at ( const ConfigOption rhs,
size_t  i,
size_t  j 
)
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

416 {
417 // It is expected that the vector value has at least one value, which is the default, if not overwritten.
418 assert(! this->values.empty());
419 if (this->values.size() <= i) {
420 // Resize this vector, fill in the new vector fields with the copy of the first field.
421 T v = this->values.front();
422 this->values.resize(i + 1, v);
423 }
424 if (rhs->type() == this->type()) {
425 // Assign the first value of the rhs vector.
426 auto other = static_cast<const ConfigOptionVector<T>*>(rhs);
427 if (other->values.empty())
428 throw ConfigurationError("ConfigOptionVector::set_at(): Assigning from an empty vector");
429 this->values[i] = other->get_at(j);
430 } else if (rhs->type() == this->scalar_type())
431 this->values[i] = static_cast<const ConfigOptionSingle<T>*>(rhs)->value;
432 else
433 throw ConfigurationError("ConfigOptionVector::set_at(): Assigning an incompatible type");
434 }

◆ 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"); }

◆ size()

size_t Slic3r::ConfigOptionVector< double >::size ( ) const
inlineoverridevirtualinherited

Implements Slic3r::ConfigOptionVectorBase.

471{ return this->values.size(); }

◆ static_type()

template<bool NULLABLE>
static ConfigOptionType Slic3r::ConfigOptionPercentsTempl< NULLABLE >::static_type ( )
inlinestatic
965{ return coPercents; }
@ coPercents
Definition Config.hpp:178

References Slic3r::coPercents.

Referenced by Slic3r::ConfigOptionPercentsTempl< NULLABLE >::type().

+ Here is the caller graph for this function:

◆ type()

template<bool NULLABLE>
ConfigOptionType Slic3r::ConfigOptionPercentsTempl< NULLABLE >::type ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOptionFloatsTempl< NULLABLE >.

966{ return static_type(); }
static ConfigOptionType static_type()
Definition Config.hpp:965

References Slic3r::ConfigOptionPercentsTempl< NULLABLE >::static_type().

+ Here is the call graph for this function:

◆ vectors_equal()

template<bool NULLABLE>
static bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_equal ( const std::vector< double > &  v1,
const std::vector< double > &  v2 
)
inlinestaticprotectedinherited
686 {
687 if (NULLABLE) {
688 if (v1.size() != v2.size())
689 return false;
690 for (auto it1 = v1.begin(), it2 = v2.begin(); it1 != v1.end(); ++ it1, ++ it2)
691 if (! ((std::isnan(*it1) && std::isnan(*it2)) || *it1 == *it2))
692 return false;
693 return true;
694 } else
695 // Not supporting nullable values, the default vector compare is cheaper.
696 return v1 == v2;
697 }

Referenced by Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator==(), Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator==(), and Slic3r::ConfigOptionPercentsTempl< NULLABLE >::operator==().

+ Here is the caller graph for this function:

◆ vectors_lower()

template<bool NULLABLE>
static bool Slic3r::ConfigOptionFloatsTempl< NULLABLE >::vectors_lower ( const std::vector< double > &  v1,
const std::vector< double > &  v2 
)
inlinestaticprotectedinherited
698 {
699 if (NULLABLE) {
700 for (auto it1 = v1.begin(), it2 = v2.begin(); it1 != v1.end() && it2 != v2.end(); ++ it1, ++ it2) {
701 auto null1 = int(std::isnan(*it1));
702 auto null2 = int(std::isnan(*it2));
703 return (null1 < null2) || (null1 == null2 && *it1 < *it2);
704 }
705 return v1.size() < v2.size();
706 } else
707 // Not supporting nullable values, the default vector compare is cheaper.
708 return v1 < v2;
709 }

Referenced by Slic3r::ConfigOptionFloatsTempl< NULLABLE >::operator<(), and Slic3r::ConfigOptionPercentsTempl< NULLABLE >::operator<().

+ Here is the caller graph for this function:

◆ vserialize()

template<bool NULLABLE>
std::vector< std::string > Slic3r::ConfigOptionPercentsTempl< NULLABLE >::vserialize ( ) const
inlineoverridevirtual

Reimplemented from Slic3r::ConfigOptionFloatsTempl< NULLABLE >.

987 {
988 std::vector<std::string> vv;
989 vv.reserve(this->values.size());
990 for (const double v : this->values) {
991 std::ostringstream ss;
992 this->serialize_single_value(ss, v);
993 if (! std::isnan(v))
994 ss << "%";
995 vv.push_back(ss.str());
996 }
997 return vv;
998 }

References Slic3r::ConfigOptionFloatsTempl< NULLABLE >::serialize_single_value(), and Slic3r::ConfigOptionVector< double >::values.

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ cereal::access

template<bool NULLABLE>
friend class cereal::access
friend

Member Data Documentation

◆ values

std::vector<double > Slic3r::ConfigOptionVector< double >::values
inherited

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