00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include "MotionRequest.h"
00011 #include <stdio.h>
00012 #include <string.h>
00013
00014 void MotionRequest::printOut(char* destination) const
00015 {
00016 sprintf(destination,"%s",getMotionName());
00017
00018 switch (motionType)
00019 {
00020 case walk:
00021 sprintf(destination,"%s : %s,%.1f %.1f %.1f",
00022 getMotionName(),
00023 getWalkTypeName(),
00024 walkRequest.walkParams.translation.x,walkRequest.walkParams.translation.y,walkRequest.walkParams.rotation);
00025 break;
00026 case specialAction:
00027 sprintf(destination,"%s : %s",
00028 getMotionName(),
00029 getSpecialActionName());
00030 break;
00031 default:
00032 sprintf(destination,"%s", getMotionName());
00033 break;
00034 }
00035 }
00036
00037 void MotionRequest::operator = (const MotionRequest& other)
00038 {
00039 memcpy(this,&other,sizeof(MotionRequest));
00040 }
00041
00042 SpecialActionRequest::SpecialActionID SpecialActionRequest::getSpecialActionIDFromName(const char* name)
00043 {
00044 for (int i=0;i<SpecialActionRequest::numOfSpecialAction;i++)
00045 {
00046 if (strcmp(name, (SpecialActionRequest::getSpecialActionIDName((SpecialActionRequest::SpecialActionID)i)))==0)
00047 {
00048 return (SpecialActionRequest::SpecialActionID)i;
00049 }
00050 }
00051
00052 return SpecialActionRequest::numOfSpecialAction;
00053 }
00054
00055
00056 In& operator>>(In& stream,MotionRequest& motionRequest)
00057 {
00058 stream.read(&motionRequest,sizeof(MotionRequest));
00059 return stream;
00060 }
00061
00062 Out& operator<<(Out& stream, const MotionRequest& motionRequest)
00063 {
00064 stream.write(&motionRequest,sizeof(MotionRequest));
00065 return stream;
00066 }
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136