Commit Graph

5 Commits (master)

Author SHA1 Message Date
Alessandro Ranellucci 76a8ec3d9e Replace to_SV_ref() and to_SV_clone_ref() with templated glue functions 2014-05-08 14:52:48 +02:00
Alessandro Ranellucci 6e207d3830 Merge branch 'sapir-modelcpp' 2014-05-08 11:13:21 +02:00
Alessandro Ranellucci d2d885fc53 Turn ExtrusionLoop into a collection of polylines. Includes some changes to the Polygon API to avoid returning newly allocatd objects 2014-05-07 12:02:09 +02:00
Y. Sapir 05b2993769 Translate Model class' storage to C++.
Some code copied from xs-model branch.

Also:
* Generate ::Ref classes programatically.
* Add separate __REGISTER_CLASS macro
    (for use where forward declaration won't work, i.e. typedefs)
2014-05-05 16:30:19 +03:00
Petr Ledvina 115aa6885f 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.
2014-04-27 19:38:56 +02:00