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,30 +3,28 @@
|
|||
%{
|
||||
#include <myinit.h>
|
||||
#include "PolylineCollection.hpp"
|
||||
#include "perlglue.hpp"
|
||||
%}
|
||||
|
||||
%name{Slic3r::Polyline::Collection} class PolylineCollection {
|
||||
~PolylineCollection();
|
||||
PolylineCollection* clone()
|
||||
%code{% const char* CLASS = "Slic3r::Polyline::Collection"; RETVAL = new PolylineCollection(*THIS); %};
|
||||
Clone<PolylineCollection> clone()
|
||||
%code{% RETVAL = THIS; %};
|
||||
void clear()
|
||||
%code{% THIS->polylines.clear(); %};
|
||||
PolylineCollection* chained_path(bool no_reverse)
|
||||
%code{%
|
||||
const char* CLASS = "Slic3r::Polyline::Collection";
|
||||
RETVAL = new PolylineCollection();
|
||||
THIS->chained_path(RETVAL, no_reverse);
|
||||
%};
|
||||
PolylineCollection* chained_path_from(Point* start_near, bool no_reverse)
|
||||
%code{%
|
||||
const char* CLASS = "Slic3r::Polyline::Collection";
|
||||
RETVAL = new PolylineCollection();
|
||||
THIS->chained_path_from(*start_near, RETVAL, no_reverse);
|
||||
%};
|
||||
int count()
|
||||
%code{% RETVAL = THIS->polylines.size(); %};
|
||||
Point* leftmost_point()
|
||||
%code{% const char* CLASS = "Slic3r::Point"; RETVAL = new Point(THIS->leftmost_point()); %};
|
||||
Clone<Point> leftmost_point();
|
||||
%{
|
||||
|
||||
PolylineCollection*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue