/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */

#ifndef INCLUDED_WorldModelPacketDecoder_h
#define INCLUDED_WorldModelPacketDecoder_h

class Gaussian2;
class RobotDataPacket;

#include "PacketDecoder.h"

/*------------------------------------------------------------------
CLASS
  WorldModelPacketDecoder

DESCRIPTION
  Decodes world model data into the original data form.
------------------------------------------------------------------*/
class WorldModelPacketDecoder : public PacketDecoder {
public:
  // Do not change the order of these since the code assumes that each
  // teammate idx is in the following order: i, i+1, i+2
  // When adding new ones, just append to the end of the list
  static const int BallIdx                  = 0;
  static const int RedRobotObsIdx           = 1;
  static const int BlueRobotObsIdx          = 2;
  static const int Teammate0Idx             = 3;
  static const int Teammate1Idx             = 4;
  static const int Teammate2Idx             = 5;
  static const int Teammate0BallIdx         = 6;
  static const int Teammate1BallIdx         = 7;
  static const int Teammate2BallIdx         = 8;
  static const int Teammate0RedRobotObsIdx  = 9;
  static const int Teammate1RedRobotObsIdx  = 10;
  static const int Teammate2RedRobotObsIdx  = 11;
  static const int Teammate0BlueRobotObsIdx = 12;
  static const int Teammate1BlueRobotObsIdx = 13;
  static const int Teammate2BlueRobotObsIdx = 14;

#if 0
  // This is the old stuff
  static const int CyanGoalLeftIdx   = 1;
  static const int CyanGoalRightIdx  = 2;
  static const int YellowGoalLeftIdx = 3;
  static const int YellowGoalRightIdx= 4;
  static const int TeammateRobot0Idx      = 5;
  static const int TeammateRobot1Idx      = 6;
  static const int TeammateRobot2Idx      = 7;
  static const int OpponentRobot0Idx     = 8;
  static const int OpponentRobot1Idx     = 9;
  static const int OpponentRobot2Idx     =10;
  static const int OpponentRobot3Idx     =11;
#endif

  static const int NumGaussians=15;

  void decode(Gaussian2 *g,uchar **data);
  void decode(uchar *v,uchar **data);
  bool decode(Gaussian2 *objects,uchar *valid,RobotDataPacket *packet);
private:
};

#endif
