Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Representations/Motion/MotionRequest.cpp

Go to the documentation of this file.

    00001 /**
    00002 * @file MotionRequest.cpp
    00003 *
    00004 * Implementation of class MotionRequest
    00005 *
    00006 * @author Martin Lötzsch
    00007 * @author Max Risler
    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   STREAM_REGISTER_BEGIN_EXT( motionRequest);
    00060   STREAM_EXT( stream, motionRequest.frameNumber);
    00061   STREAM_ENUM_EXT( stream, motionRequest.motionType, motionRequest.numOfMotion, MotionRequest::getMotionName);
    00062   STREAM_ENUM_EXT( stream, motionRequest.walkRequest.walkType, motionRequest.walkRequest.numOfWalkType, WalkRequest::getWalkTypeName);
    00063   STREAM_EXT( stream, motionRequest.walkRequest.walkParams);
    00064
    00065   STREAM_ENUM_EXT( stream, motionRequest.specialActionRequest.specialActionType, motionRequest.specialActionRequest.numOfSpecialAction, SpecialActionRequest::getSpecialActionIDName);
    00066   STREAM_ENUM_EXT( stream, motionRequest.tailRequest.tailRequestID, motionRequest.tailRequest.numOfTailRequests, TailRequest::getTailRequestIDName);
    00067   STREAM_EXT( stream, motionRequest.stabilize);
    00068   STREAM_EXT( stream, motionRequest.padding);
    00069   STREAM_REGISTER_FINISH();
    00070   return stream;
    00071 }
    00072
    00073 Out& operator<<(Out& stream, const MotionRequest& motionRequest)
    00074 {
    00075   // stream.write(&motionRequest,sizeof(MotionRequest));
    00076   STREAM_REGISTER_BEGIN_EXT( motionRequest);
    00077   STREAM_EXT( stream, motionRequest.frameNumber);
    00078   STREAM_ENUM_EXT( stream, motionRequest.motionType, motionRequest.numOfMotion, MotionRequest::getMotionName);
    00079   STREAM_ENUM_EXT( stream, motionRequest.walkRequest.walkType, motionRequest.walkRequest.numOfWalkType, WalkRequest::getWalkTypeName);
    00080   STREAM_EXT( stream, motionRequest.walkRequest.walkParams);
    00081
    00082   STREAM_ENUM_EXT( stream, motionRequest.specialActionRequest.specialActionType, motionRequest.specialActionRequest.numOfSpecialAction, SpecialActionRequest::getSpecialActionIDName);
    00083   STREAM_ENUM_EXT( stream, motionRequest.tailRequest.tailRequestID, motionRequest.tailRequest.numOfTailRequests, TailRequest::getTailRequestIDName);
    00084   STREAM_EXT( stream, motionRequest.stabilize);
    00085   STREAM_EXT( stream, motionRequest.padding);
    00086   STREAM_REGISTER_FINISH();
    00087   return stream;
    00088 }
    00089 */