📄 objects.cpp
字号:
/*! This method gets the battery of agent which comes whithin server messages to the agents. \return double Battery of agent himself*/double AgentObject::getBattery( ) const{ return m_Battery;}/*! This method sets the battery of agent which comes whithin server messages to the agents. \param value battery of agent himself \return bool Indicating wheather update was successfull*/bool AgentObject::setBattery(double value){ m_Battery = value; return true;}/*! This method gets the temp of agent which comes whithin server messages to the agents. \return double Temperature of agent himself*/double AgentObject::getTemprature( ) const{ return m_Temprature;}/*! This method sets the temp of agent which comes whithin server messages to the agents. \param value New temperature of agent himself \return bool Indicating wheather update was successfull*/bool AgentObject::setTemprature( double value ){ m_Temprature = value; return true;}/*! This method gets the mass of agent which comes whithin server messages to the agents. \return double Mass of agent himself*/double AgentObject::getMass( ) const{ return m_Mass;}/*! This method sets the mass of agent which comes whithin server messages to the agents. \param value Mass of agent himself \return bool Indicating wheather update was successfull*/bool AgentObject::setMass( double value ){ m_Mass = value; return true;}/*****************************************************************************//******************************* CLASS JOINT *********************************//*****************************************************************************/ /*! This is the constructor for the class Joint and initializes the variables with the joint. This the class that contains information about the joint itself. */Joint::Joint(){ m_Axis1 = m_Axis2 = m_Rate1 = m_Rate2 = 0; m_ID = JID_ILLEGAL;}/*! This is the constructor for the class Joint and initializes the variables with another instance . This the class that contains information about the joint itself. \param jnt Joint to copy data from*/Joint::Joint( const Joint & jnt ){ ( *this ) = jnt;}/*! This is the destructor of AgentObject. Currently does nothing.*/Joint::~Joint(){}/*! This is the overloaded operator for = , assigns another joints information to the current one. \param jnt Joint to copy data from */Joint& Joint::operator = ( const Joint & jnt ){ setID( jnt.getID() ); setAxis1( jnt.getAxis1() ); setAxis2( jnt.getAxis2() ); setRate1( jnt.getRate1() ); setRate2( jnt.getRate2() ); return (*this);}/*! This is the overloaded operator for << , sends the joints information to the specified output stream. \param os Output stream to write log info to \param j Joint to log information from */ostream& operator << ( ostream &os, Joint j ){ j.show( os ); return os;}/*! This is the overloaded operator for << , sends the joints information to the specified output logger. \param log Logger to write log info to \param j Joint to log information from */Logger& operator << ( Logger &log, Joint j ){ j.show( log ); return log;}/*! This method gets the axis of joint of agent which comes whithin server messages to the agents. \return double Axis value of the joint*/double Joint::getAxis( ) const{ return ( m_Axis1 );}/*! This method sets the Axis of joint of agent which comes whithin server messages to the agents. \param value Axis value of joint \return bool Indicating wheather update was successfull*/bool Joint::setAxis( double value ){ m_Axis1 = value; return (true);}/*! This method gets the axis of joint of agent which comes whithin server messages to the agents. \return double Axis value of the joint*/double Joint::getAxis1( ) const{ return ( m_Axis1 );}/*! This method sets the Axis of joint of agent which comes whithin server messages to the agents. \param value Axis value of joint \return bool Indicating wheather update was successfull*/bool Joint::setAxis1( double value ){ m_Axis1 = value; return (true);}/*! This method gets the axis of joint of agent which comes whithin server messages to the agents. \return double Axis value of the joint*/double Joint::getAxis2( ) const{ return ( m_Axis2 );}/*! This method sets the Axis of joint of agent which comes whithin server messages to the agents. \param value Axis value of joint \return bool Indicating wheather update was successfull*/bool Joint::setAxis2( double value ){ m_Axis2 = value; return (true);}/*! This method gets the rate of joint of agent which comes whithin server messages to the agents. \return double rate value of the joint*/double Joint::getRate( ) const{ return ( m_Rate1 );}/*! This method sets the Rate of joint of agent which comes whithin server messages to the agents. \param value Rate value of joint \return bool Indicating wheather update was successfull*/bool Joint::setRate( double value ){ m_Rate1 = value; return (true);}/*! This method gets the rate of joint of agent which comes whithin server messages to the agents. \return double rate value of the joint*/double Joint::getRate1( ) const{ return ( m_Rate1 );}/*! This method sets the Rate of joint of agent which comes whithin server messages to the agents. \param value Rate value of joint \return bool Indicating wheather update was successfull*/bool Joint::setRate1( double value ){ m_Rate1 = value; return (true);}/*! This method gets the rate of joint of agent which comes whithin server messages to the agents. \return double rate value of the joint*/double Joint::getRate2( ) const{ return ( m_Rate2 );}/*! This method sets the Rate of joint of agent which comes whithin server messages to the agents. \param value Rate value of joint \return bool Indicating wheather update was successfull*/bool Joint::setRate2( double value ){ m_Rate2 = value; return (true);}/*! This method gets the joint ID of agent which comes whithin server messages to the agents. \return JointT ID value of the joint*/JointT Joint::getID( ) const{ return m_ID;}/*! This method sets the Identifier of joint of agent which comes whithin server messages to the agents. \param value Joint name \return bool Indicating wheather update was successfull*/bool Joint::setID( JointT value ){ m_ID = value; return true;}/*! This method logs the current data residing in the joint to be logged. \param os output device to log info to*/void Joint::show( ostream & os ) const{ os << "(Joint (Name " << SoccerTypes::getJointStr( getID() ) << ") (axis1 " << getAxis1(); os << ") (rate1 " << getRate1() << ") (axis2 " << getAxis2() << ") (rate2 " << getRate2() << "))";}/*! This method logs the current data residing in the joint to be logged. \param os output device to log info to*/void Joint::show( Logger & os ) const{ os << "(Joint (Name " << SoccerTypes::getJointStr( getID() ) << ") (axis1 " << getAxis1(); os << ") (rate1 " << getRate1() << ") (axis2 " << getAxis2() << ") (rate2 " << getRate2() << "))";}/*****************************************************************************//****************************** CLASS TSensor ********************************//*****************************************************************************//*! This is the constructor of the Sensor. Initializes the sensor */TSensor::TSensor(){ m_Value = 0; m_Name = "";}/*! This is the destructor of the class */TSensor::~TSensor(){}/*! This method returns the value of the sensor \return double Sensor return value */double TSensor::getValue() const{ return m_Value;}/*! this method sets the value of the sensor \param val Value of the sensor \return bool Indicates update was successfull*/bool TSensor::setValue( const double & val ){ m_Value = val; return true;}/*! This method returns the name of the sensor \return string name of the sensor */string TSensor::getName() const{ return m_Name;}/*! This method sets the name of the sensor \param name Name of the sensor \return bool Name of the sensor */bool TSensor::setName( string name ){ m_Name = name; return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -