1 // R specific swig components 2 /* 3 Vectors 4 */ 5 6 %fragment("StdVectorTraits","header",fragment="StdSequenceTraits") 7 %{ 8 namespace swig { 9 // vectors of doubles 10 template <> 11 struct traits_from_ptr<std::vector<double> > { 12 static SEXP from (std::vector<double > *val, int owner = 0) { 13 SEXP result; 14 PROTECT(result = Rf_allocVector(REALSXP, val->size())); 15 for (unsigned pos = 0; pos < val->size(); pos++) 16 { 17 NUMERIC_POINTER(result)[pos] = ((*val)[pos]); 18 } 19 UNPROTECT(1); 20 return(result); 21 } 22 }; 23 // vectors of floats 24 template <> 25 struct traits_from_ptr<std::vector<float> > { 26 static SEXP from (std::vector<float > *val, int owner = 0) { 27 SEXP result; 28 PROTECT(result = Rf_allocVector(REALSXP, val->size())); 29 for (unsigned pos = 0; pos < val->size(); pos++) 30 { 31 NUMERIC_POINTER(result)[pos] = ((*val)[pos]); 32 } 33 UNPROTECT(1); 34 return(result); 35 } 36 }; 37 // vectors of unsigned int 38 template <> 39 struct traits_from_ptr<std::vector<unsigned int> > { 40 static SEXP from (std::vector<unsigned int > *val, int owner = 0) { 41 SEXP result; 42 PROTECT(result = Rf_allocVector(INTSXP, val->size())); 43 for (unsigned pos = 0; pos < val->size(); pos++) 44 { 45 INTEGER_POINTER(result)[pos] = ((*val)[pos]); 46 } 47 UNPROTECT(1); 48 return(result); 49 } 50 }; 51 // vectors of int 52 template <> 53 struct traits_from_ptr<std::vector<int> > { 54 static SEXP from (std::vector<int > *val, int owner = 0) { 55 SEXP result; 56 PROTECT(result = Rf_allocVector(INTSXP, val->size())); 57 for (unsigned pos = 0; pos < val->size(); pos++) 58 { 59 INTEGER_POINTER(result)[pos] = ((*val)[pos]); 60 } 61 UNPROTECT(1); 62 return(result); 63 } 64 }; 65 66 // vectors of bool 67 template <> 68 struct traits_from_ptr<std::vector<bool> > { 69 static SEXP from (std::vector<bool> *val, int owner = 0) { 70 SEXP result; 71 PROTECT(result = Rf_allocVector(LGLSXP, val->size())); 72 for (unsigned pos = 0; pos < val->size(); pos++) 73 { 74 LOGICAL_POINTER(result)[pos] = ((*val)[pos]); 75 } 76 UNPROTECT(1); 77 return(result); 78 //return SWIG_R_NewPointerObj(val, type_info< std::vector<T > >(), owner); 79 } 80 }; 81 // vectors of strings 82 template <> 83 struct traits_from_ptr<std::vector<std::basic_string<char> > > { 84 static SEXP from (std::vector<std::basic_string<char> > *val, int owner = 0) { 85 SEXP result; 86 PROTECT(result = Rf_allocVector(STRSXP, val->size())); 87 for (unsigned pos = 0; pos < val->size(); pos++) 88 { 89 CHARACTER_POINTER(result)[pos] = Rf_mkChar(((*val)[pos]).c_str()); 90 } 91 UNPROTECT(1); 92 return(result); 93 //return SWIG_R_NewPointerObj(val, type_info< std::vector<T > >(), owner); 94 } 95 }; 96 97 // catch all that does everything with vectors 98 template <typename T> 99 struct traits_from_ptr< std::vector< T > > { 100 static SEXP from (std::vector< T > *val, int owner = 0) { 101 return SWIG_R_NewPointerObj(val, type_info< std::vector< T > >(), owner); 102 } 103 }; 104 105 template <> 106 struct traits_asptr < std::vector<double> > { 107 static int asptr(SEXP obj, std::vector<double> **val) { 108 std::vector<double> *p; 109 // not sure how to check the size of the SEXP obj is correct 110 unsigned int sexpsz = Rf_length(obj); 111 p = new std::vector<double>(sexpsz); 112 double *S = NUMERIC_POINTER(obj); 113 for (unsigned pos = 0; pos < p->size(); pos++) 114 { 115 (*p)[pos] = static_cast<double>(S[pos]); 116 } 117 int res = SWIG_OK; 118 if (SWIG_IsOK(res)) { 119 if (val) *val = p; 120 } 121 return res; 122 } 123 }; 124 125 template <> 126 struct traits_asptr < std::vector<float> > { 127 static int asptr(SEXP obj, std::vector<float> **val) { 128 std::vector<float> *p; 129 // not sure how to check the size of the SEXP obj is correct 130 unsigned int sexpsz = Rf_length(obj); 131 p = new std::vector<float>(sexpsz); 132 double *S = NUMERIC_POINTER(obj); 133 for (unsigned pos = 0; pos < p->size(); pos++) 134 { 135 (*p)[pos] = static_cast<double>(S[pos]); 136 } 137 int res = SWIG_OK; 138 if (SWIG_IsOK(res)) { 139 if (val) *val = p; 140 } 141 return res; 142 } 143 }; 144 145 template <> 146 struct traits_asptr < std::vector<unsigned int> > { 147 static int asptr(SEXP obj, std::vector<unsigned int> **val) { 148 std::vector<unsigned int> *p; 149 unsigned int sexpsz = Rf_length(obj); 150 p = new std::vector<unsigned int>(sexpsz); 151 SEXP coerced; 152 PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); 153 int *S = INTEGER_POINTER(coerced); 154 for (unsigned pos = 0; pos < p->size(); pos++) 155 { 156 (*p)[pos] = static_cast<unsigned int>(S[pos]); 157 } 158 int res = SWIG_OK; 159 if (SWIG_IsOK(res)) { 160 if (val) *val = p; 161 } 162 UNPROTECT(1); 163 return res; 164 } 165 }; 166 167 template <> 168 struct traits_asptr < std::vector<int> > { 169 static int asptr(SEXP obj, std::vector<int> **val) { 170 std::vector<int> *p; 171 // not sure how to check the size of the SEXP obj is correct 172 int sexpsz = Rf_length(obj); 173 p = new std::vector<int>(sexpsz); 174 SEXP coerced; 175 PROTECT(coerced = Rf_coerceVector(obj, INTSXP)); 176 int *S = INTEGER_POINTER(coerced); 177 for (unsigned pos = 0; pos < p->size(); pos++) 178 { 179 (*p)[pos] = static_cast<int>(S[pos]); 180 } 181 int res = SWIG_OK; 182 if (SWIG_IsOK(res)) { 183 if (val) *val = p; 184 } 185 UNPROTECT(1); 186 return res; 187 } 188 }; 189 190 template <> 191 struct traits_asptr < std::vector<bool> > { 192 static int asptr(SEXP obj, std::vector<bool> **val) { 193 std::vector<bool> *p; 194 // not sure how to check the size of the SEXP obj is correct 195 int sexpsz = Rf_length(obj); 196 p = new std::vector<bool>(sexpsz); 197 SEXP coerced; 198 PROTECT(coerced = Rf_coerceVector(obj, LGLSXP)); 199 int *S = LOGICAL_POINTER(coerced); 200 for (unsigned pos = 0; pos < p->size(); pos++) 201 { 202 (*p)[pos] = static_cast<bool>(S[pos]); 203 } 204 int res = SWIG_OK; 205 if (SWIG_IsOK(res)) { 206 if (val) *val = p; 207 } 208 UNPROTECT(1); 209 return res; 210 } 211 }; 212 213 // catchall for R to vector conversion 214 template <typename T> 215 struct traits_asptr < std::vector<T> > { 216 static int asptr(SEXP obj, std::vector<T> **val) { 217 std::vector<T> *p; 218 Rprintf("my asptr\n"); 219 int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector<T> >(), 0); 220 if (SWIG_IsOK(res)) { 221 if (val) *val = p; 222 } 223 return res; 224 } 225 }; 226 227 // now for vectors of vectors. These will be represented as lists of vectors on the 228 // catch all that does everything with vectors 229 template <> 230 struct traits_from_ptr<std::vector<std::vector<unsigned int> > > { 231 static SEXP from (std::vector< std::vector<unsigned int > > *val, int owner = 0) { 232 SEXP result; 233 // allocate the R list 234 PROTECT(result = Rf_allocVector(VECSXP, val->size())); 235 for (unsigned pos = 0; pos < val->size(); pos++) 236 { 237 // allocate the R vector 238 SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); 239 // Fill the R vector 240 for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) 241 { 242 INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); 243 } 244 } 245 UNPROTECT(1); 246 return(result); 247 } 248 }; 249 250 template <> 251 struct traits_from_ptr<std::vector<std::vector<int> > > { 252 static SEXP from (std::vector< std::vector<int > > *val, int owner = 0) { 253 SEXP result; 254 // allocate the R list 255 PROTECT(result = Rf_allocVector(VECSXP, val->size())); 256 for (unsigned pos = 0; pos < val->size(); pos++) 257 { 258 // allocate the R vector 259 SET_VECTOR_ELT(result, pos, Rf_allocVector(INTSXP, val->at(pos).size())); 260 // Fill the R vector 261 for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) 262 { 263 INTEGER_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<int>(val->at(pos).at(vpos)); 264 } 265 } 266 UNPROTECT(1); 267 return(result); 268 } 269 }; 270 271 template <> 272 struct traits_from_ptr<std::vector<std::vector<float> > > { 273 static SEXP from (std::vector< std::vector<float > > *val, int owner = 0) { 274 SEXP result; 275 // allocate the R list 276 PROTECT(result = Rf_allocVector(VECSXP, val->size())); 277 for (unsigned pos = 0; pos < val->size(); pos++) 278 { 279 // allocate the R vector 280 SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); 281 // Fill the R vector 282 for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) 283 { 284 NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); 285 } 286 } 287 UNPROTECT(1); 288 return(result); 289 } 290 }; 291 292 template <> 293 struct traits_from_ptr<std::vector<std::vector<double> > > { 294 static SEXP from (std::vector< std::vector<double > > *val, int owner = 0) { 295 SEXP result; 296 // allocate the R list 297 PROTECT(result = Rf_allocVector(VECSXP, val->size())); 298 for (unsigned pos = 0; pos < val->size(); pos++) 299 { 300 // allocate the R vector 301 SET_VECTOR_ELT(result, pos, Rf_allocVector(REALSXP, val->at(pos).size())); 302 // Fill the R vector 303 for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) 304 { 305 NUMERIC_POINTER(VECTOR_ELT(result, pos))[vpos] = static_cast<double>(val->at(pos).at(vpos)); 306 } 307 } 308 UNPROTECT(1); 309 return(result); 310 } 311 }; 312 313 template <> 314 struct traits_from_ptr<std::vector<std::vector<bool> > > { 315 static SEXP from (std::vector< std::vector<bool> > *val, int owner = 0) { 316 SEXP result; 317 // allocate the R list 318 PROTECT(result = Rf_allocVector(VECSXP, val->size())); 319 for (unsigned pos = 0; pos < val->size(); pos++) 320 { 321 // allocate the R vector 322 SET_VECTOR_ELT(result, pos, Rf_allocVector(LGLSXP, val->at(pos).size())); 323 // Fill the R vector 324 for (unsigned vpos = 0; vpos < val->at(pos).size(); ++vpos) 325 { 326 LOGICAL_POINTER(VECTOR_ELT(result, pos))[vpos] = (val->at(pos).at(vpos)); 327 } 328 } 329 UNPROTECT(1); 330 return(result); 331 } 332 }; 333 334 template <typename T> 335 struct traits_from_ptr< std::vector < std::vector< T > > > { 336 static SEXP from (std::vector < std::vector< T > > *val, int owner = 0) { 337 return SWIG_R_NewPointerObj(val, type_info< std::vector < std::vector< T > > >(), owner); 338 } 339 }; 340 341 // R side 342 template <> 343 struct traits_asptr < std::vector< std::vector<unsigned int> > > { 344 static int asptr(SEXP obj, std::vector< std::vector<unsigned int> > **val) { 345 std::vector <std::vector<unsigned int> > *p; 346 // this is the length of the list 347 unsigned int sexpsz = Rf_length(obj); 348 p = new std::vector< std::vector<unsigned int> > (sexpsz); 349 350 for (unsigned listpos = 0; listpos < sexpsz; ++listpos) 351 { 352 unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); 353 for (unsigned vpos = 0; vpos < vecsize; ++vpos) 354 { 355 (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); 356 } 357 } 358 359 int res = SWIG_OK; 360 361 if (SWIG_IsOK(res)) { 362 if (val) *val = p; 363 } 364 return res; 365 } 366 }; 367 368 template <> 369 struct traits_asptr < std::vector< std::vector< int> > > { 370 static int asptr(SEXP obj, std::vector< std::vector< int> > **val) { 371 std::vector <std::vector< int> > *p; 372 // this is the length of the list 373 unsigned int sexpsz = Rf_length(obj); 374 p = new std::vector< std::vector< int> > (sexpsz); 375 376 for (unsigned listpos = 0; listpos < sexpsz; ++listpos) 377 { 378 unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); 379 for (unsigned vpos = 0; vpos < vecsize; ++vpos) 380 { 381 (*p)[listpos].push_back(static_cast<int>(INTEGER_POINTER(VECTOR_ELT(obj, listpos))[vpos])); 382 } 383 } 384 385 int res = SWIG_OK; 386 387 if (SWIG_IsOK(res)) { 388 if (val) *val = p; 389 } 390 return res; 391 } 392 }; 393 394 template <> 395 struct traits_asptr < std::vector< std::vector< float> > > { 396 static int asptr(SEXP obj, std::vector< std::vector< float> > **val) { 397 std::vector <std::vector< float> > *p; 398 // this is the length of the list 399 unsigned int sexpsz = Rf_length(obj); 400 p = new std::vector< std::vector< float> > (sexpsz); 401 402 for (unsigned listpos = 0; listpos < sexpsz; ++listpos) 403 { 404 unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); 405 for (unsigned vpos = 0; vpos < vecsize; ++vpos) 406 { 407 (*p)[listpos].push_back(static_cast<float>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); 408 } 409 } 410 411 int res = SWIG_OK; 412 413 if (SWIG_IsOK(res)) { 414 if (val) *val = p; 415 } 416 return res; 417 } 418 }; 419 420 template <> 421 struct traits_asptr < std::vector< std::vector< double> > > { 422 static int asptr(SEXP obj, std::vector< std::vector< double> > **val) { 423 std::vector <std::vector< double> > *p; 424 // this is the length of the list 425 unsigned int sexpsz = Rf_length(obj); 426 p = new std::vector< std::vector< double> > (sexpsz); 427 428 for (unsigned listpos = 0; listpos < sexpsz; ++listpos) 429 { 430 unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); 431 for (unsigned vpos = 0; vpos < vecsize; ++vpos) 432 { 433 (*p)[listpos].push_back(static_cast<double>(NUMERIC_POINTER(VECTOR_ELT(obj, listpos))[vpos])); 434 } 435 } 436 437 int res = SWIG_OK; 438 439 if (SWIG_IsOK(res)) { 440 if (val) *val = p; 441 } 442 return res; 443 } 444 }; 445 446 template <> 447 struct traits_asptr < std::vector< std::vector< bool > > > { 448 static int asptr(SEXP obj, std::vector< std::vector< bool> > **val) { 449 std::vector <std::vector< bool > > *p; 450 // this is the length of the list 451 unsigned int sexpsz = Rf_length(obj); 452 p = new std::vector< std::vector< bool > > (sexpsz); 453 454 for (unsigned listpos = 0; listpos < sexpsz; ++listpos) 455 { 456 unsigned vecsize = Rf_length(VECTOR_ELT(obj, listpos)); 457 for (unsigned vpos = 0; vpos < vecsize; ++vpos) 458 { 459 (*p)[listpos].push_back(static_cast<bool>(LOGICAL_POINTER(VECTOR_ELT(obj, listpos))[vpos])); 460 } 461 } 462 463 int res = SWIG_OK; 464 465 if (SWIG_IsOK(res)) { 466 if (val) *val = p; 467 } 468 return res; 469 } 470 }; 471 472 // catchall 473 template <typename T> 474 struct traits_asptr < std::vector< std::vector<T> > > { 475 static int asptr(SEXP obj, std::vector< std::vector<T> > **val) { 476 std::vector< std::vector<T> > *p; 477 Rprintf("vector of vectors - unsupported content\n"); 478 int res = SWIG_R_ConvertPtr(obj, (void**)&p, type_info< std::vector< std::vector<T> > > (), 0); 479 if (SWIG_IsOK(res)) { 480 if (val) *val = p; 481 } 482 return res; 483 } 484 }; 485 486 } 487 %} 488 489 #define %swig_vector_methods(Type...) %swig_sequence_methods(Type) 490 #define %swig_vector_methods_val(Type...) %swig_sequence_methods_val(Type); 491 492 %define %traits_type_name(Type...) 493 %fragment(SWIG_Traits_frag(Type), "header", 494 fragment="StdTraits",fragment="StdVectorTraits") { 495 namespace swig { 496 template <> struct traits< Type > { 497 typedef pointer_category category; 498 static const char* type_name() { 499 return #Type; 500 } 501 }; 502 } 503 } 504 %enddef 505 506 %include <std/std_vector.i> 507 508 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<double>) 509 %traits_type_name(std::vector<double>) 510 %typemap("rtypecheck") std::vector<double>, std::vector<double> const, std::vector<double> const& 511 %{ is.numeric($arg) %} 512 %typemap("rtype") std::vector<double> "numeric" 513 %typemap("scoercein") std::vector<double>, std::vector<double> const, std::vector<double> const& ""; 514 515 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<float>) 516 %traits_type_name(std::vector<float>) 517 %typemap("rtypecheck") std::vector<float>, std::vector<float> const, std::vector<float> const& 518 %{ is.numeric($arg) %} 519 %typemap("rtype") std::vector<float> "numeric" 520 %typemap("scoercein") std::vector<double>, std::vector<float> const, std::vector<float> const& ""; 521 522 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<bool>); 523 %traits_type_name(std::vector<bool>); 524 %typemap("rtypecheck") std::vector<bool> , std::vector<bool> const, std::vector<bool> const& 525 %{ is.logical($arg) %} 526 %typemap("rtype") std::vector<bool> "logical" 527 %typemap("scoercein") std::vector<bool> , std::vector<bool> const, std::vector<bool> const& "$input = as.logical($input);"; 528 529 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<int>); 530 %traits_type_name(std::vector<int>); 531 %typemap("rtypecheck") std::vector<int> , std::vector<int> const, std::vector<int> const& 532 %{ is.integer($arg) || is.numeric($arg) %} 533 %typemap("rtype") std::vector<int> "integer" 534 %typemap("scoercein") std::vector<int> , std::vector<int> const, std::vector<int> const& "$input = as.integer($input);"; 535 536 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<unsigned int>); 537 %traits_type_name(std::vector<unsigned int>); 538 %typemap("rtypecheck") std::vector<unsigned int>, std::vector<unsigned int> const, std::vector<unsigned int> const& 539 %{ is.integer($arg) || is.numeric($arg) %} 540 %typemap("rtype") std::vector<unsigned int> "integer" 541 %typemap("scoercein") std::vector<unsigned int>, std::vector<unsigned int> const, std::vector<unsigned int> const& "$input = as.integer($input);"; 542 543 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<unsigned int> >); 544 %traits_type_name(std::vector< std::vector<unsigned int> >); 545 %typemap("rtypecheck") std::vector<std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > const, std::vector<std::vector<unsigned int> >const& 546 %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} 547 %typemap("rtype") std::vector<std::vector<unsigned int> > "list" 548 %typemap("scoercein") std::vector< std::vector<unsigned int> >, std::vector<std::vector<unsigned int> > const, std::vector<std::vector<unsigned int> >const& "$input = lapply($input, as.integer);"; 549 550 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<int> >); 551 %traits_type_name(std::vector< std::vector<int> >); 552 %typemap("rtypecheck") std::vector<std::vector<int> >, std::vector<std::vector<int> > const, std::vector<std::vector<int> >const& 553 %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} 554 %typemap("rtype") std::vector<std::vector<int> > "list" 555 %typemap("scoercein") std::vector< std::vector<int> >, std::vector<std::vector<int> > const, std::vector<std::vector<int> >const& "$input = lapply($input, as.integer);"; 556 557 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<float> >); 558 %traits_type_name(std::vector< std::vector<float> >); 559 %typemap("rtypecheck") std::vector<std::vector<float> >, std::vector<std::vector<float> > const, std::vector<std::vector<float> >const& 560 %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} 561 %typemap("rtype") std::vector<std::vector<float> > "list" 562 %typemap("scoercein") std::vector< std::vector<float> >, std::vector<std::vector<float> > const, std::vector<std::vector<float> >const& "$input = lapply($input, as.numeric);"; 563 564 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<double> >); 565 %traits_type_name(std::vector< std::vector<double> >); 566 %typemap("rtypecheck") std::vector<std::vector<double> >, std::vector<std::vector<double> > const, std::vector<std::vector<double> >const& 567 %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} 568 %typemap("rtype") std::vector<std::vector<double> > "list" 569 %typemap("scoercein") std::vector< std::vector<double> >, std::vector<std::vector<double> > const, std::vector<std::vector<double> >const& 570 "$input = lapply($input, as.numeric);"; 571 572 %typemap_traits_ptr(SWIG_TYPECHECK_VECTOR, std::vector<std::vector<bool> >); 573 %traits_type_name(std::vector< std::vector<bool> >); 574 %typemap("rtypecheck") std::vector<std::vector<bool> >, std::vector<std::vector<bool> > const, std::vector<std::vector<bool> >const& 575 %{ is.list($arg) && all(sapply($arg , is.integer) || sapply($arg, is.numeric)) %} 576 %typemap("rtype") std::vector<std::vector<bool> > "list" 577 %typemap("scoercein") std::vector< std::vector<bool> >, std::vector<std::vector<bool> > const, std::vector<std::vector<bool> >const& "$input = lapply($input, as.logical);"; 578 579 // we don't want these to be given R classes as they 580 // have already been turned into R vectors. 581 %typemap(scoerceout) std::vector<double>, 582 std::vector<double> *, 583 std::vector<double> &, 584 std::vector<bool>, 585 std::vector<bool> *, 586 std::vector<bool> &, 587 std::vector<unsigned int>, 588 std::vector<unsigned int> *, 589 std::vector<unsigned int> &, 590 // vectors of vectors 591 std::vector< std::vector<unsigned int> >, 592 std::vector< std::vector<unsigned int> >*, 593 std::vector< std::vector<unsigned int> >&, 594 std::vector< std::vector<int> >, 595 std::vector< std::vector<int> >*, 596 std::vector< std::vector<int> >&, 597 std::vector< std::vector<float> >, 598 std::vector< std::vector<float> >*, 599 std::vector< std::vector<float> >&, 600 std::vector< std::vector<double> >, 601 std::vector< std::vector<double> >*, 602 std::vector< std::vector<double> >&, 603 std::vector< std::vector<bool> >, 604 std::vector< std::vector<bool> >*, 605 std::vector< std::vector<bool> >& 606 607 608 %{ %} 609