java support int64 -> int64_t
This commit is contained in:
@@ -98,6 +98,10 @@ $(GEN_DIR)/ortools/constraint_solver/constraint_solver_java_wrap.cc: \
|
||||
-module main \
|
||||
-outdir $(GEN_PATH)$Scom$Sgoogle$Sortools$Sconstraintsolver \
|
||||
$(SRC_DIR)$Sortools$Sconstraint_solver$Sjava$Srouting.i
|
||||
$(SED) -i -e 's/< long long >/< int64 >/g' \
|
||||
$(GEN_PATH)$Sortools$Sconstraint_solver$Sconstraint_solver_java_wrap.cc
|
||||
$(SED) -i -e 's/< long long,long long >/< int64, int64 >/g' \
|
||||
$(GEN_PATH)$Sortools$Sconstraint_solver$Sconstraint_solver_java_wrap.cc
|
||||
|
||||
$(OBJ_DIR)/swig/constraint_solver_java_wrap.$O: \
|
||||
$(GEN_DIR)/ortools/constraint_solver/constraint_solver_java_wrap.cc \
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
//
|
||||
// TODO(user): test all lines marked "untested".
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "enums.swg"
|
||||
%include <enums.swg>
|
||||
%include <stdint.i>
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%import "ortools/util/java/vector.i"
|
||||
|
||||
%{
|
||||
#include "ortools/algorithms/knapsack_solver.h"
|
||||
%}
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
%ignoreall
|
||||
%unignore operations_research;
|
||||
%unignore operations_research::KnapsackSolver;
|
||||
|
||||
@@ -25,24 +25,11 @@
|
||||
|
||||
%include <typemaps.i>
|
||||
%include <exception.i>
|
||||
|
||||
// Add a char* cast to the SWIG 1.3.21 typemaps to remove a compiler warning.
|
||||
%typemap(constcode) long long {
|
||||
PyObject *object = PyLong_FromLongLong($value);
|
||||
if (object) {
|
||||
int rc = PyDict_SetItemString(d, (char*) "$symname", object);
|
||||
Py_DECREF(object);
|
||||
}
|
||||
}
|
||||
%typemap(constcode) unsigned long long {
|
||||
PyObject *object = PyLong_FromUnsignedLongLong($value);
|
||||
if (object) {
|
||||
int rc = PyDict_SetItemString(d, (char*) "$symname", object);
|
||||
Py_DECREF(object);
|
||||
}
|
||||
}
|
||||
%include <stdint.i>
|
||||
%include <std_string.i>
|
||||
|
||||
%{
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -61,7 +48,6 @@
|
||||
// type names. Google typedefs are placed at the very end along with
|
||||
// the necessary %apply macros. See COPY_TYPEMAPS below for details.
|
||||
|
||||
%include "std_string.i"
|
||||
|
||||
// Support for those popular buffer-pointer/length input pairs
|
||||
%typemap(in) (void *INPUT, unsigned int LENGTH) (Py_ssize_t len) {
|
||||
@@ -144,8 +130,8 @@ LIST_OUTPUT_TYPEMAP(int, PyInt_FromLong);
|
||||
LIST_OUTPUT_TYPEMAP(unsigned int, PyLong_FromUnsignedLong);
|
||||
LIST_OUTPUT_TYPEMAP(long, PyInt_FromLong);
|
||||
LIST_OUTPUT_TYPEMAP(unsigned long, PyLong_FromUnsignedLong);
|
||||
LIST_OUTPUT_TYPEMAP(long long, PyLong_FromLongLong);
|
||||
LIST_OUTPUT_TYPEMAP(unsigned long long, PyLong_FromUnsignedLongLong);
|
||||
LIST_OUTPUT_TYPEMAP(int64, PyLong_FromLongLong);
|
||||
LIST_OUTPUT_TYPEMAP(uint64, PyLong_FromUnsignedLongLong);
|
||||
LIST_OUTPUT_TYPEMAP(std::string, SwigString_FromString);
|
||||
LIST_OUTPUT_TYPEMAP(char *, PyBytes_FromString);
|
||||
LIST_OUTPUT_TYPEMAP(double, PyFloat_FromDouble);
|
||||
@@ -179,19 +165,12 @@ typedef oldtype newtype;
|
||||
%apply std::vector<oldtype> * OUTPUT { std::vector<newtype> * OUTPUT };
|
||||
%enddef
|
||||
|
||||
COPY_TYPEMAPS(signed char, schar);
|
||||
COPY_TYPEMAPS(short, int16);
|
||||
COPY_TYPEMAPS(unsigned short, uint16);
|
||||
COPY_TYPEMAPS(int, int32);
|
||||
COPY_TYPEMAPS(unsigned int, uint32);
|
||||
COPY_TYPEMAPS(long long, int64);
|
||||
COPY_TYPEMAPS(unsigned long long, uint64);
|
||||
COPY_TYPEMAPS(int64_t, int64);
|
||||
COPY_TYPEMAPS(uint64_t, uint64);
|
||||
|
||||
COPY_TYPEMAPS(unsigned int, size_t);
|
||||
COPY_TYPEMAPS(unsigned int, mode_t);
|
||||
COPY_TYPEMAPS(long, time_t);
|
||||
COPY_TYPEMAPS(uint64, Fprint);
|
||||
|
||||
#undef COPY_TYPEMAPS
|
||||
|
||||
%apply (void * INPUT, unsigned int LENGTH)
|
||||
@@ -242,7 +221,9 @@ COPY_TYPEMAPS(uint64, Fprint);
|
||||
#endif // SWIGPYTHON
|
||||
|
||||
#ifdef SWIGJAVA
|
||||
// Add a char* cast to the SWIG 1.3.21 typemaps to remove a compiler warning.
|
||||
%{
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -252,6 +233,7 @@ COPY_TYPEMAPS(uint64, Fprint);
|
||||
#include "ortools/base/basictypes.h"
|
||||
%}
|
||||
|
||||
%include <stdint.i>
|
||||
%include <std_string.i>
|
||||
|
||||
%apply const std::string & {std::string &};
|
||||
@@ -356,11 +338,10 @@ COPY_TYPEMAPS(uint64, Fprint);
|
||||
typedef oldtype newtype;
|
||||
%enddef
|
||||
|
||||
COPY_TYPEMAPS(signed char, schar);
|
||||
COPY_TYPEMAPS(int, int32);
|
||||
COPY_TYPEMAPS(unsigned int, uint32);
|
||||
COPY_TYPEMAPS(long long, int64);
|
||||
COPY_TYPEMAPS(unsigned long long, uint64);
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
#undef COPY_TYPEMAPS
|
||||
#endif // SWIGJAVA
|
||||
@@ -368,6 +349,7 @@ COPY_TYPEMAPS(unsigned long long, uint64);
|
||||
#ifdef SWIGCSHARP
|
||||
%include "enumsimple.swg"
|
||||
%{
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
@@ -378,19 +360,15 @@ COPY_TYPEMAPS(unsigned long long, uint64);
|
||||
%}
|
||||
|
||||
%include <std_string.i>
|
||||
%include <stdint.i>
|
||||
|
||||
%apply const std::string & {std::string &};
|
||||
%apply const std::string & {std::string *};
|
||||
|
||||
%define COPY_TYPEMAPS(oldtype, newtype)
|
||||
typedef oldtype newtype;
|
||||
%enddef
|
||||
|
||||
COPY_TYPEMAPS(signed char, schar);
|
||||
COPY_TYPEMAPS(int, int32);
|
||||
COPY_TYPEMAPS(unsigned int, uint32);
|
||||
COPY_TYPEMAPS(long long, int64);
|
||||
COPY_TYPEMAPS(unsigned long long, uint64);
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
#undef COPY_TYPEMAPS
|
||||
#endif // SWIGCSHARP
|
||||
|
||||
@@ -22,6 +22,7 @@ using System.Collections;
|
||||
%include <stdint.i>
|
||||
%include <exception.i>
|
||||
%include <std_vector.i>
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/util/csharp/tuple_set.i"
|
||||
%include "ortools/util/csharp/functions.i"
|
||||
@@ -143,9 +144,9 @@ PROTECT_FROM_FAILURE(Solver::Fail(), arg1);
|
||||
// files end up being compiled into the same .dll, we must name the
|
||||
// vector template differently.
|
||||
%template(CpIntVector) std::vector<int>;
|
||||
%template(CpInt64Vector) std::vector<int64_t>;
|
||||
%template(CpInt64Vector) std::vector<int64>;
|
||||
%template(CpIntVectorVector) std::vector<std::vector<int> >;
|
||||
%template(CpInt64VectorVector) std::vector<std::vector<int64_t> >;
|
||||
%template(CpInt64VectorVector) std::vector<std::vector<int64> >;
|
||||
|
||||
%define CS_TYPEMAP_STDVECTOR_OBJECT(CTYPE, TYPE)
|
||||
SWIG_STD_VECTOR_ENHANCED(operations_research::CTYPE*);
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
|
||||
// TODO(user): Refactor this file to adhere to the SWIG style guide.
|
||||
|
||||
%include "enumsimple.swg"
|
||||
%include "exception.i"
|
||||
%include <enumsimple.swg>
|
||||
%include <exception.i>
|
||||
%include <stdint.i>
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include "ortools/util/java/tuple_set.i"
|
||||
%include "ortools/util/java/vector.i"
|
||||
%include "ortools/util/java/functions.i"
|
||||
|
||||
%include "ortools/util/java/proto.i"
|
||||
|
||||
// Remove swig warnings
|
||||
@@ -52,6 +52,9 @@ struct FailureProtect {
|
||||
};
|
||||
%}
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
// ############ BEGIN DUPLICATED CODE BLOCK ############
|
||||
// IMPORTANT: keep this code block in sync with the .i
|
||||
// files in ../python and ../csharp.
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
//
|
||||
// TODO(user): test all the APIs that are currently marked as 'untested'.
|
||||
|
||||
%include <stdint.i>
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
|
||||
%import "ortools/graph/ebert_graph.h"
|
||||
@@ -39,6 +41,9 @@
|
||||
#include "ortools/graph/min_cost_flow.h"
|
||||
%}
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
// ############ max_flow.h ############
|
||||
|
||||
%ignoreall
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
//
|
||||
// TODO(user): unit test all the APIs that are currently marked with 'no test'.
|
||||
|
||||
%include "ortools/base/base.i"
|
||||
%include <enums.swg> // For native Java enum support.
|
||||
%include <stdint.i>
|
||||
|
||||
%include "enums.swg" // For native Java enum support.
|
||||
%include "ortools/base/base.i"
|
||||
|
||||
// We prefer our in-house vector wrapper to std_vector.i, because it
|
||||
// converts to and from native java arrays.
|
||||
@@ -43,6 +44,9 @@ class MPModelRequest;
|
||||
class MPSolutionResponse;
|
||||
} // namespace operations_research
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
%{
|
||||
#include "ortools/linear_solver/linear_solver.h"
|
||||
%}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
//
|
||||
// TODO(user): move to base/swig/java.
|
||||
|
||||
%include <stdint.i>
|
||||
%include "ortools/base/base.i"
|
||||
|
||||
%{
|
||||
@@ -27,6 +28,9 @@
|
||||
#include "ortools/base/integral_types.h"
|
||||
%}
|
||||
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
// Typemaps to represent const std::vector<CType>& arguments as arrays of
|
||||
// JavaType.
|
||||
%define VECTOR_AS_JAVA_ARRAY(CType, JavaType, JavaTypeName)
|
||||
|
||||
Reference in New Issue
Block a user