mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-10 15:25:18 -06: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:
parent
e68b6b6f4c
commit
115aa6885f
35 changed files with 426 additions and 173 deletions
|
@ -3,6 +3,7 @@
|
|||
%{
|
||||
#include <myinit.h>
|
||||
#include "ExtrusionEntity.hpp"
|
||||
#include "perlglue.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::ExtrusionLoop} class ExtrusionLoop {
|
||||
|
@ -13,15 +14,11 @@
|
|||
%code{% RETVAL = THIS->polygon.to_SV_pureperl(); %};
|
||||
void reverse()
|
||||
%code{% THIS->polygon.reverse(); %};
|
||||
ExtrusionPath* split_at_index(int index)
|
||||
%code{% const char* CLASS = "Slic3r::ExtrusionPath"; RETVAL = THIS->split_at_index(index); %};
|
||||
ExtrusionPath* split_at_first_point()
|
||||
%code{% const char* CLASS = "Slic3r::ExtrusionPath"; RETVAL = THIS->split_at_first_point(); %};
|
||||
ExtrusionPath* split_at_index(int index);
|
||||
ExtrusionPath* split_at_first_point();
|
||||
bool make_counter_clockwise();
|
||||
Point* first_point()
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(THIS->first_point()); %};
|
||||
Point* last_point()
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(THIS->last_point()); %};
|
||||
Clone<Point> first_point();
|
||||
Clone<Point> last_point();
|
||||
bool is_perimeter();
|
||||
bool is_fill();
|
||||
bool is_bridge();
|
||||
|
@ -41,10 +38,8 @@ _new(CLASS, polygon_sv, role, mm3_per_mm)
|
|||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Polygon*
|
||||
Ref<Polygon>
|
||||
ExtrusionLoop::polygon(...)
|
||||
PREINIT:
|
||||
const char* CLASS = "Slic3r::Polygon::Ref";
|
||||
CODE:
|
||||
if (items > 1) {
|
||||
THIS->polygon.from_SV_check( ST(1) );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue