Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages | Examples

ArServerHandlerCommands Class Reference

You can add commands with addCommand and addStringCommand, you can get the list of commands by requesting the data "listCommands" and "listStringCommands". More...

#include <ArServerHandlerCommands.h>

List of all members.

Public Member Functions

bool addCommand (const char *name, const char *description, ArFunctor *functor, const char *commandGroup=NULL)
 Adds a command with no arguments.
bool addStringCommand (const char *name, const char *description, ArFunctor1< ArArgumentBuilder * > *functor, const char *commandGroup=NULL)
 Adds a command that takes a string argument.
 ArServerHandlerCommands (ArServerBase *server)
 Constructor.
const char * getPrefix (void)
 Gets the prefix.
void netListCommands (ArServerClient *client, ArNetPacket *packet)
 The function that lists the commands.
void netListStringCommands (ArServerClient *client, ArNetPacket *packet)
 The function that lists the string commands.
void setPrefix (const char *prefix)
 Sets a prefix for commands.
virtual ~ArServerHandlerCommands ()
 Destructor.

Protected Member Functions

void netParseCommand (ArServerClient *client, ArNetPacket *packet, ArFunctor *functor)
void netParseStringCommand (ArServerClient *client, ArNetPacket *packet, ArFunctor1< ArArgumentBuilder * > *functor)

Protected Attributes

std::list< std::string > myCommandDescriptions
std::list< std::string > myCommands
ArFunctor2C< ArServerHandlerCommands,
ArServerClient *, ArNetPacket * > 
myNetListCommandsCB
ArFunctor2C< ArServerHandlerCommands,
ArServerClient *, ArNetPacket * > 
myNetListStringCommandsCB
std::string myPrefix
ArServerBasemyServer
std::list< std::string > myStringCommandDescriptions
std::list< std::string > myStringCommands


Detailed Description

You can add commands with addCommand and addStringCommand, you can get the list of commands by requesting the data "listCommands" and "listStringCommands".
Examples:

serverDemo.cpp, and simpleServerExample.cpp.

Definition at line 38 of file ArServerHandlerCommands.h.


Constructor & Destructor Documentation

ArServerHandlerCommands::ArServerHandlerCommands ArServerBase server  ) 
 

Constructor.

Definition at line 30 of file ArServerHandlerCommands.cpp.

References ArServerBase::addData(), myNetListCommandsCB, myNetListStringCommandsCB, and myServer.

ArServerHandlerCommands::~ArServerHandlerCommands  )  [virtual]
 

Destructor.

Definition at line 50 of file ArServerHandlerCommands.cpp.


Member Function Documentation

bool ArServerHandlerCommands::addCommand const char *  name,
const char *  description,
ArFunctor functor,
const char *  commandGroup = NULL
 

Adds a command with no arguments.

Parameters:
name the name of the command to add
description the description used for this command
functor the functor to call
commandGroup the command group this should be in, if NULL defaults to CustomCommands

Definition at line 62 of file ArServerHandlerCommands.cpp.

References ArServerBase::addData(), ArLog::log(), myCommandDescriptions, myCommands, myPrefix, myServer, and netParseCommand().

Referenced by ArServerModeRatioDrive::addControlCommands(), ArServerModeDrive::addControlCommands(), ArServerSimpleComGyro::ArServerSimpleComGyro(), and ArServerSimpleComMovementLogging::ArServerSimpleComMovementLogging().

bool ArServerHandlerCommands::addStringCommand const char *  name,
const char *  description,
ArFunctor1< ArArgumentBuilder * > *  functor,
const char *  commandGroup = NULL
 

Adds a command that takes a string argument.

Parameters:
name the name of the command to add
description the description used for this command
functor the functor to call (takes an argument builder)
commandGroup the command group this should be in, if NULL defaults to CustomCommands

Definition at line 113 of file ArServerHandlerCommands.cpp.

References ArServerBase::addData(), ArLog::log(), myPrefix, myServer, myStringCommandDescriptions, myStringCommands, and netParseStringCommand().

Referenced by ArServerHandlerMapping::addSimpleCommands(), ArServerSimpleComUC::ArServerSimpleComUC(), and ArServerSimplePopup::ArServerSimplePopup().

const char * ArServerHandlerCommands::getPrefix void   ) 
 

Gets the prefix.

Definition at line 237 of file ArServerHandlerCommands.cpp.

References myPrefix.

void ArServerHandlerCommands::netListCommands ArServerClient client,
ArNetPacket packet
 

The function that lists the commands.

Definition at line 196 of file ArServerHandlerCommands.cpp.

References ArBasePacket::byte2ToBuf(), client, myCommandDescriptions, myCommands, ArClientBase::sendPacketTcp(), and ArBasePacket::strToBuf().

void ArServerHandlerCommands::netListStringCommands ArServerClient client,
ArNetPacket packet
 

The function that lists the string commands.

Definition at line 213 of file ArServerHandlerCommands.cpp.

References ArBasePacket::byte2ToBuf(), client, myStringCommandDescriptions, myStringCommands, ArClientBase::sendPacketTcp(), and ArBasePacket::strToBuf().

void ArServerHandlerCommands::netParseCommand ArServerClient client,
ArNetPacket packet,
ArFunctor functor
[protected]
 

Definition at line 162 of file ArServerHandlerCommands.cpp.

References ArFunctor3< P1, P2, P3 >::invoke(), and ArLog::log().

Referenced by addCommand().

void ArServerHandlerCommands::netParseStringCommand ArServerClient client,
ArNetPacket packet,
ArFunctor1< ArArgumentBuilder * > *  functor
[protected]
 

Definition at line 174 of file ArServerHandlerCommands.cpp.

References ArArgumentBuilder::add(), ArLog::log(), and ArArgumentBuilder::setFullString().

Referenced by addStringCommand().

void ArServerHandlerCommands::setPrefix const char *  prefix  ) 
 

Sets a prefix for commands.

Definition at line 232 of file ArServerHandlerCommands.cpp.

References myPrefix.


Member Data Documentation

std::list<std::string> ArServerHandlerCommands::myCommandDescriptions [protected]
 

Definition at line 70 of file ArServerHandlerCommands.h.

Referenced by addCommand(), and netListCommands().

std::list<std::string> ArServerHandlerCommands::myCommands [protected]
 

Definition at line 69 of file ArServerHandlerCommands.h.

Referenced by addCommand(), and netListCommands().

ArFunctor2C<ArServerHandlerCommands, ArServerClient *, ArNetPacket *> ArServerHandlerCommands::myNetListCommandsCB [protected]
 

Definition at line 75 of file ArServerHandlerCommands.h.

Referenced by ArServerHandlerCommands().

ArFunctor2C<ArServerHandlerCommands, ArServerClient *, ArNetPacket *> ArServerHandlerCommands::myNetListStringCommandsCB [protected]
 

Definition at line 77 of file ArServerHandlerCommands.h.

Referenced by ArServerHandlerCommands().

std::string ArServerHandlerCommands::myPrefix [protected]
 

Definition at line 73 of file ArServerHandlerCommands.h.

Referenced by addCommand(), addStringCommand(), getPrefix(), and setPrefix().

ArServerBase* ArServerHandlerCommands::myServer [protected]
 

Definition at line 64 of file ArServerHandlerCommands.h.

Referenced by addCommand(), addStringCommand(), and ArServerHandlerCommands().

std::list<std::string> ArServerHandlerCommands::myStringCommandDescriptions [protected]
 

Definition at line 72 of file ArServerHandlerCommands.h.

Referenced by addStringCommand(), and netListStringCommands().

std::list<std::string> ArServerHandlerCommands::myStringCommands [protected]
 

Definition at line 71 of file ArServerHandlerCommands.h.

Referenced by addStringCommand(), and netListStringCommands().


The documentation for this class was generated from the following files:
Generated on Tue Feb 20 10:51:51 2007 for ArNetworking by  doxygen 1.4.0