ArClientHandlerConfig Class Reference

#include <ArClientHandlerConfig.h>

List of all members.


Detailed Description

ArClientHandlerConfig processes the network packets that describe a robot's ArConfig.

It also provides a means to save the modified configuration data to the robot server. This class is designed to work in conjunction with the ArServerHandlerConfig. See the server handler documentation for a complete description of the networking interface.

This class should be thread safe, with the exception of unThreadSafeGetConfig. (If you want to use this method, surround it with calls to lock() and unlock().)

Note that you can't add callbacks or remove callbacks from within a callback function.


Public Member Functions

void addGotConfigCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a gotConfig callback.
void addGotConfigDefaultsCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a got config defaults callback.
void addSaveConfigFailedCB (ArFunctor1< const char * > *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a save config to server failed callback.
void addSaveConfigSucceededCB (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST)
 Adds a save config to server succeeded callback.
 ArClientHandlerConfig (ArClientBase *client, bool ignoreBounds=false, const char *robotName=NULL)
 Constructor.
bool canRequestDefaults (void)
 Sees if we can request defaults (both types).
ArConfiggetConfig (void)
 Unthreadsafe way to get the config to play with (see long docs).
ArConfig getConfigCopy (void)
 Threadsafe way to get the config to play with.
ArConfiggetDefaultConfig ()
 Returns a pointer to the robot server's default configuration, if canRequestDefaults() is true.
void handleGetConfig (ArNetPacket *packet)
 Handles the packet from the getConfig.
void handleGetConfigBySections (ArNetPacket *packet)
 Handles the packet from the GetConfigBySections.
void handleGetConfigDefaults (ArNetPacket *packet)
 Handles the return packet from getConfigDefaults.
void handleGetConfigSectionFlags (ArNetPacket *packet)
 Handles the packet from the GetConfigSectionFlags.
void handleSetConfig (ArNetPacket *packet)
 Handles the return packet from the setConfig (saveConfigToServer).
bool haveGottenConfig (void)
 Returns true if config gotten.
bool haveGottenDefaults (void)
 Returns if we've gotten our requested defaults.
bool haveRequestedDefaults (void)
 Returns if we've requested some defaults.
int lock (void)
 Locks the config for if you're using the unthreadsafe getConfig.
void reloadConfigOnServer (void)
 Tells the server to reload the configuration.
void remGotConfigCB (ArFunctor *functor)
 Removes a gotConfig callback.
void remGotConfigDefaultsCB (ArFunctor *functor)
 Removes a got config defaults callback.
void remSaveConfigFailedCB (ArFunctor1< const char * > *functor)
 Removes a save config to server failed callback.
void remSaveConfigSucceededCB (ArFunctor *functor)
 Removes a save config to server succeeded callback.
bool requestConfigDefaults (void)
 Requests defaults for all sections from the server; modifies the config.
void requestConfigFromServer (void)
 Requests the config from the server.
bool requestDefaultConfigFromServer (void)
bool requestSectionDefaults (const char *section)
 Requests defaults for one section from the server; modifies the config.
void saveConfigToServer (ArConfig *config, const std::set< std::string, ArStrCaseCmpOp > *ignoreTheseSections=NULL)
 Sends the config back to the server.
void saveConfigToServer (void)
 Sends the config back to the server.
void setQuiet (bool isQuiet)
 Turn on this flag to reduce the number of verbose log messages.
int tryLock (void)
 Try to lock for the config for if you're using the unthreadsafe getConfig.
int unlock (void)
 Unlocks the config for if you're using the unthreadsafe getConfig.
virtual ~ArClientHandlerConfig (void)
 Destructor.

Protected Member Functions

void handleGetConfigData (ArNetPacket *packet, bool isMultiplePackets)

Protected Attributes

ArMutex myCallbackMutex
ArClientBasemyClient
ArConfig myConfig
ArMutex myDataMutex
ArConfigmyDefaultConfig
std::list< ArFunctor * > myGotConfigCBList
std::list< ArFunctor * > myGotConfigDefaultsCBList
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleGetConfigBySectionsCB
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleGetConfigCB
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleGetConfigDefaultsCB
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleGetConfigSectionFlagsCB
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleGetDefaultConfigCB
ArFunctor1C< ArClientHandlerConfig,
ArNetPacket * > 
myHandleSetConfigCB
bool myHaveGottenConfig
bool myHaveGottenDefaults
bool myHaveRequestedDefaultCopy
bool myHaveRequestedDefaults
bool myIsQuiet
std::string myLogPrefix
std::string myRobotName
std::list< ArFunctor1< const
char * > * > 
mySaveConfigFailedCBList
std::list< ArFunctor * > mySaveConfigSucceededCBList


Constructor & Destructor Documentation

ArClientHandlerConfig::ArClientHandlerConfig ( ArClientBase client,
bool  ignoreBounds = false,
const char *  robotName = NULL 
)

Constructor.

Parameters:
client the client base to attach to
ignoreBounds whether the ArConfig we have should ignore bounds or not, this should only be used for debugging
robotName a name or identifier for the robot the server is controlling, used for logging etc.

ArClientHandlerConfig::~ArClientHandlerConfig ( void   )  [virtual]

Destructor.


Member Function Documentation

void ArClientHandlerConfig::addGotConfigCB ( ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST 
)

Adds a gotConfig callback.

void ArClientHandlerConfig::addGotConfigDefaultsCB ( ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST 
)

Adds a got config defaults callback.

void ArClientHandlerConfig::addSaveConfigFailedCB ( ArFunctor1< const char * > *  functor,
ArListPos::Pos  position = ArListPos::LAST 
)

Adds a save config to server failed callback.

void ArClientHandlerConfig::addSaveConfigSucceededCB ( ArFunctor functor,
ArListPos::Pos  position = ArListPos::LAST 
)

Adds a save config to server succeeded callback.

bool ArClientHandlerConfig::canRequestDefaults ( void   ) 

Sees if we can request defaults (both types).

ArConfig * ArClientHandlerConfig::getConfig ( void   ) 

Unthreadsafe way to get the config to play with (see long docs).

ArConfig ArClientHandlerConfig::getConfigCopy ( void   ) 

Threadsafe way to get the config to play with.

ArConfig * ArClientHandlerConfig::getDefaultConfig ( void   ) 

Returns a pointer to the robot server's default configuration, if canRequestDefaults() is true.

Note that both requestConfigFromServer() and then requestDefaultConfigFromServer() must be called before a valid default configuration is available on the client. If there is no default configuration, then NULL is returned.

void ArClientHandlerConfig::handleGetConfig ( ArNetPacket packet  ) 

Handles the packet from the getConfig.

void ArClientHandlerConfig::handleGetConfigBySections ( ArNetPacket packet  ) 

Handles the packet from the GetConfigBySections.

void ArClientHandlerConfig::handleGetConfigData ( ArNetPacket packet,
bool  isMultiplePackets 
) [protected]

void ArClientHandlerConfig::handleGetConfigDefaults ( ArNetPacket packet  ) 

Handles the return packet from getConfigDefaults.

void ArClientHandlerConfig::handleGetConfigSectionFlags ( ArNetPacket packet  ) 

Handles the packet from the GetConfigSectionFlags.

void ArClientHandlerConfig::handleSetConfig ( ArNetPacket packet  ) 

Handles the return packet from the setConfig (saveConfigToServer).

bool ArClientHandlerConfig::haveGottenConfig ( void   ) 

Returns true if config gotten.

bool ArClientHandlerConfig::haveGottenDefaults ( void   ) 

Returns if we've gotten our requested defaults.

bool ArClientHandlerConfig::haveRequestedDefaults ( void   ) 

Returns if we've requested some defaults.

int ArClientHandlerConfig::lock ( void   ) 

Locks the config for if you're using the unthreadsafe getConfig.

void ArClientHandlerConfig::reloadConfigOnServer ( void   ) 

Tells the server to reload the configuration.

void ArClientHandlerConfig::remGotConfigCB ( ArFunctor functor  ) 

Removes a gotConfig callback.

void ArClientHandlerConfig::remGotConfigDefaultsCB ( ArFunctor functor  ) 

Removes a got config defaults callback.

void ArClientHandlerConfig::remSaveConfigFailedCB ( ArFunctor1< const char * > *  functor  ) 

Removes a save config to server failed callback.

void ArClientHandlerConfig::remSaveConfigSucceededCB ( ArFunctor functor  ) 

Removes a save config to server succeeded callback.

bool ArClientHandlerConfig::requestConfigDefaults ( void   ) 

Requests defaults for all sections from the server; modifies the config.

void ArClientHandlerConfig::requestConfigFromServer ( void   ) 

Requests the config from the server.

bool ArClientHandlerConfig::requestDefaultConfigFromServer ( void   ) 

bool ArClientHandlerConfig::requestSectionDefaults ( const char *  section  ) 

Requests defaults for one section from the server; modifies the config.

void ArClientHandlerConfig::saveConfigToServer ( ArConfig config,
const std::set< std::string, ArStrCaseCmpOp > *  ignoreTheseSections = NULL 
)

Sends the config back to the server.

void ArClientHandlerConfig::saveConfigToServer ( void   ) 

Sends the config back to the server.

void ArClientHandlerConfig::setQuiet ( bool  isQuiet  ) 

Turn on this flag to reduce the number of verbose log messages.

int ArClientHandlerConfig::tryLock ( void   ) 

Try to lock for the config for if you're using the unthreadsafe getConfig.

int ArClientHandlerConfig::unlock ( void   ) 

Unlocks the config for if you're using the unthreadsafe getConfig.


Member Data Documentation

ArMutex ArClientHandlerConfig::myCallbackMutex [protected]

ArClientBase* ArClientHandlerConfig::myClient [protected]

ArConfig ArClientHandlerConfig::myConfig [protected]

ArMutex ArClientHandlerConfig::myDataMutex [protected]

ArConfig* ArClientHandlerConfig::myDefaultConfig [protected]

std::list<ArFunctor *> ArClientHandlerConfig::myGotConfigCBList [protected]

std::list<ArFunctor *> ArClientHandlerConfig::myGotConfigDefaultsCBList [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleGetConfigBySectionsCB [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleGetConfigCB [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleGetConfigDefaultsCB [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleGetConfigSectionFlagsCB [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleGetDefaultConfigCB [protected]

ArFunctor1C<ArClientHandlerConfig, ArNetPacket *> ArClientHandlerConfig::myHandleSetConfigCB [protected]

bool ArClientHandlerConfig::myHaveGottenConfig [protected]

bool ArClientHandlerConfig::myHaveGottenDefaults [protected]

bool ArClientHandlerConfig::myHaveRequestedDefaultCopy [protected]

bool ArClientHandlerConfig::myHaveRequestedDefaults [protected]

bool ArClientHandlerConfig::myIsQuiet [protected]

std::string ArClientHandlerConfig::myLogPrefix [protected]

std::string ArClientHandlerConfig::myRobotName [protected]

std::list<ArFunctor1<const char *> *> ArClientHandlerConfig::mySaveConfigFailedCBList [protected]

std::list<ArFunctor *> ArClientHandlerConfig::mySaveConfigSucceededCBList [protected]


The documentation for this class was generated from the following files:
Generated on Fri Jul 31 12:37:29 2009 for ArNetworking by  doxygen 1.4.7