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

# Modules/SpecialActions/GT2003MotionNetSpecialActions/MotionNetData.cpp

Go to the documentation of this file.

    00001 /**
    00002 * @file GT2003MotionNetSpecialActions/MotionNetData.cpp
    00003 *
    00004 * Implementation of class MotionNetData
    00005 *
    00006 * @author Uwe Düffert, Martin Lötzsch, Max Risler
    00007 */
    00008
    00009 #include "MotionNetData.h"
    00010 #include "Platform/GTAssert.h"
    00011
    00012 MotionNetData::MotionNetData()
    00013 : nodeArray(0)
    00014 {
    00015 }
    00016
    00017 void MotionNetData::load(In& stream)
    00018 {
    00019   int i,j;
    00020
    00021   for (i=0;i<SpecialActionRequest::numOfSpecialAction;i++)
    00022   {
    00023     stream >> label_extern_start[i];
    00024   }
    00025
    00026   int numberOfNodes;
    00027
    00028
    00029   stream >> numberOfNodes;
    00030
    00031   if (nodeArray != 0) delete nodeArray;
    00032
    00033   nodeArray = new MotionNetNode[numberOfNodes];
    00034   short s;
    00035
    00036   for (i=0;i<numberOfNodes;i++)
    00037   {
    00038     stream >> s;
    00039
    00040     switch (s)
    00041     {
    00042     case 2:
    00043       nodeArray[i].d[0] = (short)MotionNetNode::typeTransition;
    00044       stream >> nodeArray[i].d[1] >> nodeArray[i].d[23];
    00045       break;
    00046     case 1:
    00047       nodeArray[i].d[0] = (short)MotionNetNode::typeConditionalTransition;
    00048       stream >> nodeArray[i].d[1] >> nodeArray[i].d[2] >> nodeArray[i].d[23];
    00049       break;
    00050     case 3:
    00051       nodeArray[i].d[0] = (short)MotionNetNode::typeData;
    00052       for (j=1;j<24;j++) stream >> nodeArray[i].d[j];
    00053       break;
    00054     case 4:
    00055       nodeArray[i].d[0] = (short)MotionNetNode::typePID;
    00056       for (j=1;j<5;j++) stream >> nodeArray[i].d[j];
    00057       stream >> nodeArray[i].d[23];
    00058       break;
    00059     }
    00060   }
    00061 }
    00062
    00063 MotionNetData::~MotionNetData()
    00064 {
    00065   if (nodeArray != 0) delete nodeArray;
    00066 }