1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
inline void cpy(unsigned short &target, char *source) {memcpy((char *)(&target), source, 2);}
inline void cpy(unsigned long &target, char *source) {memcpy((char *)(&target), source, 4);}
inline void cpy(double &target, char *source) {memcpy((char *)(&target), source, 8);}
inline void cpy(float &target, char *source) {memcpy((char *)(&target), source, 4);}
#define FIELDS_CPY int i = 0;\
cpy(d.td.time1 , source+i); i += 8;\
cpy(d.td.time2 , source+i); i += 8;\
cpy(d.td.distance , source+i); i += 8;\
d.td.timeType = source[i]; i += 1;\
d.td.distType = source[i]; i += 1;\
cpy(d.lat , source+i); i += 8;\
cpy(d.lng , source+i); i += 8;\
cpy(d.alt , source+i); i += 8;\
cpy(d.velocity.North , source+i); i += 4;\
cpy(d.velocity.East , source+i); i += 4;\
cpy(d.velocity.Down , source+i); i += 4;\
cpy(d.vehicle.roll , source+i); i += 8;\
cpy(d.vehicle.pitch , source+i); i += 8;\
cpy(d.vehicle.yaw , source+i); i += 8;\
cpy(d.vehicle.WanderAngle , source+i); i += 8;\
cpy(d.vehicle.TrackAngle , source+i); i += 4;\
cpy(d.vehicle.Speed , source+i); i += 4;\
cpy(d.vehicle.angularRateAbout.Longitudinal , source+i); i += 4;\
cpy(d.vehicle.angularRateAbout.Transverse , source+i); i += 4;\
cpy(d.vehicle.angularRateAbout.Down , source+i); i += 4;\
cpy(d.vehicle.acceleration.Longitudinal , source+i); i += 4;\
cpy(d.vehicle.acceleration.Transverse , source+i); i += 4;\
cpy(d.vehicle.acceleration.Down , source+i); i += 4;\
d.AlignmentStatus = source[i];
void solution5(char *source, Data &d) {
FIELDS_CPY
}
void solution6(char *source, Data1 &d) {
FIELDS_CPY
}
| |