Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void* ExtractData() {
- if (this->Demensions == THREE_D) {
- switch (this->datatype_in_use) {
- case LONG:
- long* arraytoreturn = new long[3];
- arraytoreturn[0] = *(long*)x_coord;
- arraytoreturn[1] = *(long*)y_coord;
- arraytoreturn[2] = *(long*)z_coord; //content at long pointer type inside _coord
- return arraytoreturn;
- break;
- case FLOAT:
- float* arraytoreturn = new float[3];
- arraytoreturn[0] = *(float*)x_coord;
- arraytoreturn[1] = *(float*)y_coord;
- arraytoreturn[2] = *(float*)z_coord; //content at long pointer type inside _coord
- return arraytoreturn;
- break;
- }
- return NULL;
- } else { //If not correct, MUST do this
- switch (this->datatype_in_use) {
- case LONG:
- long* arraytoreturn = new long[2];
- arraytoreturn[0] = *(long*)x_coord;
- arraytoreturn[1] = *(long*)y_coord;
- return arraytoreturn;
- break;
- case FLOAT:
- float* arraytoreturn = new float[2];
- arraytoreturn[0] = *(float*)x_coord;
- arraytoreturn[1] = *(float*)y_coord;
- return arraytoreturn;
- break;
- } //If switch statement cases no match, get out of switch statement and return.
- return NULL;
- } //If somehow gets out of demension check, which it cant because it has to do else statement, return anyway NULL for error.
- return NULL; //Should not get here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement