Changeset 29:5ab375f73489 in xplra for src
- Timestamp:
- 02/09/13 08:21:45 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/client/c/hu/varadiistvan/xplra
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/MultiBuffer.h
r26 r29 163 163 public: 164 164 /** 165 * Get the X-Plane object this buffer belongs to. 166 */ 167 XPlane& getXPlane() const throw(); 168 169 /** 165 170 * Add an integer dataref. 166 171 * 167 * @return the ID if the dataref, that can be used later to set or172 * @return the ID of the dataref, that can be used later to set or 168 173 * get the value. 169 174 */ … … 173 178 * Add a float dataref. 174 179 * 175 * @return the ID if the dataref, that can be used later to set or180 * @return the ID of the dataref, that can be used later to set or 176 181 * get the value. 177 182 */ … … 181 186 * Add a double dataref. 182 187 * 183 * @return the ID if the dataref, that can be used later to set or188 * @return the ID of the dataref, that can be used later to set or 184 189 * get the value. 185 190 */ … … 189 194 * Add a float array dataref. 190 195 * 191 * @return the ID if the dataref, that can be used later to set or196 * @return the ID of the dataref, that can be used later to set or 192 197 * get the value. 193 198 */ … … 198 203 * Add an integer array dataref. 199 204 * 200 * @return the ID if the dataref, that can be used later to set or205 * @return the ID of the dataref, that can be used later to set or 201 206 * get the value. 202 207 */ … … 207 212 * Add a byte array dataref. 208 213 * 209 * @return the ID if the dataref, that can be used later to set or214 * @return the ID of the dataref, that can be used later to set or 210 215 * get the value. 211 216 */ … … 535 540 friend class XPlane; 536 541 }; 542 543 //------------------------------------------------------------------------------ 544 // Inline definitions 545 //------------------------------------------------------------------------------ 546 547 inline XPlane& MultiBuffer::getXPlane() const throw() 548 { 549 return xplane; 550 } 537 551 538 552 //------------------------------------------------------------------------------ -
src/client/c/hu/varadiistvan/xplra/xplra.cc
r28 r29 244 244 typedef std::set<int> multiBufferIDs_t; 245 245 246 public: 247 /** 248 * Get the connection for the given multi-dataref buffer. 249 */ 250 static Connection& get(const MultiBuffer& buffer) throw(); 251 252 private: 246 253 /** 247 254 * The last error code. … … 319 326 bool destroyMultiBuffer(int bufferID) throw(Exception); 320 327 }; 328 329 //------------------------------------------------------------------------------ 330 331 inline Connection& Connection::get(const MultiBuffer& buffer) throw() 332 { 333 return static_cast<Connection&>(buffer.getXPlane()); 334 } 321 335 322 336 //------------------------------------------------------------------------------ … … 737 751 //------------------------------------------------------------------------------ 738 752 739 extern "C" int xplra_ create_multi_getter(int connectionID)753 extern "C" int xplra_multi_create_getter(int connectionID) 740 754 { 741 755 Connection* connection = ConnectionSlot::getValue(connectionID); … … 745 759 //------------------------------------------------------------------------------ 746 760 747 extern "C" int xplra_ create_multi_setter(int connectionID)761 extern "C" int xplra_multi_create_setter(int connectionID) 748 762 { 749 763 Connection* connection = ConnectionSlot::getValue(connectionID); … … 753 767 //------------------------------------------------------------------------------ 754 768 755 extern "C" int xplra_destroy_multi_buffer(int connectionID, int bufferID) 769 extern "C" size_t xplra_multi_add_int(int bufferID, const char* name) 770 { 771 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 772 return (buffer==0) ? INVALID_DATAREF_ID : buffer->addInt(name); 773 } 774 775 //------------------------------------------------------------------------------ 776 777 extern "C" size_t xplra_multi_add_float(int bufferID, const char* name) 778 { 779 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 780 return (buffer==0) ? INVALID_DATAREF_ID : buffer->addFloat(name); 781 } 782 783 //------------------------------------------------------------------------------ 784 785 extern "C" size_t xplra_multi_add_double(int bufferID, const char* name) 786 { 787 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 788 return (buffer==0) ? INVALID_DATAREF_ID : buffer->addDouble(name); 789 } 790 791 /*----------------------------------------------------------------------------*/ 792 793 extern "C" size_t xplra_multi_add_float_array(int bufferID, const char* name, 794 size_t length, size_t offset) 795 { 796 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 797 return (buffer==0) ? 798 INVALID_DATAREF_ID : buffer->addFloatArray(name, length, offset); 799 } 800 801 /*----------------------------------------------------------------------------*/ 802 803 extern "C" size_t xplra_multi_add_int_array(int bufferID, const char* name, 804 size_t length, size_t offset) 805 { 806 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 807 return (buffer==0) ? 808 INVALID_DATAREF_ID : buffer->addIntArray(name, length, offset); 809 } 810 811 /*----------------------------------------------------------------------------*/ 812 813 extern "C" size_t xplra_multi_add_byte_array(int bufferID, const char* name, 814 size_t length, size_t offset) 815 { 816 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 817 return (buffer==0) ? 818 INVALID_DATAREF_ID : buffer->addByteArray(name, length, offset); 819 } 820 821 /*----------------------------------------------------------------------------*/ 822 823 extern "C" int xplra_multi_finalize(int bufferID) 824 { 825 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 826 return (buffer==0) ? -1 : (buffer->finalize() ? 1 : 0); 827 } 828 829 /*----------------------------------------------------------------------------*/ 830 831 extern "C" int xplra_multi_register(int bufferID) 832 { 833 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 834 if (buffer==0) return -1; 835 try { 836 buffer->registerInXPlane(); 837 return 0; 838 } catch (...) { 839 Connection::get(*buffer).handleException(); 840 return -1; 841 } 842 } 843 844 /*----------------------------------------------------------------------------*/ 845 846 extern "C" int xplra_multi_unregister(int bufferID) 847 { 848 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 849 if (buffer==0) return -1; 850 try { 851 buffer->unregisterFromXPlane(); 852 return 0; 853 } catch (...) { 854 Connection::get(*buffer).handleException(); 855 return -1; 856 } 857 } 858 859 /*----------------------------------------------------------------------------*/ 860 861 extern "C" int xplra_multi_execute(int bufferID) 862 { 863 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 864 if (buffer==0) return -1; 865 try { 866 buffer->execute(); 867 return 0; 868 } catch (...) { 869 Connection::get(*buffer).handleException(); 870 return -1; 871 } 872 } 873 874 //------------------------------------------------------------------------------ 875 876 extern "C" int xplra_multi_set_int(int bufferID, size_t datarefID, int value) 877 { 878 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 879 if (buffer==0) return -1; 880 try { 881 buffer->setInt(datarefID, value); 882 return 0; 883 } catch (...) { 884 Connection::get(*buffer).handleException(); 885 return -1; 886 } 887 } 888 889 /*----------------------------------------------------------------------------*/ 890 891 extern "C" int xplra_multi_get_int(int* dest, int bufferID, size_t datarefID) 892 { 893 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 894 if (buffer==0) return -1; 895 try { 896 *dest = buffer->getInt(datarefID); 897 return 0; 898 } catch (...) { 899 Connection::get(*buffer).handleException(); 900 return -1; 901 } 902 } 903 904 /*----------------------------------------------------------------------------*/ 905 906 extern "C" 907 const int32_t* xplra_multi_get_int_const_ptr(int bufferID, size_t datarefID) 908 { 909 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 910 if (buffer==0) return 0; 911 try { 912 return &(buffer->getIntRef(datarefID)); 913 } catch (...) { 914 Connection::get(*buffer).handleException(); 915 return 0; 916 } 917 } 918 919 /*----------------------------------------------------------------------------*/ 920 921 extern "C" 922 int32_t* xplra_multi_get_int_ptr(int bufferID, size_t datarefID) 923 { 924 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 925 if (buffer==0) return 0; 926 try { 927 return &(buffer->getIntRef(datarefID)); 928 } catch (...) { 929 Connection::get(*buffer).handleException(); 930 return 0; 931 } 932 } 933 934 //------------------------------------------------------------------------------ 935 936 extern "C" 937 int xplra_multi_set_float(int bufferID, size_t datarefID, float value) 938 { 939 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 940 if (buffer==0) return -1; 941 try { 942 buffer->setFloat(datarefID, value); 943 return 0; 944 } catch (...) { 945 Connection::get(*buffer).handleException(); 946 return -1; 947 } 948 } 949 950 /*----------------------------------------------------------------------------*/ 951 952 extern "C" 953 int xplra_multi_get_float(float* dest, int bufferID, size_t datarefID) 954 { 955 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 956 if (buffer==0) return -1; 957 try { 958 *dest = buffer->getFloat(datarefID); 959 return 0; 960 } catch (...) { 961 Connection::get(*buffer).handleException(); 962 return -1; 963 } 964 } 965 966 /*----------------------------------------------------------------------------*/ 967 968 extern "C" 969 const float* xplra_multi_get_float_const_ptr(int bufferID, size_t datarefID) 970 { 971 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 972 if (buffer==0) return 0; 973 try { 974 return &(buffer->getFloatRef(datarefID)); 975 } catch (...) { 976 Connection::get(*buffer).handleException(); 977 return 0; 978 } 979 } 980 981 /*----------------------------------------------------------------------------*/ 982 983 extern "C" 984 float* xplra_multi_get_float_ptr(int bufferID, size_t datarefID) 985 { 986 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 987 if (buffer==0) return 0; 988 try { 989 return &(buffer->getFloatRef(datarefID)); 990 } catch (...) { 991 Connection::get(*buffer).handleException(); 992 return 0; 993 } 994 } 995 996 //------------------------------------------------------------------------------ 997 998 extern "C" 999 int xplra_multi_set_double(int bufferID, size_t datarefID, double value) 1000 { 1001 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1002 if (buffer==0) return -1; 1003 try { 1004 buffer->setDouble(datarefID, value); 1005 return 0; 1006 } catch (...) { 1007 Connection::get(*buffer).handleException(); 1008 return -1; 1009 } 1010 } 1011 1012 /*----------------------------------------------------------------------------*/ 1013 1014 extern "C" 1015 int xplra_multi_get_double(double* dest, int bufferID, size_t datarefID) 1016 { 1017 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1018 if (buffer==0) return -1; 1019 try { 1020 *dest = buffer->getDouble(datarefID); 1021 return 0; 1022 } catch (...) { 1023 Connection::get(*buffer).handleException(); 1024 return -1; 1025 } 1026 } 1027 1028 /*----------------------------------------------------------------------------*/ 1029 1030 extern "C" 1031 const double* xplra_multi_get_double_const_ptr(int bufferID, size_t datarefID) 1032 { 1033 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1034 if (buffer==0) return 0; 1035 try { 1036 return &(buffer->getDoubleRef(datarefID)); 1037 } catch (...) { 1038 Connection::get(*buffer).handleException(); 1039 return 0; 1040 } 1041 } 1042 1043 /*----------------------------------------------------------------------------*/ 1044 1045 extern "C" 1046 double* xplra_multi_get_double_ptr(int bufferID, size_t datarefID) 1047 { 1048 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1049 if (buffer==0) return 0; 1050 try { 1051 return &(buffer->getDoubleRef(datarefID)); 1052 } catch (...) { 1053 Connection::get(*buffer).handleException(); 1054 return 0; 1055 } 1056 } 1057 1058 //------------------------------------------------------------------------------ 1059 1060 extern "C" 1061 ssize_t xplra_multi_set_float_array(int bufferID, size_t datarefID, 1062 const float* value, size_t length, 1063 size_t offset) 1064 { 1065 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1066 if (buffer==0) return -1; 1067 try { 1068 return buffer->setFloatArray(datarefID, value, length, offset); 1069 } catch (...) { 1070 Connection::get(*buffer).handleException(); 1071 return -1; 1072 } 1073 } 1074 1075 /*----------------------------------------------------------------------------*/ 1076 1077 extern "C" 1078 ssize_t xplra_multi_get_float_array(float* value, 1079 size_t length, size_t offset, 1080 int bufferID, size_t datarefID) 1081 { 1082 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1083 if (buffer==0) return -1; 1084 try { 1085 return buffer->getFloatArray(datarefID, value, length, offset); 1086 } catch (...) { 1087 Connection::get(*buffer).handleException(); 1088 return -1; 1089 } 1090 } 1091 1092 /*----------------------------------------------------------------------------*/ 1093 1094 extern "C" 1095 const float* xplra_multi_get_float_array_ptr(int bufferID, size_t datarefID, 1096 size_t offset) 1097 { 1098 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1099 if (buffer==0) return 0; 1100 try { 1101 return buffer->getFloatArray(datarefID, offset); 1102 } catch (...) { 1103 Connection::get(*buffer).handleException(); 1104 return 0; 1105 } 1106 } 1107 1108 //------------------------------------------------------------------------------ 1109 1110 extern "C" 1111 ssize_t xplra_multi_set_int_array(int bufferID, size_t datarefID, 1112 const int32_t* value, size_t length, 1113 size_t offset) 1114 { 1115 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1116 if (buffer==0) return -1; 1117 try { 1118 return buffer->setIntArray(datarefID, value, length, offset); 1119 } catch (...) { 1120 Connection::get(*buffer).handleException(); 1121 return -1; 1122 } 1123 } 1124 1125 /*----------------------------------------------------------------------------*/ 1126 1127 extern "C" 1128 ssize_t xplra_multi_get_int_array(int32_t* value, 1129 size_t length, size_t offset, 1130 int bufferID, size_t datarefID) 1131 { 1132 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1133 if (buffer==0) return -1; 1134 try { 1135 return buffer->getIntArray(datarefID, value, length, offset); 1136 } catch (...) { 1137 Connection::get(*buffer).handleException(); 1138 return -1; 1139 } 1140 } 1141 1142 /*----------------------------------------------------------------------------*/ 1143 1144 extern "C" 1145 const int32_t* xplra_multi_get_int_array_ptr(int bufferID, size_t datarefID, 1146 size_t offset) 1147 { 1148 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1149 if (buffer==0) return 0; 1150 try { 1151 return buffer->getIntArray(datarefID, offset); 1152 } catch (...) { 1153 Connection::get(*buffer).handleException(); 1154 return 0; 1155 } 1156 } 1157 1158 //------------------------------------------------------------------------------ 1159 1160 extern "C" 1161 ssize_t xplra_multi_set_byte_array(int bufferID, size_t datarefID, 1162 const void* value, size_t length, 1163 size_t offset) 1164 { 1165 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1166 if (buffer==0) return -1; 1167 try { 1168 return buffer->setByteArray(datarefID, 1169 reinterpret_cast<const uint8_t*>(value), 1170 length, offset); 1171 } catch (...) { 1172 Connection::get(*buffer).handleException(); 1173 return -1; 1174 } 1175 } 1176 1177 /*----------------------------------------------------------------------------*/ 1178 1179 extern "C" 1180 ssize_t xplra_multi_get_byte_array(void* value, 1181 size_t length, size_t offset, 1182 int bufferID, size_t datarefID) 1183 { 1184 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1185 if (buffer==0) return -1; 1186 try { 1187 return buffer->getByteArray(datarefID, 1188 reinterpret_cast<uint8_t*>(value), 1189 length, offset); 1190 } catch (...) { 1191 Connection::get(*buffer).handleException(); 1192 return -1; 1193 } 1194 } 1195 1196 /*----------------------------------------------------------------------------*/ 1197 1198 extern "C" 1199 const uint8_t* xplra_multi_get_byte_array_ptr(int bufferID, size_t datarefID, 1200 size_t offset) 1201 { 1202 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1203 if (buffer==0) return 0; 1204 try { 1205 return buffer->getByteArray(datarefID, offset); 1206 } catch (...) { 1207 Connection::get(*buffer).handleException(); 1208 return 0; 1209 } 1210 } 1211 1212 //------------------------------------------------------------------------------ 1213 1214 extern "C" ssize_t xplra_multi_set_string(int bufferID, size_t datarefID, 1215 const char* value, size_t offset) 1216 { 1217 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1218 if (buffer==0) return -1; 1219 try { 1220 return buffer->setString(datarefID, value, offset); 1221 } catch (...) { 1222 Connection::get(*buffer).handleException(); 1223 return -1; 1224 } 1225 } 1226 1227 /*----------------------------------------------------------------------------*/ 1228 1229 extern "C" 1230 const char* xplra_multi_get_string_ptr(int bufferID, size_t datarefID, 1231 size_t offset) 1232 { 1233 MultiBuffer* buffer = MultiBufferSlot::getValue(bufferID); 1234 if (buffer==0) return 0; 1235 try { 1236 return buffer->getStringPtr(datarefID, offset); 1237 } catch (...) { 1238 Connection::get(*buffer).handleException(); 1239 return 0; 1240 } 1241 } 1242 1243 //------------------------------------------------------------------------------ 1244 1245 extern "C" int xplra_multi_destroy_buffer(int connectionID, int bufferID) 756 1246 { 757 1247 Connection* connection = ConnectionSlot::getValue(connectionID); -
src/client/c/hu/varadiistvan/xplra/xplra.h
r28 r29 96 96 /*----------------------------------------------------------------------------*/ 97 97 98 #define INVALID_DATAREF_ID ((size_t)-1) 99 100 /*----------------------------------------------------------------------------*/ 101 98 102 /** 99 103 * Get the last error code with the subcode. … … 325 329 * @return the ID of the new getter, or -1 on error 326 330 */ 327 int xplra_ create_multi_getter(int connectionID);331 int xplra_multi_create_getter(int connectionID); 328 332 329 333 /*----------------------------------------------------------------------------*/ … … 334 338 * @return the ID of the new setter, or -1 on error 335 339 */ 336 int xplra_create_multi_setter(int connectionID); 340 int xplra_multi_create_setter(int connectionID); 341 342 /*----------------------------------------------------------------------------*/ 343 344 /** 345 * Add an integer dataref to a multi-dataref buffer. 346 * 347 * @return the ID of the dataref that can be used later. If the buffer 348 * ID is invalid, INVALID_DATAREF_ID is returned. 349 */ 350 size_t xplra_multi_add_int(int bufferID, const char* name); 351 352 /*----------------------------------------------------------------------------*/ 353 354 /** 355 * Add a float dataref to a multi-dataref buffer. 356 * 357 * @return the ID of the dataref that can be used later. If the buffer 358 * ID is invalid, INVALID_DATAREF_ID is returned. 359 */ 360 size_t xplra_multi_add_float(int bufferID, const char* name); 361 362 /*----------------------------------------------------------------------------*/ 363 364 /** 365 * Add a double dataref to a multi-dataref buffer. 366 * 367 * @return the ID of the dataref that can be used later. If the buffer 368 * ID is invalid, INVALID_DATAREF_ID is returned. 369 */ 370 size_t xplra_multi_add_double(int bufferID, const char* name); 371 372 /*----------------------------------------------------------------------------*/ 373 374 /** 375 * Add a float array dataref to a multi-dataref buffer. 376 * 377 * @return the ID of the dataref that can be used later. If the buffer 378 * ID is invalid, INVALID_DATAREF_ID is returned. 379 */ 380 size_t xplra_multi_add_float_array(int bufferID, const char* name, 381 size_t length, size_t offset); 382 383 /*----------------------------------------------------------------------------*/ 384 385 /** 386 * Add an integer array dataref to a multi-dataref buffer. 387 * 388 * @return the ID of the dataref that can be used later. If the buffer 389 * ID is invalid, INVALID_DATAREF_ID is returned. 390 */ 391 size_t xplra_multi_add_int_array(int bufferID, const char* name, 392 size_t length, size_t offset); 393 394 /*----------------------------------------------------------------------------*/ 395 396 /** 397 * Add a byte array dataref to a multi-dataref buffer. 398 * 399 * @return the ID of the dataref that can be used later. If the buffer 400 * ID is invalid, INVALID_DATAREF_ID is returned. 401 */ 402 size_t xplra_multi_add_byte_array(int bufferID, const char* name, 403 size_t length, size_t offset); 404 405 /*----------------------------------------------------------------------------*/ 406 407 /** 408 * Finalize the given buffer, if not finalized yet. 409 * 410 * @return -1 on error (if the buffer ID is invalid), 0 if there is no 411 * data in the buffer, 1 if there is data in it. 412 */ 413 int xplra_multi_finalize(int bufferID); 414 415 /*----------------------------------------------------------------------------*/ 416 417 /** 418 * Register the buffer with the given ID in X-Plane. If needed, it 419 * will be finalized too. 420 * 421 * @return 0 on success, -1 on error 422 */ 423 int xplra_multi_register(int bufferID); 424 425 /*----------------------------------------------------------------------------*/ 426 427 /** 428 * Unregister the buffer with the given ID from X-Plane. If needed, it 429 * will be finalized too. 430 * 431 * @return 0 on success, -1 on error 432 */ 433 int xplra_multi_unregister(int bufferID); 434 435 /*----------------------------------------------------------------------------*/ 436 437 /** 438 * Execute the buffer with the given ID. If the buffer is not 439 * finalized, it will be finalized. If it is not finalized, but 440 * registered, the registration will be cleared, and it will be 441 * re-registered after finalizing. 442 * 443 * @return 0 on success, -1 on error 444 */ 445 int xplra_multi_execute(int bufferID); 446 447 /*----------------------------------------------------------------------------*/ 448 449 /** 450 * Set the value of an integer dataref with the given ID. 451 * 452 * @return 0 on success, -1 on error. 453 */ 454 int xplra_multi_set_int(int bufferID, size_t datarefID, int value); 455 456 /*----------------------------------------------------------------------------*/ 457 458 /** 459 * Get the value of an integer dataref with the given ID. 460 * 461 * @param dest pointer to the variable that will receive the value 462 * 463 * @return 0 on success, -1 on error. 464 */ 465 int xplra_multi_get_int(int* dest, int bufferID, size_t datarefID); 466 467 /*----------------------------------------------------------------------------*/ 468 469 /** 470 * Get a const pointer to the integer dataref with the given ID 471 * 472 * @return the pointer or success, 0 on error. 473 */ 474 const int32_t* xplra_multi_get_int_const_ptr(int bufferID, size_t datarefID); 475 476 /*----------------------------------------------------------------------------*/ 477 478 /** 479 * Get a pointer to the integer dataref with the given ID 480 * 481 * @return the pointer or success, 0 on error. 482 */ 483 int32_t* xplra_multi_get_int_ptr(int bufferID, size_t datarefID); 484 485 /*----------------------------------------------------------------------------*/ 486 487 /** 488 * Set the value of a float dataref with the given ID. 489 * 490 * @return 0 on success, -1 on error. 491 */ 492 int xplra_multi_set_float(int bufferID, size_t datarefID, float value); 493 494 /*----------------------------------------------------------------------------*/ 495 496 /** 497 * Get the value of a float dataref with the given ID. 498 * 499 * @param dest pointer to the variable that will receive the value 500 * 501 * @return 0 on success, -1 on error. 502 */ 503 int xplra_multi_get_float(float* dest, int bufferID, size_t datarefID); 504 505 /*----------------------------------------------------------------------------*/ 506 507 /** 508 * Get a const pointer to the float dataref with the given ID 509 * 510 * @return the pointer or success, 0 on error. 511 */ 512 const float* xplra_multi_get_float_const_ptr(int bufferID, size_t datarefID); 513 514 /*----------------------------------------------------------------------------*/ 515 516 /** 517 * Get a pointer to the float dataref with the given ID 518 * 519 * @return the pointer or success, 0 on error. 520 */ 521 float* xplra_multi_get_float_ptr(int bufferID, size_t datarefID); 522 523 /*----------------------------------------------------------------------------*/ 524 525 /** 526 * Set the value of a double dataref with the given ID. 527 * 528 * @return 0 on success, -1 on error. 529 */ 530 int xplra_multi_set_double(int bufferID, size_t datarefID, double value); 531 532 /*----------------------------------------------------------------------------*/ 533 534 /** 535 * Get the value of a double dataref with the given ID. 536 * 537 * @param dest pointer to the variable that will receive the value 538 * 539 * @return 0 on success, -1 on error. 540 */ 541 int xplra_multi_get_double(double* dest, int bufferID, size_t datarefID); 542 543 /*----------------------------------------------------------------------------*/ 544 545 /** 546 * Get a const pointer to the double dataref with the given ID 547 * 548 * @return the pointer or success, 0 on error. 549 */ 550 const double* xplra_multi_get_double_const_ptr(int bufferID, size_t datarefID); 551 552 /*----------------------------------------------------------------------------*/ 553 554 /** 555 * Get a pointer to the double dataref with the given ID 556 * 557 * @return the pointer or success, 0 on error. 558 */ 559 double* xplra_multi_get_double_ptr(int bufferID, size_t datarefID); 560 561 /*----------------------------------------------------------------------------*/ 562 563 /** 564 * Set the contents of the float array dataref with the given ID. 565 * 566 * @param length the amount of data. If 0, it is assumed to be the 567 * length of the data in the buffer minus the offset. 568 * @param offset the offset within the buffer to set the data from 569 * 570 * @return the number of data items set, or -1 on error. 571 */ 572 ssize_t xplra_multi_set_float_array(int bufferID, size_t datarefID, 573 const float* value, size_t length, 574 size_t offset); 575 576 /*----------------------------------------------------------------------------*/ 577 578 /** 579 * Get the contents of the float array with the given ID. 580 * 581 * @param length the amount of data. If 0, it is assumed to be the 582 * length of the data in the buffer minus the offset. 583 * @param offset the offset within the buffer to get the data from 584 * 585 * @return the number of data items retrieved, or -1 on error. 586 */ 587 ssize_t xplra_multi_get_float_array(float* value, 588 size_t length, size_t offset, 589 int bufferID, size_t datarefID); 590 591 /*----------------------------------------------------------------------------*/ 592 593 /** 594 * Get a pointer to the float array with the given ID. 595 * 596 * @param offset the offset within the buffer. 597 * 598 * @return the pointer on success, 0 on error. 599 */ 600 const float* xplra_multi_get_float_array_ptr(int bufferID, size_t datarefID, 601 size_t offset); 602 603 /*----------------------------------------------------------------------------*/ 604 605 /** 606 * Set the contents of the integer array dataref with the given ID. 607 * 608 * @param length the amount of data. If 0, it is assumed to be the 609 * length of the data in the buffer minus the offset. 610 * @param offset the offset within the buffer to set the data from 611 * 612 * @return the number of data items set, or -1 on error. 613 */ 614 ssize_t xplra_multi_set_int_array(int bufferID, size_t datarefID, 615 const int32_t* value, size_t length, 616 size_t offset); 617 618 /*----------------------------------------------------------------------------*/ 619 620 /** 621 * Get the contents of the integer array with the given ID. 622 * 623 * @param length the amount of data. If 0, it is assumed to be the 624 * length of the data in the buffer minus the offset. 625 * @param offset the offset within the buffer to get the data from 626 * 627 * @return the number of data items retrieved, or -1 on error. 628 */ 629 ssize_t xplra_multi_get_int_array(int32_t* value, 630 size_t length, size_t offset, 631 int bufferID, size_t datarefID); 632 633 /*----------------------------------------------------------------------------*/ 634 635 /** 636 * Get a pointer to the integer array with the given ID. 637 * 638 * @param offset the offset within the buffer. 639 * 640 * @return the pointer on success, 0 on error. 641 */ 642 const int32_t* xplra_multi_get_int_array_ptr(int bufferID, size_t datarefID, 643 size_t offset); 644 645 /*----------------------------------------------------------------------------*/ 646 647 /** 648 * Set the contents of the byte array dataref with the given ID. 649 * 650 * @param length the amount of data. If 0, it is assumed to be the 651 * length of the data in the buffer minus the offset. 652 * @param offset the offset within the buffer to set the data from 653 * 654 * @return the number of data items set, or -1 on error. 655 */ 656 ssize_t xplra_multi_set_byte_array(int bufferID, size_t datarefID, 657 const void* value, size_t length, 658 size_t offset); 659 660 /*----------------------------------------------------------------------------*/ 661 662 /** 663 * Get the contents of the byte array with the given ID. 664 * 665 * @param length the amount of data. If 0, it is assumed to be the 666 * length of the data in the buffer minus the offset. 667 * @param offset the offset within the buffer to get the data from 668 * 669 * @return the number of data items retrieved, or -1 on error. 670 */ 671 ssize_t xplra_multi_get_byte_array(void* value, 672 size_t length, size_t offset, 673 int bufferID, size_t datarefID); 674 675 /*----------------------------------------------------------------------------*/ 676 677 /** 678 * Get a pointer to the byte array with the given ID. 679 * 680 * @param offset the offset within the buffer. 681 * 682 * @return the pointer on success, 0 on error. 683 */ 684 const uint8_t* xplra_multi_get_byte_array_ptr(int bufferID, size_t datarefID, 685 size_t offset); 686 687 /*----------------------------------------------------------------------------*/ 688 689 /** 690 * Set the value of the byte array with the given ID from the given 691 * string. If the string is shorter than the array, the rest will be 692 * filled with 0s. 693 * 694 * @return the number of bytes set, or -1 on error 695 */ 696 ssize_t xplra_multi_set_string(int bufferID, size_t datarefID, 697 const char* value, size_t offset); 698 699 /*----------------------------------------------------------------------------*/ 700 701 /** 702 * Get a pointer as a string pointer to the byte array with the given 703 * ID. 704 * 705 * @return the pointer on success, 0 on error. 706 */ 707 const char* xplra_multi_get_string_ptr(int bufferID, size_t datarefID, 708 size_t offset); 337 709 338 710 /*----------------------------------------------------------------------------*/ … … 346 718 * @return 0 on success, -1 on error. 347 719 */ 348 int xplra_ destroy_multi_buffer(int connectionID, int bufferID);720 int xplra_multi_destroy_buffer(int connectionID, int bufferID); 349 721 350 722 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.