/***************************************************************
 * PrJointState.cpp
 *
 * This is an implementation of the robot joint state.
 *
 ****************************************************************/

/*
 * modification history
 *----------------------
 *
 * 11/02/97: K.C. Chang: created.
 */

#include "PrJointState.h"
#include <assert.h>

// constructor
// 3 = q,dq,ddq
PrJointState::PrJointState(int noj)
: nos_(3),noj_(noj)
{
    data_ = new Float[nos_*noj_];

    for(int i=0;i<nos_*noj_;i++)
      {
	  data_[i]=0.0;
      }
}

// copy constructor
PrJointState::PrJointState(const PrJointState &state)
: nos_(state.nos_),noj_(state.noj_)
{
    data_ = new Float[nos_*noj_];

    for(int i=0;i<nos_*noj_;i++)
      {
	  data_[i]=state.data_[i];
      }
}

// destructor
PrJointState::~PrJointState()
{
    delete[] data_;
}

// assignment operator overloading
PrJointState &PrJointState::operator=(const PrJointState &state)
{
    assert(noj_ == state.noj_ && nos_ == state.nos_);
    if (this != &state)
      {
	  if(noj_ == state.noj_ && nos_ == state.nos_);
	  {
	      for(int i=0;i<nos_*noj_;i++)
		{
		    data_[i]=state.data_[i];
		}
	  }
      }
    return (*this);
}
