Navigation Menu

Skip to content

Commit

Permalink
make director based classes optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Mar 27, 2012
1 parent 1f71363 commit c375b8f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/configure
Expand Up @@ -50,6 +50,7 @@ COMP_CSHARP=gmcs

#the defaults are
_swig_version=0.0.0
_swig_directors=no
_readline=auto
_hdf5=auto
_ant=no
Expand Down Expand Up @@ -1313,6 +1314,7 @@ Miscellaneous options:
--enable-debug enable debugging [enabled]
--enable-trace-mallocs enable memory allocation tracing [disabled]
--disable-reference-counting disables reference counting causing severe memory leakage [enabled]
--enable-swig-directors enables swig based director classes [disabled]
--enable-path-debug enable viterbi path debugging [disabled]
--enable-profile compile profiling information into shogun [disable]
--enable-static build a statically linked binary (to the extend possible);
Expand Down Expand Up @@ -1521,6 +1523,8 @@ EOF
--enable-trace-mallocs) _trace_mallocs=yes ;;
--disable-reference-counting) _reference_counting=no ;;
--enable-reference-counting) _reference_counting=yes ;;
--disable-swig-directors) _swig_directors=no ;;
--enable-swig-directors) _swig_directors=yes ;;
--disable-hmm-debug) _hmmdebug=no ;;
--enable-hmm-debug) _hmmdebug=yes ;;
--disable-path-debug) _pathdebug=no ;;
Expand Down Expand Up @@ -3792,6 +3796,12 @@ set_opts()
DEFINES="$DEFINES -DUSE_REFERENCE_COUNTING"
fi

if test "$_swig_directors" = yes
then
USE_SWIG_DIRECTORS='#define USE_SWIG_DIRECTORS 1'
DEFINES="$DEFINES -DUSE_SWIG_DIRECTORS"
fi

if test "$_hmmdebug" = yes
then
USE_HMMDEBUG='#define USE_HMMDEBUG 1'
Expand Down Expand Up @@ -4914,6 +4924,7 @@ $USE_BZIP2
$USE_LZMA
$TRACE_MEMORY_ALLOCS
$USE_REFERENCE_COUNTING
$USE_SWIG_DIRECTORS
#define OCTAVE_APIVERSION $OCTAVE_APIVERSION
#define $OS 1
#define CONFIGURE_OPTIONS "$CONFIGURE_OPTIONS"
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/modular/Kernel.i
Expand Up @@ -14,12 +14,14 @@

%ignore CWeightedDegreePositionStringKernel::set_position_weights(float64_t*);

#ifdef USE_SWIG_DIRECTORS
%feature("director") shogun::CDirectorKernel;
%feature("director:except") {
if ($error != NULL) {
throw Swig::DirectorMethodException();
}
}
#endif

/* Remove C Prefix */
%rename(Kernel) CKernel;
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/modular/SGBase.i
Expand Up @@ -228,7 +228,7 @@ public void readExternal(java.io.ObjectInput in) throws java.io.IOException, jav
{
$action
}
#ifdef SWIGPYTHON
#if defined(SWIGPYTHON) && defined(USE_SWIG_DIRECTORS)
catch (Swig::DirectorException &e)
{
SWIG_fail;
Expand Down
4 changes: 4 additions & 0 deletions src/interfaces/modular/modshogun.i
Expand Up @@ -11,7 +11,11 @@
"The `modshogun` module gathers all modules available in the SHOGUN toolkit."
%enddef

#ifdef USE_SWIG_DIRECTORS
%module(directors="1", docstring=DOCSTR) modshogun
#else
%module(docstring=DOCSTR) modshogun
#endif
#undef DOCSTR

%include "modshogun_ignores.i"
Expand Down
8 changes: 6 additions & 2 deletions src/shogun/kernel/DirectorKernel.h
Expand Up @@ -11,13 +11,16 @@
#ifndef _DIRECTORKERNEL_H___
#define _DIRECTORKERNEL_H___

#include <shogun/lib/config.h>

#ifdef USE_SWIG_DIRECTORS
#include <shogun/lib/common.h>
#include <shogun/lib/DataType.h>
#include <shogun/kernel/Kernel.h>

namespace shogun
{
class CDirectorKernel: public CKernel
IGNORE_IN_CLASSLIST class CDirectorKernel: public CKernel
{
public:
/** default constructor
Expand Down Expand Up @@ -248,4 +251,5 @@ class CDirectorKernel: public CKernel
}
};
}
#endif /* _GAUSSIANKERNEL_H__ */
#endif /* USE_SWIG_DIRECTORS */
#endif /* _DIRECTORKERNEL_H__ */

0 comments on commit c375b8f

Please sign in to comment.