Skip to content

Commit

Permalink
Merge pull request #731 from gsomix/buffer_protocol
Browse files Browse the repository at this point in the history
Fixed compilation for other modular interfaces
  • Loading branch information
lisitsyn committed Aug 16, 2012
2 parents 40f88f7 + 4eb32dc commit afe18a1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
13 changes: 7 additions & 6 deletions src/interfaces/modular/Features.i
Expand Up @@ -32,8 +32,9 @@
#endif

#ifndef SWIGPYTHON
#define PYPROTO_DENSEFEATURES(class_name, type_name, format_str, typecode)
#define PYPROTO_DENSELABELS(class_type, class_name, type_name, format_str, typecode)
#define PROTOCOLS_DENSEFEATURES(class_name, type_name, format_str, typecode)
#define PROTOCOLS_DENSELABELS(class_type, class_name, type_name, format_str, typecode)
#define EXTEND_DENSEFEATURES(class_name, type_name, typecode)
#endif

/* Remove C Prefix */
Expand All @@ -51,16 +52,16 @@
%rename(CombinedDotFeatures) CCombinedDotFeatures;
%rename(Labels) CLabels;

PYPROTO_DENSELABELS(CDenseLabels, DenseLabels, float64_t, "d\0", NPY_FLOAT64)
PROTOCOLS_DENSELABELS(CDenseLabels, DenseLabels, float64_t, "d\0", NPY_FLOAT64)
%rename(DenseLabels) CDenseLabels;

PYPROTO_DENSELABELS(CBinaryLabels, BinaryLabels, float64_t, "d\0", NPY_FLOAT64)
PROTOCOLS_DENSELABELS(CBinaryLabels, BinaryLabels, float64_t, "d\0", NPY_FLOAT64)
%rename(BinaryLabels) CBinaryLabels;

PYPROTO_DENSELABELS(CMulticlassLabels, MulticlassLabels, float64_t, "d\0", NPY_FLOAT64)
PROTOCOLS_DENSELABELS(CMulticlassLabels, MulticlassLabels, float64_t, "d\0", NPY_FLOAT64)
%rename(MulticlassLabels) CMulticlassLabels;

PYPROTO_DENSELABELS(CRegressionLabels, RegressionLabels, float64_t, "d\0", NPY_FLOAT64)
PROTOCOLS_DENSELABELS(CRegressionLabels, RegressionLabels, float64_t, "d\0", NPY_FLOAT64)
%rename(RegressionLabels) CRegressionLabels;

%rename(StructuredLabels) CStructuredLabels;
Expand Down
6 changes: 3 additions & 3 deletions src/interfaces/modular/Library.i
Expand Up @@ -10,7 +10,7 @@
*/

#ifndef SWIGPYTHON
#define PYPROTO_SGVECTOR(class_name, type_name, format_str, typecode)
#define PROTOCOLS_SGVECTOR(class_name, type_name, format_str, typecode)
#endif

%rename(Cache) CCache;
Expand Down Expand Up @@ -282,12 +282,12 @@ namespace shogun
SERIALIZABLE_DUMMY(SGVector<uint64_t>);
#endif
#ifdef USE_FLOAT32
PYPROTO_SGVECTOR(ShortRealVector, float32_t, "f\0", NPY_FLOAT32)
PROTOCOLS_SGVECTOR(ShortRealVector, float32_t, "f\0", NPY_FLOAT32)
%template(ShortRealVector) SGVector<float32_t>;
SERIALIZABLE_DUMMY(SGVector<float32_t>);
#endif
#ifdef USE_FLOAT64
PYPROTO_SGVECTOR(RealVector, float64_t, "d\0", NPY_FLOAT64)
PROTOCOLS_SGVECTOR(RealVector, float64_t, "d\0", NPY_FLOAT64)
%template(RealVector) SGVector<float64_t>;
SERIALIZABLE_DUMMY(SGVector<float64_t>);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/python_modular/DenseFeatures_protocols.i
Expand Up @@ -665,7 +665,7 @@ static std::map<CDenseFeatures< type_name >*, Py_buffer*> extend_ ## class_name
%feature("python:mp_subscript") CDenseFeatures< type_name > #class_name "_getsubscript"
%feature("python:mp_ass_subscript") CDenseFeatures< type_name > #class_name "_setsubscript"

%enddef /* PYPROTO_DENSEFEATURES */
%enddef /* PROTOCOLS_DENSEFEATURES */

%define EXTEND_DENSEFEATURES(class_name, type_name, typecode)

Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/python_modular/DenseLabels_protocols.i
Expand Up @@ -99,7 +99,7 @@ fail:
%enddef // NUMERIC_DENSELABELS

/* Python protocols for DenseLabels */
%define PYPROTO_DENSELABELS(class_type, class_name, type_name, format_str, typecode)
%define PROTOCOLS_DENSELABELS(class_type, class_name, type_name, format_str, typecode)

%wrapper
%{
Expand Down Expand Up @@ -401,5 +401,5 @@ SwigPyBuiltin__shogun__ ## class_type ## _type.ht_type.tp_flags = class_name ##
%feature("python:sq_slice") class_type #class_name "_getslice"
%feature("python:sq_ass_slice") class_type #class_name "_setslice"

%enddef /* PYPROTO_DENSELABELS */
%enddef /* PROTOCOLS_DENSELABELS */
#endif /* SWIG_PYTHON */
4 changes: 2 additions & 2 deletions src/interfaces/python_modular/SGVector_protocols.i
Expand Up @@ -99,7 +99,7 @@ fail:
%enddef // NUMERIC_SGVECTOR

/* Python protocols for SGVector */
%define PYPROTO_SGVECTOR(class_name, type_name, format_str, typecode)
%define PROTOCOLS_SGVECTOR(class_name, type_name, format_str, typecode)

%wrapper
%{
Expand Down Expand Up @@ -401,5 +401,5 @@ SwigPyBuiltin__shogun__SGVectorT_ ## type_name ## _t_type.ht_type.tp_flags = cla
%feature("python:sq_slice") SGVector< type_name > #class_name "_getslice"
%feature("python:sq_ass_slice") SGVector< type_name > #class_name "_setslice"

%enddef /* PYPROTO_SGVECTOR */
%enddef /* PROTOCOLS_SGVECTOR */
#endif /* SWIG_PYTHON */

0 comments on commit afe18a1

Please sign in to comment.