Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. void* ExtractData() {
  2. if (this->Demensions == THREE_D) {
  3.  
  4. switch (this->datatype_in_use) {
  5. case LONG:
  6. long* arraytoreturn = new long[3];
  7. arraytoreturn[0] = *(long*)x_coord;
  8. arraytoreturn[1] = *(long*)y_coord;
  9. arraytoreturn[2] = *(long*)z_coord; //content at long pointer type inside _coord
  10. return arraytoreturn;
  11. break;
  12. case FLOAT:
  13. float* arraytoreturn = new float[3];
  14. arraytoreturn[0] = *(float*)x_coord;
  15. arraytoreturn[1] = *(float*)y_coord;
  16. arraytoreturn[2] = *(float*)z_coord; //content at long pointer type inside _coord
  17. return arraytoreturn;
  18. break;
  19. }
  20. return NULL;
  21. } else { //If not correct, MUST do this
  22.  
  23. switch (this->datatype_in_use) {
  24. case LONG:
  25. long* arraytoreturn = new long[2];
  26. arraytoreturn[0] = *(long*)x_coord;
  27. arraytoreturn[1] = *(long*)y_coord;
  28. return arraytoreturn;
  29. break;
  30. case FLOAT:
  31. float* arraytoreturn = new float[2];
  32. arraytoreturn[0] = *(float*)x_coord;
  33. arraytoreturn[1] = *(float*)y_coord;
  34. return arraytoreturn;
  35. break;
  36. } //If switch statement cases no match, get out of switch statement and return.
  37. return NULL;
  38. } //If somehow gets out of demension check, which it cant because it has to do else statement, return anyway NULL for error.
  39. return NULL; //Should not get here
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement