Skip to content
Snippets Groups Projects
Commit 5655e743 authored by Manuel Günther's avatar Manuel Günther
Browse files

Switched API numbering from (error-prone) defines to enum.

parent 1ae92b95
No related branches found
No related tags found
No related merge requests found
...@@ -20,11 +20,31 @@ ...@@ -20,11 +20,31 @@
* C API functions * * C API functions *
*******************/ *******************/
/* Enum defining entries in the function table */
enum _PyBobLearnActivation_ENUM{
PyXbobLearnActivation_APIVersion_NUM = 0,
// Bindings for xbob.learn.activation.Activation
PyBobLearnActivation_Type_NUM,
PyBobLearnActivation_Check_NUM,
PyBobLearnActivation_NewFromActivation_NUM,
// Bindings for xbob.learn.activation.Identity
PyBobLearnIdentityActivation_Type_NUM,
// Bindings for xbob.learn.activation.Linear
PyBobLearnLinearActivation_Type_NUM,
// Bindings for xbob.learn.activation.Logistic
PyBobLearnLogisticActivation_Type_NUM,
// Bindings for xbob.learn.activation.HyperbolicTangent
PyBobLearnHyperbolicTangentActivation_Type_NUM,
// Bindings for xbob.learn.activation.MultipliedHyperbolicTangent
PyBobLearnMultipliedHyperbolicTangentActivation_Type_NUM,
// Total number of C API pointers
PyXbobLearnActivation_API_pointers
};
/************** /**************
* Versioning * * Versioning *
**************/ **************/
#define PyXbobLearnActivation_APIVersion_NUM 0
#define PyXbobLearnActivation_APIVersion_TYPE int #define PyXbobLearnActivation_APIVersion_TYPE int
/************************************************* /*************************************************
...@@ -36,14 +56,11 @@ typedef struct { ...@@ -36,14 +56,11 @@ typedef struct {
boost::shared_ptr<bob::machine::Activation> cxx; boost::shared_ptr<bob::machine::Activation> cxx;
} PyBobLearnActivationObject; } PyBobLearnActivationObject;
#define PyBobLearnActivation_Type_NUM 1
#define PyBobLearnActivation_Type_TYPE PyTypeObject #define PyBobLearnActivation_Type_TYPE PyTypeObject
#define PyBobLearnActivation_Check_NUM 2
#define PyBobLearnActivation_Check_RET int #define PyBobLearnActivation_Check_RET int
#define PyBobLearnActivation_Check_PROTO (PyObject* o) #define PyBobLearnActivation_Check_PROTO (PyObject* o)
#define PyBobLearnActivation_NewFromActivation_NUM 3
#define PyBobLearnActivation_NewFromActivation_RET PyObject* #define PyBobLearnActivation_NewFromActivation_RET PyObject*
#define PyBobLearnActivation_NewFromActivation_PROTO (boost::shared_ptr<bob::machine::Activation> a) #define PyBobLearnActivation_NewFromActivation_PROTO (boost::shared_ptr<bob::machine::Activation> a)
...@@ -56,7 +73,6 @@ typedef struct { ...@@ -56,7 +73,6 @@ typedef struct {
boost::shared_ptr<bob::machine::IdentityActivation> cxx; boost::shared_ptr<bob::machine::IdentityActivation> cxx;
} PyBobLearnIdentityActivationObject; } PyBobLearnIdentityActivationObject;
#define PyBobLearnIdentityActivation_Type_NUM 4
#define PyBobLearnIdentityActivation_Type_TYPE PyTypeObject #define PyBobLearnIdentityActivation_Type_TYPE PyTypeObject
/********************************************* /*********************************************
...@@ -68,7 +84,6 @@ typedef struct { ...@@ -68,7 +84,6 @@ typedef struct {
boost::shared_ptr<bob::machine::LinearActivation> cxx; boost::shared_ptr<bob::machine::LinearActivation> cxx;
} PyBobLearnLinearActivationObject; } PyBobLearnLinearActivationObject;
#define PyBobLearnLinearActivation_Type_NUM 5
#define PyBobLearnLinearActivation_Type_TYPE PyTypeObject #define PyBobLearnLinearActivation_Type_TYPE PyTypeObject
/*********************************************** /***********************************************
...@@ -80,7 +95,6 @@ typedef struct { ...@@ -80,7 +95,6 @@ typedef struct {
boost::shared_ptr<bob::machine::LogisticActivation> cxx; boost::shared_ptr<bob::machine::LogisticActivation> cxx;
} PyBobLearnLogisticActivationObject; } PyBobLearnLogisticActivationObject;
#define PyBobLearnLogisticActivation_Type_NUM 6
#define PyBobLearnLogisticActivation_Type_TYPE PyTypeObject #define PyBobLearnLogisticActivation_Type_TYPE PyTypeObject
/******************************************************** /********************************************************
...@@ -92,7 +106,6 @@ typedef struct { ...@@ -92,7 +106,6 @@ typedef struct {
boost::shared_ptr<bob::machine::HyperbolicTangentActivation> cxx; boost::shared_ptr<bob::machine::HyperbolicTangentActivation> cxx;
} PyBobLearnHyperbolicTangentActivationObject; } PyBobLearnHyperbolicTangentActivationObject;
#define PyBobLearnHyperbolicTangentActivation_Type_NUM 7
#define PyBobLearnHyperbolicTangentActivation_Type_TYPE PyTypeObject #define PyBobLearnHyperbolicTangentActivation_Type_TYPE PyTypeObject
/****************************************************************** /******************************************************************
...@@ -104,11 +117,8 @@ typedef struct { ...@@ -104,11 +117,8 @@ typedef struct {
boost::shared_ptr<bob::machine::MultipliedHyperbolicTangentActivation> cxx; boost::shared_ptr<bob::machine::MultipliedHyperbolicTangentActivation> cxx;
} PyBobLearnMultipliedHyperbolicTangentActivationObject; } PyBobLearnMultipliedHyperbolicTangentActivationObject;
#define PyBobLearnMultipliedHyperbolicTangentActivation_Type_NUM 8
#define PyBobLearnMultipliedHyperbolicTangentActivation_Type_TYPE PyTypeObject #define PyBobLearnMultipliedHyperbolicTangentActivation_Type_TYPE PyTypeObject
/* Total number of C API pointers */
#define PyXbobLearnActivation_API_pointers 9
#ifdef XBOB_LEARN_ACTIVATION_MODULE #ifdef XBOB_LEARN_ACTIVATION_MODULE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment