Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
ShCmdNode Class Reference

Shell command node class. More...

#include <dynashell.h>

Public Types

enum  NodeType {
  NodeTypeNull,
  NodeTypeCmd,
  NodeTypeMap
}
 Node type.
 

Public Member Functions

 ShCmdNode ()
 Default constructor.
 
 ShCmdNode (DynaShellCmd *pCmd)
 Shell command initialization constructor. More...
 
 ShCmdNode (ShCmdMap *pMap)
 Map of commands initialization constructor. More...
 
 ~ShCmdNode ()
 Default destructor.
 
ShCmdNodeoperator= (DynaShellCmd *rhs)
 Shell command assignment operator. More...
 
ShCmdNodeoperator= (ShCmdMap *rhs)
 Shell map assignment operator. More...
 
DynaShellCmdGetCmd ()
 Get command object. More...
 
ShCmdMapGetMap ()
 Get map object. More...
 
string GetMapBrief ()
 
void SetMapBrief (const string &strBrief)
 
bool IsNull ()
 Test if node type is null. More...
 
bool IsCmd ()
 Test if node type is shell command. More...
 
bool IsMap ()
 Test if node type is map of commands. More...
 

Protected Attributes

NodeType m_eType
 node type
 
union {
   DynaShellCmd *   m_pCmd
 pointer to allocated shell command
 
   ShCmdMap *   m_pMap
 pointer to allocated map of commands
 
m_obj
 node object
 
string m_strMapBrief
 map brief description
 

Detailed Description

Shell command node class.

Each node holds either a command or a map of commands.

Definition at line 119 of file dynashell.h.

Constructor & Destructor Documentation

ShCmdNode::ShCmdNode ( DynaShellCmd pCmd)
inline

Shell command initialization constructor.

Parameters
pCmdAllocated shell command.

Definition at line 141 of file dynashell.h.

142  {
143  m_obj.m_pCmd = pCmd;
144  m_eType = NodeTypeCmd;
145  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253
ShCmdNode::ShCmdNode ( ShCmdMap pMap)
inline

Map of commands initialization constructor.

Parameters
pMapAllocated map of commands.

Definition at line 152 of file dynashell.h.

153  {
154  m_obj.m_pMap = pMap;
155  m_eType = NodeTypeMap;
156  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253

Member Function Documentation

DynaShellCmd* ShCmdNode::GetCmd ( )
inline

Get command object.

Returns
Pointer to shell command.

Definition at line 196 of file dynashell.h.

Referenced by DynaShellCmdHelp::Exec().

197  {
198  return m_eType == NodeTypeCmd? m_obj.m_pCmd: NULL;
199  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253
ShCmdMap* ShCmdNode::GetMap ( )
inline

Get map object.

Returns
Pointer to map of commands.

Definition at line 206 of file dynashell.h.

Referenced by DynaShellCmdHelp::Exec().

207  {
208  return m_eType == NodeTypeMap? m_obj.m_pMap: NULL;
209  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253
bool ShCmdNode::IsCmd ( )
inline

Test if node type is shell command.

Returns
Returns true or false.

Definition at line 243 of file dynashell.h.

Referenced by DynaShellCmdHelp::Exec().

243 { return m_eType == NodeTypeCmd; }
NodeType m_eType
node type
Definition: dynashell.h:253
bool ShCmdNode::IsMap ( )
inline

Test if node type is map of commands.

Returns
Returns true or false.

Definition at line 250 of file dynashell.h.

Referenced by DynaShellCmdHelp::Exec().

250 { return m_eType == NodeTypeMap; }
NodeType m_eType
node type
Definition: dynashell.h:253
bool ShCmdNode::IsNull ( )
inline

Test if node type is null.

Returns
Returns true or false.

Definition at line 236 of file dynashell.h.

236 { return m_eType == NodeTypeNull; }
NodeType m_eType
node type
Definition: dynashell.h:253
ShCmdNode& ShCmdNode::operator= ( DynaShellCmd rhs)
inline

Shell command assignment operator.

Parameters
rhsPointer to allocated shell command right hand side.
Returns
Reference to this.

Definition at line 170 of file dynashell.h.

References m_pCmd.

171  {
172  m_obj.m_pCmd = rhs;
173  m_eType = NodeTypeCmd;
174  return *this;
175  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253
ShCmdNode& ShCmdNode::operator= ( ShCmdMap rhs)
inline

Shell map assignment operator.

Parameters
rhsPointer to allocated map of commands right hand side.
Returns
Reference to this.

Definition at line 184 of file dynashell.h.

References m_pMap.

185  {
186  m_obj.m_pMap = rhs;
187  m_eType = NodeTypeMap;
188  return *this;
189  }
union ShCmdNode::@5 m_obj
node object
NodeType m_eType
node type
Definition: dynashell.h:253

The documentation for this class was generated from the following file: