mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-19 22:29:09 -07:00
Implement type checking for XS objects
Type handling is mainly done using templates. Template Slic3r::ClassTraits is used to store info about exported types (perl class name). Currently only perl class name and refference name is used. Template values are initialized by REGISTER_CLASS macro. This macro is used in .cpp file of class ( it needs to be used exactly for each type). Ref<type> class is used to return value as perl reference. Operator overloading is used to make c++ and XSpp happy, only pointer value should be possible to return. Clone<type> class is used to return copy of value ( using new and copy constructor). Copy is created on assigment, this should be probably improved (memory leak on multiple assignments). It is overloaded to be able to return type, type* and type&. Typechecking in ExtrusionEntityCollection updated to check all passed types.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
#include "Flow.hpp"
|
||||
#include <cmath>
|
||||
#ifdef SLIC3RXS
|
||||
#include "perlglue.hpp"
|
||||
#endif
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@@ -112,4 +115,8 @@ Flow::_spacing(float width, float nozzle_diameter, float height, float bridge_fl
|
||||
return width - OVERLAP_FACTOR * (width - min_flow_spacing);
|
||||
}
|
||||
|
||||
#ifdef SLIC3RXS
|
||||
REGISTER_CLASS(Flow, "Flow");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user