Changeset 24:838d1d1b619e in xplra for src/client/c/hu/varadiistvan
- Timestamp:
- 02/07/13 16:16:04 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/client/c/hu/varadiistvan/xplra
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/xplra.cc
r23 r24 414 414 //------------------------------------------------------------------------------ 415 415 416 extern "C" ssize_t xplra_get_float_array(float* dest, size_t length, size_t offset, 417 int connectionID, const char* name) 418 { 419 Connection* connection = Slot::getConnection(connectionID); 420 if (connection==0) return -1; 421 try { 422 return connection->getFloatArray(name, dest, length, offset); 423 } catch (...) { 424 connection->handleException(); 425 return -1; 426 } 427 } 428 429 /*----------------------------------------------------------------------------*/ 430 431 extern "C" float* xplra_get_float_array_new(size_t* length, size_t offset, 432 int connectionID, const char* name) 433 { 434 Connection* connection = Slot::getConnection(connectionID); 435 if (connection==0) return 0; 436 try { 437 return connection->getFloatArray(name, *length, offset); 438 } catch (...) { 439 connection->handleException(); 440 return 0; 441 } 442 } 443 444 //------------------------------------------------------------------------------ 445 446 extern "C" ssize_t xplra_get_int_array(int32_t* dest, size_t length, size_t offset, 447 int connectionID, const char* name) 448 { 449 Connection* connection = Slot::getConnection(connectionID); 450 if (connection==0) return -1; 451 try { 452 return connection->getIntArray(name, dest, length, offset); 453 } catch (...) { 454 connection->handleException(); 455 return -1; 456 } 457 } 458 459 /*----------------------------------------------------------------------------*/ 460 461 extern "C" int32_t* xplra_get_int_array_new(size_t* length, size_t offset, 462 int connectionID, const char* name) 463 { 464 Connection* connection = Slot::getConnection(connectionID); 465 if (connection==0) return 0; 466 try { 467 return connection->getIntArray(name, *length, offset); 468 } catch (...) { 469 connection->handleException(); 470 return 0; 471 } 472 } 473 474 //------------------------------------------------------------------------------ 475 476 extern "C" ssize_t xplra_get_byte_array(void* dest, size_t length, size_t offset, 477 int connectionID, const char* name) 478 { 479 Connection* connection = Slot::getConnection(connectionID); 480 if (connection==0) return -1; 481 try { 482 return connection->getByteArray(name, reinterpret_cast<uint8_t*>(dest), 483 length, offset); 484 } catch (...) { 485 connection->handleException(); 486 return -1; 487 } 488 } 489 490 /*----------------------------------------------------------------------------*/ 491 492 extern "C" uint8_t* xplra_get_byte_array_new(size_t* length, size_t offset, 493 int connectionID, const char* name) 494 { 495 Connection* connection = Slot::getConnection(connectionID); 496 if (connection==0) return 0; 497 try { 498 return connection->getByteArray(name, *length, offset); 499 } catch (...) { 500 connection->handleException(); 501 return 0; 502 } 503 } 504 505 //------------------------------------------------------------------------------ 506 416 507 extern "C" int xplra_disconnect(int connectionID) 417 508 { -
src/client/c/hu/varadiistvan/xplra/xplra.h
r23 r24 32 32 /*----------------------------------------------------------------------------*/ 33 33 34 #include <stdlib.h> 35 #include <inttypes.h> 36 37 /*----------------------------------------------------------------------------*/ 38 34 39 #ifdef __cplusplus 35 40 extern "C" { … … 150 155 151 156 /** 157 * Get an array of floats into a buffer. 158 * 159 * @param dest the array into which to get the data 160 * @param length the length of the destination buffer 161 * @param offset the offset from which to query the array 162 * 163 * @return the actual number of elements returned in case of success, 164 * -1 on error 165 */ 166 ssize_t xplra_get_float_array(float* dest, size_t length, size_t offset, 167 int connectionID, const char* name); 168 169 /*----------------------------------------------------------------------------*/ 170 171 /** 172 * Get an array of floats into a newly allocated buffer. 173 * 174 * @param length pointer to a variable containing the length to 175 * query. On return it will be set to the actual length, which can be 176 * less than or equal to the input value. 177 * @param offset the offset from which to query the array 178 * 179 * @return the new array on success, 0 on error 180 */ 181 float* xplra_get_float_array_new(size_t* length, size_t offset, 182 int connectionID, const char* name); 183 184 /*----------------------------------------------------------------------------*/ 185 186 /** 187 * Get an array of integers into a buffer. 188 * 189 * @param dest the array into which to get the data 190 * @param length the length of the destination buffer 191 * @param offset the offset from which to query the array 192 * 193 * @return the actual number of elements returned in case of success, 194 * -1 on error 195 */ 196 ssize_t xplra_get_int_array(int32_t* dest, size_t length, size_t offset, 197 int connectionID, const char* name); 198 199 /*----------------------------------------------------------------------------*/ 200 201 /** 202 * Get an array of integers into a newly allocated buffer. 203 * 204 * @param length pointer to a variable containing the length to 205 * query. On return it will be set to the actual length, which can be 206 * less than or equal to the input value. 207 * @param offset the offset from which to query the array 208 * 209 * @return the new array on success, 0 on error 210 */ 211 int32_t* xplra_get_int_array_new(size_t* length, size_t offset, 212 int connectionID, const char* name); 213 214 /*----------------------------------------------------------------------------*/ 215 216 /** 217 * Get an array of bytes into a buffer. 218 * 219 * @param dest the array into which to get the data 220 * @param length the length of the destination buffer 221 * @param offset the offset from which to query the array 222 * 223 * @return the actual number of elements returned in case of success, 224 * -1 on error 225 */ 226 ssize_t xplra_get_byte_array(void* dest, size_t length, size_t offset, 227 int connectionID, const char* name); 228 229 /*----------------------------------------------------------------------------*/ 230 231 /** 232 * Get an array of bytes into a newly allocated buffer. 233 * 234 * @param length pointer to a variable containing the length to 235 * query. On return it will be set to the actual length, which can be 236 * less than or equal to the input value. 237 * @param offset the offset from which to query the array 238 * 239 * @return the new array on success, 0 on error 240 */ 241 uint8_t* xplra_get_byte_array_new(size_t* length, size_t offset, 242 int connectionID, const char* name); 243 244 /*----------------------------------------------------------------------------*/ 245 246 /** 152 247 * Destroy the connection with the given ID. 153 248 *
Note:
See TracChangeset
for help on using the changeset viewer.