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

# Representations/Motion/JointDataSequence.cpp

Go to the documentation of this file.

    00001 /**
    00002 * @file JointDataSequence.cpp
    00003 *
    00004 * Implementation of class JointDataSequence
    00005 *
    00006 * @author Max Risler
    00007 */
    00008
    00009 #include "JointDataSequence.h"
    00010
    00011 JointDataSequence::JointDataSequence()
    00012 {
    00013   numOfEntries = 0;
    00014   loop = false;
    00015 }
    00016
    00017 JointDataSequence& JointDataSequence::operator=(const JointDataSequence& other)
    00018 {
    00019   numOfEntries = other.numOfEntries;
    00020   loop = other.loop;
    00021   for (int i = 0; i < numOfEntries; i++)
    00022   {
    00023     entry[i] = other.entry[i];
    00024     interpolate[i] = other.interpolate[i];
    00025     repeats[i] = other.repeats[i];
    00026   }
    00027   return *this;
    00028 }
    00029
    00030 void JointDataSequence::addEntry(const JointData& jointData, bool interp, int rep)
    00031 {
    00032   entry[numOfEntries] = jointData;
    00033   interpolate[numOfEntries] = interp;
    00034   repeats[numOfEntries] = rep;
    00035   numOfEntries++;
    00036 }
    00037
    00038 In& operator>>(In& stream,JointDataSequence& jointDataSequence)
    00039 {
    00040   int x;
    00041
    00042   stream >> jointDataSequence.numOfEntries;
    00043   stream >> x; jointDataSequence.loop = (x!=0);
    00044
    00045   for (int i=0;i<jointDataSequence.numOfEntries;i++)
    00046   {
    00047     stream >> jointDataSequence.entry[i];
    00048     stream >> jointDataSequence.repeats[i];
    00049     stream >> x; jointDataSequence.interpolate[i] = (x!=0);
    00050   }
    00051   return stream;
    00052 }
    00053
    00054 Out& operator<<(Out& stream, const JointDataSequence& jointDataSequence)
    00055 {
    00056   stream << jointDataSequence.numOfEntries;
    00057   stream << jointDataSequence.loop;
    00058
    00059   for (int i=0;i<jointDataSequence.numOfEntries;i++)
    00060   {
    00061     stream << jointDataSequence.entry[i];
    00062     stream << jointDataSequence.repeats[i];
    00063     stream << jointDataSequence.interpolate[i];
    00064   }
    00065   return stream;
    00066 }