Fixed wrap support for unsigned char
parent
3c694e25f7
commit
8bcd2da2f0
2
gtsam.h
2
gtsam.h
|
@ -19,7 +19,7 @@
|
||||||
* Arguments to functions any of
|
* Arguments to functions any of
|
||||||
* - Eigen types: Matrix, Vector
|
* - Eigen types: Matrix, Vector
|
||||||
* - Eigen types and classes as an optionally const reference
|
* - Eigen types and classes as an optionally const reference
|
||||||
* - C/C++ basic types: string, bool, size_t, int, double
|
* - C/C++ basic types: string, bool, size_t, int, double, char
|
||||||
* - Any class with which be copied with boost::make_shared() (except Eigen)
|
* - Any class with which be copied with boost::make_shared() (except Eigen)
|
||||||
* - boost::shared_ptr of any object type (except Eigen)
|
* - boost::shared_ptr of any object type (except Eigen)
|
||||||
* Comments can use either C++ or C style, with multiple lines
|
* Comments can use either C++ or C style, with multiple lines
|
||||||
|
|
|
@ -106,6 +106,14 @@ mxArray* wrap<char>(char& value) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// specialization to unsigned char
|
||||||
|
template<>
|
||||||
|
mxArray* wrap<unsigned char>(unsigned char& value) {
|
||||||
|
mxArray *result = scalar(mxUINT32OR64_CLASS);
|
||||||
|
*(unsigned char*)mxGetData(result) = value;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// specialization to bool
|
// specialization to bool
|
||||||
template<>
|
template<>
|
||||||
mxArray* wrap<bool>(bool& value) {
|
mxArray* wrap<bool>(bool& value) {
|
||||||
|
@ -227,13 +235,20 @@ bool unwrap<bool>(const mxArray* array) {
|
||||||
return myGetScalar<bool>(array);
|
return myGetScalar<bool>(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
// specialization to bool
|
// specialization to char
|
||||||
template<>
|
template<>
|
||||||
char unwrap<char>(const mxArray* array) {
|
char unwrap<char>(const mxArray* array) {
|
||||||
checkScalar(array,"unwrap<char>");
|
checkScalar(array,"unwrap<char>");
|
||||||
return myGetScalar<char>(array);
|
return myGetScalar<char>(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// specialization to unsigned char
|
||||||
|
template<>
|
||||||
|
unsigned char unwrap<unsigned char>(const mxArray* array) {
|
||||||
|
checkScalar(array,"unwrap<unsigned char>");
|
||||||
|
return myGetScalar<unsigned char>(array);
|
||||||
|
}
|
||||||
|
|
||||||
// specialization to int
|
// specialization to int
|
||||||
template<>
|
template<>
|
||||||
int unwrap<int>(const mxArray* array) {
|
int unwrap<int>(const mxArray* array) {
|
||||||
|
|
Loading…
Reference in New Issue