为参加日本的ET机器人比赛写的LEGO机器人控制程序
源代码在线查看: command.h
/******************************************************************************\
*
* File: Command.h
* Creation date: July 05, 2008 14:29
* Latest update: July 09, 2008 16:54
* Author: ClassBuilder
* XXXX
* Purpose: Declaration of class 'Command'
* CB version: ClassBuilder Version 2.9 (PR523)
*
* Modifications: @INSERT_MODIFICATIONS(* )
* July 09, 2008 15:46 Chijinliang
* Updated interface of method 'SetSteeringMode'
* Updated member 'm_steeringMode'
* July 09, 2008 12:13 Chijinliang
* Deleted member 'm_steeringSpeed'
* July 05, 2008 20:47 Chijinliang
* Added method 'SetSteeringSpeed'
* Added method 'SetSteeringMode'
* Added method 'SetSteeringAngle'
* Added method 'SetSpeed'
* Added method 'SetMinAngle'
* Added method 'SetMaxAngle'
* Added method 'SetFlag'
* Added method 'Command'
* Updated member 'm_maxAngle'
* Updated member 'm_minAngle'
* Updated member 'm_steeringAngle'
* Updated member 'm_steeringSpeed'
* Updated member 'm_steeringMode'
* Updated member 'm_speed'
* Updated member 'm_flag'
* July 05, 2008 14:29 Chijinliang
* Added method 'DestructorInclude'
* Added method 'ConstructorInclude'
* Added method 'GetSteeringSpeed'
* Added method 'GetSteeringMode'
* Added method 'GetSteeringAngle'
* Added method 'GetSpeed'
* Added method 'GetMinAngle'
* Added method 'GetMaxAngle'
* Added method 'GetFlag'
* Added method '~Command'
* Added method 'Command'
* Added member 'm_maxAngle'
* Added member 'm_minAngle'
* Added member 'm_steeringAngle'
* Added member 'm_steeringSpeed'
* Added member 'm_steeringMode'
* Added member 'm_speed'
* Added member 'm_flag'
*
* Copyright 2008, XXXXX
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
*
\******************************************************************************/
#ifndef _COMMAND_H
#define _COMMAND_H
class Command
{
private:
void ConstructorInclude();
void DestructorInclude();
private:
int m_flag;
int m_speed;
SteeringMode m_steeringMode;
int m_steeringAngle;
int m_minAngle;
int m_maxAngle;
public:
Command();
void Copy(const Command& rhs)
{
m_flag = rhs.m_flag;
m_speed = rhs.m_speed;
m_steeringMode = rhs.m_steeringMode;
m_steeringAngle = rhs.m_steeringAngle;
m_minAngle = rhs.m_minAngle;
m_maxAngle = rhs.m_maxAngle;
}
int GetFlag() const;
void SetFlag(int flag);
int GetMaxAngle() const;
void SetMaxAngle(int maxAngle);
int GetMinAngle() const;
void SetMinAngle(int minAngle);
int GetSpeed() const;
void SetSpeed(int speed);
int GetSteeringAngle() const;
void SetSteeringAngle(int steeringAngle);
SteeringMode GetSteeringMode() const;
void SetSteeringMode(SteeringMode steeringMode);
};
#endif // ndef _COMMAND_H
#ifdef CB_INLINES
#ifndef _COMMAND_H_INLINES
#define _COMMAND_H_INLINES
/*
Returns the value of member 'm_flag'.
*/
inline int Command::GetFlag() const
{
return m_flag;
}
/*
Set the value of member 'm_flag' to 'flag'.
*/
inline void Command::SetFlag(int flag)
{
m_flag = flag;
}
/*
Returns the value of member 'm_maxAngle'.
*/
inline int Command::GetMaxAngle() const
{
return m_maxAngle;
}
/*
Set the value of member 'm_maxAngle' to 'maxAngle'.
*/
inline void Command::SetMaxAngle(int maxAngle)
{
m_maxAngle = maxAngle;
}
/*
Returns the value of member 'm_minAngle'.
*/
inline int Command::GetMinAngle() const
{
return m_minAngle;
}
/*
Set the value of member 'm_minAngle' to 'minAngle'.
*/
inline void Command::SetMinAngle(int minAngle)
{
if (m_minAngle != minAngle)
{
m_minAngle = minAngle;
m_flag |= 0x01;
}
}
/*
Returns the value of member 'm_speed'.
*/
inline int Command::GetSpeed() const
{
return m_speed;
}
/*
Set the value of member 'm_speed' to 'speed'.
*/
inline void Command::SetSpeed(int speed)
{
if (m_speed != speed)
{
m_speed = speed;
m_flag |= 0x02;
}
}
/*
Returns the value of member 'm_steeringAngle'.
*/
inline int Command::GetSteeringAngle() const
{
return m_steeringAngle;
}
/*
Set the value of member 'm_steeringAngle' to 'steeringAngle'.
*/
inline void Command::SetSteeringAngle(int steeringAngle)
{
if (m_steeringAngle != steeringAngle)
{
m_steeringAngle = steeringAngle;
m_flag |= 0x01;
}
}
/*
Returns the value of member 'm_steeringMode'.
*/
inline SteeringMode Command::GetSteeringMode() const
{
return m_steeringMode;
}
/*
Set the value of member 'm_steeringMode' to 'steeringMode'.
*/
inline void Command::SetSteeringMode(SteeringMode steeringMode)
{
if (m_steeringMode != steeringMode)
{
m_steeringMode = steeringMode;
m_flag |= 0x01;
}
}
#endif // ndef _COMMAND_H_INLINES
#endif // def CB_INLINES