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

# Representations/Cognition/PlayerPoseCollection.cpp

Go to the documentation of this file.

    00001 /**
    00002  * @file PlayerPoseCollection.cpp
    00003  *
    00004  * Implementation of class PlayerPoseCollection.
    00005  */
    00006
    00007 #include "PlayerPoseCollection.h"
    00008
    00009 void PlayerPose::operator = (const PlayerPose& other)
    00010 {
    00011   pose = other.pose;
    00012   speed = other.speed;
    00013   validity = other.validity;
    00014   playerNumber = other.playerNumber;
    00015   sigmaMin = other.sigmaMin;
    00016   sigmaMaj = other.sigmaMaj;
    00017   cosAngle = other.cosAngle;
    00018   sinAngle = other.sinAngle;
    00019   timeStamp = other.timeStamp;
    00020 }
    00021
    00022 PlayerPoseCollection::PlayerPoseCollection()
    00023 {
    00024   this->numberOfOpponentPlayers = 0;
    00025   this->numberOfOwnPlayers = 0;
    00026 }
    00027
    00028 PlayerPoseCollection::~PlayerPoseCollection()
    00029 {
    00030 }
    00031
    00032 PlayerPoseCollection::PlayerPoseCollection(PlayerPoseCollection& other)
    00033 {
    00034   *this = other;
    00035 }
    00036
    00037 void PlayerPoseCollection::operator = (const PlayerPoseCollection& other)
    00038 {
    00039   int i;
    00040   for (i=0; i<other.numberOfOwnPlayers;i++)
    00041   {
    00042     setOwnPlayerPose(i,other.getOwnPlayerPose(i));
    00043   }
    00044   for (i=0; i<other.numberOfOpponentPlayers;i++)
    00045   {
    00046     setOpponentPlayerPose(i,other.getOpponentPlayerPose(i));
    00047   }
    00048   numberOfOwnPlayers = other.numberOfOwnPlayers;
    00049   numberOfOpponentPlayers = other.numberOfOpponentPlayers;
    00050 }
    00051
    00052 In& operator>>(In& stream,PlayerPoseCollection& playerPoseCollection)
    00053 {
    00054   int sizeOfPlayerPose;
    00055   int i;
    00056   sizeOfPlayerPose = sizeof(PlayerPose);
    00057   stream >> playerPoseCollection.numberOfOpponentPlayers;
    00058   stream >> playerPoseCollection.numberOfOwnPlayers;
    00059   for(i=0; i < playerPoseCollection.numberOfOpponentPlayers; i++)
    00060   {
    00061     stream.read(&playerPoseCollection.opponentPlayerPoses[i], sizeOfPlayerPose);
    00062   }
    00063   for(i=0; i < playerPoseCollection.numberOfOwnPlayers; i++)
    00064   {
    00065     stream.read(&playerPoseCollection.ownPlayerPoses[i], sizeOfPlayerPose);
    00066   }
    00067   //  stream.read(&playerPoseCollection, sizeof(PlayerPoseCollection));
    00068   return stream;
    00069 }
    00070
    00071
    00072 Out& operator<<(Out& stream, const PlayerPoseCollection& playerPoseCollection)
    00073 {
    00074   int sizeOfPlayerPose;
    00075   int i;
    00076   sizeOfPlayerPose = sizeof(PlayerPose);
    00077   stream << playerPoseCollection.numberOfOpponentPlayers;
    00078   stream << playerPoseCollection.numberOfOwnPlayers;
    00079   for(i=0; i < playerPoseCollection.numberOfOpponentPlayers; i++)
    00080   {
    00081     stream.write(&playerPoseCollection.opponentPlayerPoses[i], sizeOfPlayerPose);
    00082   }
    00083   for(i=0; i < playerPoseCollection.numberOfOwnPlayers; i++)
    00084   {
    00085     stream.write(&playerPoseCollection.ownPlayerPoses[i], sizeOfPlayerPose);
    00086   }
    00087   //  stream.write(&playerPoseCollection, sizeof(PlayerPoseCollection));
    00088   return stream;
    00089 }
    00090
    00091
    00092 //Streamin operators for PlayerPose
    00093 In& operator>>(In& stream,PlayerPose& playerPose)
    00094 {
    00095   stream.read(&playerPose,sizeof(PlayerPose));
    00096   return stream;
    00097 }
    00098
    00099
    00100 Out& operator<<(Out& stream, const PlayerPose& playerPose)
    00101 {
    00102   stream.write(&playerPose,sizeof(PlayerPose));
    00103   return stream;
    00104 }