#include <ArClientHandlerConfig.h>
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). | |
ArConfig * | getConfig (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. | |
ArConfig * | getDefaultConfig () |
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. | |
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 |
ArClientBase * | myClient |
ArConfig | myConfig |
ArMutex | myDataMutex |
ArConfig * | myDefaultConfig |
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 |
std::string | myLogPrefix |
std::string | myRobotName |
std::list< ArFunctor1< const char * > * > | mySaveConfigFailedCBList |
std::list< ArFunctor * > | mySaveConfigSucceededCBList |
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.
Definition at line 48 of file ArClientHandlerConfig.h.
|
Constructor.
Definition at line 43 of file ArClientHandlerConfig.cpp. References client, myClient, myConfig, myHaveGottenConfig, myHaveGottenDefaults, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, myLogPrefix, myRobotName, and ArConfig::setConfigName(). |
|
Destructor.
Definition at line 74 of file ArClientHandlerConfig.cpp. |
|
Adds a gotConfig callback.
Definition at line 384 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, myGotConfigCBList, and ArMutex::unlock(). Referenced by main(). |
|
Adds a got config defaults callback.
Definition at line 449 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, myGotConfigDefaultsCBList, and ArMutex::unlock(). |
|
Adds a save config to server failed callback.
Definition at line 427 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, mySaveConfigFailedCBList, and ArMutex::unlock(). Referenced by main(). |
|
Adds a save config to server succeeded callback.
Definition at line 405 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, mySaveConfigSucceededCBList, and ArMutex::unlock(). Referenced by main(). |
|
Sees if we can request defaults (both types).
Definition at line 488 of file ArClientHandlerConfig.cpp. References ArClientBase::dataExists(), and myClient. Referenced by main(), requestConfigDefaults(), requestDefaultConfigFromServer(), and requestSectionDefaults(). |
|
Unthreadsafe way to get the config to play with (see long docs).
Definition at line 330 of file ArClientHandlerConfig.cpp. References myConfig. Referenced by gotConfig(). |
|
Threadsafe way to get the config to play with.
Definition at line 351 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myConfig, myDataMutex, and ArMutex::unlock(). |
|
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. Definition at line 342 of file ArClientHandlerConfig.cpp. References myDefaultConfig. Referenced by main(). |
|
Handles the packet from the getConfig.
Definition at line 126 of file ArClientHandlerConfig.cpp. References handleGetConfigData(). |
|
Handles the packet from the GetConfigBySections.
Definition at line 121 of file ArClientHandlerConfig.cpp. References handleGetConfigData(). |
|
Definition at line 131 of file ArClientHandlerConfig.cpp. References ArConfig::addParam(), ArClientArg::createArg(), ArConfigArg::getConfigPriority(), ArConfigArg::getDisplayHint(), IFDEBUG, ArMutex::lock(), ArConfig::log(), ArLog::log(), myCallbackMutex, myConfig, myDataMutex, myGotConfigCBList, myHaveGottenConfig, myLogPrefix, ArConfig::setSectionComment(), and ArMutex::unlock(). Referenced by handleGetConfig(), and handleGetConfigBySections(). |
|
Handles the return packet from getConfigDefaults.
Definition at line 594 of file ArClientHandlerConfig.cpp. References ArArgumentBuilder::add(), ArConfig::clearAllValueSet(), IFDEBUG, ArMutex::lock(), ArLog::log(), myConfig, myDataMutex, myDefaultConfig, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, myLogPrefix, myRobotName, ArConfig::parseArgument(), ArConfig::parseSection(), ArConfig::setConfigName(), ArArgumentBuilder::setExtraString(), and ArMutex::unlock(). |
|
Handles the packet from the GetConfigSectionFlags.
Definition at line 216 of file ArClientHandlerConfig.cpp. References ArConfig::addSectionFlags(), ArMutex::lock(), myConfig, myDataMutex, and ArMutex::unlock(). |
|
Handles the return packet from the setConfig (saveConfigToServer).
Definition at line 293 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, myLogPrefix, mySaveConfigFailedCBList, mySaveConfigSucceededCBList, and ArMutex::unlock(). |
|
Returns true if config gotten.
Definition at line 375 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myDataMutex, myHaveGottenConfig, and ArMutex::unlock(). |
|
Returns if we've gotten our requested defaults.
Definition at line 479 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myDataMutex, myHaveGottenDefaults, and ArMutex::unlock(). Referenced by main(). |
|
Returns if we've requested some defaults.
Definition at line 470 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myDataMutex, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, and ArMutex::unlock(). Referenced by requestConfigDefaults(), requestDefaultConfigFromServer(), and requestSectionDefaults(). |
|
Locks the config for if you're using the unthreadsafe getConfig.
Definition at line 360 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), and myDataMutex. |
|
Tells the server to reload the configuration.
Definition at line 321 of file ArClientHandlerConfig.cpp. References myClient, and ArClientBase::requestOnce(). |
|
Removes a gotConfig callback.
Definition at line 398 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myCallbackMutex, myGotConfigCBList, and ArMutex::unlock(). |
|
Removes a got config defaults callback.
Definition at line 463 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myCallbackMutex, myGotConfigDefaultsCBList, and ArMutex::unlock(). |
|
Removes a save config to server failed callback.
Definition at line 441 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myCallbackMutex, mySaveConfigFailedCBList, and ArMutex::unlock(). |
|
Removes a save config to server succeeded callback.
Definition at line 419 of file ArClientHandlerConfig.cpp. References ArMutex::lock(), myCallbackMutex, mySaveConfigSucceededCBList, and ArMutex::unlock(). |
|
Requests defaults for all sections from the server; modifies the config.
Definition at line 493 of file ArClientHandlerConfig.cpp. References canRequestDefaults(), haveRequestedDefaults(), ArMutex::lock(), ArLog::log(), myClient, myDataMutex, myHaveGottenDefaults, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, myLogPrefix, ArClientBase::requestOnce(), and ArMutex::unlock(). |
|
Requests the config from the server.
Definition at line 83 of file ArClientHandlerConfig.cpp. References ArClientBase::addHandler(), ArConfig::clearSections(), ArClientBase::dataExists(), ArMutex::lock(), myClient, myConfig, myDataMutex, myHandleGetConfigBySectionsCB, myHandleGetConfigCB, myHandleGetConfigDefaultsCB, myHandleGetConfigSectionFlagsCB, myHandleSetConfigCB, myHaveGottenConfig, ArClientBase::remHandler(), ArClientBase::requestOnce(), and ArMutex::unlock(). Referenced by main(). |
|
Definition at line 524 of file ArClientHandlerConfig.cpp. References canRequestDefaults(), haveRequestedDefaults(), ArMutex::lock(), ArLog::log(), myClient, myDataMutex, myHaveGottenDefaults, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, myLogPrefix, ArClientBase::requestOnce(), and ArMutex::unlock(). Referenced by main(). |
|
Requests defaults for one section from the server; modifies the config.
Definition at line 553 of file ArClientHandlerConfig.cpp. References canRequestDefaults(), ArConfig::findSection(), haveRequestedDefaults(), ArMutex::lock(), ArLog::log(), myClient, myConfig, myDataMutex, myHaveGottenDefaults, myHaveRequestedDefaultCopy, myHaveRequestedDefaults, myLogPrefix, ArClientBase::requestOnceWithString(), and ArMutex::unlock(). |
|
Sends the config back to the server.
Definition at line 241 of file ArClientHandlerConfig.cpp. References ArClientArg::argTextToBuf(), ArConfigArg::getName(), ArConfigSection::getName(), ArConfigSection::getParams(), ArClientArg::isSendableParamType(), ArMutex::lock(), ArLog::log(), myClient, myDataMutex, myLogPrefix, ArClientBase::requestOnce(), ArBasePacket::strToBuf(), and ArMutex::unlock(). |
|
Sends the config back to the server.
Definition at line 236 of file ArClientHandlerConfig.cpp. References myConfig. Referenced by gotConfig(). |
|
Try to lock for the config for if you're using the unthreadsafe getConfig.
Definition at line 365 of file ArClientHandlerConfig.cpp. References myDataMutex, and ArMutex::tryLock(). |
|
Unlocks the config for if you're using the unthreadsafe getConfig.
Definition at line 370 of file ArClientHandlerConfig.cpp. References myDataMutex, and ArMutex::unlock(). |
|
Definition at line 157 of file ArClientHandlerConfig.h. Referenced by addGotConfigCB(), addGotConfigDefaultsCB(), addSaveConfigFailedCB(), addSaveConfigSucceededCB(), handleGetConfigData(), handleSetConfig(), remGotConfigCB(), remGotConfigDefaultsCB(), remSaveConfigFailedCB(), and remSaveConfigSucceededCB(). |
|
Definition at line 153 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), canRequestDefaults(), reloadConfigOnServer(), requestConfigDefaults(), requestConfigFromServer(), requestDefaultConfigFromServer(), requestSectionDefaults(), and saveConfigToServer(). |
|
Definition at line 154 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), getConfig(), getConfigCopy(), handleGetConfigData(), handleGetConfigDefaults(), handleGetConfigSectionFlags(), requestConfigFromServer(), requestSectionDefaults(), and saveConfigToServer(). |
|
|
Definition at line 155 of file ArClientHandlerConfig.h. Referenced by getDefaultConfig(), and handleGetConfigDefaults(). |
|
Definition at line 149 of file ArClientHandlerConfig.h. Referenced by addGotConfigCB(), handleGetConfigData(), and remGotConfigCB(). |
|
Definition at line 152 of file ArClientHandlerConfig.h. Referenced by addGotConfigDefaultsCB(), and remGotConfigDefaultsCB(). |
|
Definition at line 163 of file ArClientHandlerConfig.h. Referenced by requestConfigFromServer(). |
|
Definition at line 164 of file ArClientHandlerConfig.h. Referenced by requestConfigFromServer(). |
|
Definition at line 167 of file ArClientHandlerConfig.h. Referenced by requestConfigFromServer(). |
|
Definition at line 171 of file ArClientHandlerConfig.h. Referenced by requestConfigFromServer(). |
|
Definition at line 169 of file ArClientHandlerConfig.h. |
|
Definition at line 165 of file ArClientHandlerConfig.h. Referenced by requestConfigFromServer(). |
|
Definition at line 158 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), handleGetConfigData(), haveGottenConfig(), and requestConfigFromServer(). |
|
Definition at line 160 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), haveGottenDefaults(), requestConfigDefaults(), requestDefaultConfigFromServer(), and requestSectionDefaults(). |
|
Definition at line 161 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), handleGetConfigDefaults(), haveRequestedDefaults(), requestConfigDefaults(), requestDefaultConfigFromServer(), and requestSectionDefaults(). |
|
Definition at line 159 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), handleGetConfigDefaults(), haveRequestedDefaults(), requestConfigDefaults(), requestDefaultConfigFromServer(), and requestSectionDefaults(). |
|
Definition at line 147 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), handleGetConfigData(), handleGetConfigDefaults(), handleSetConfig(), requestConfigDefaults(), requestDefaultConfigFromServer(), requestSectionDefaults(), and saveConfigToServer(). |
|
Definition at line 146 of file ArClientHandlerConfig.h. Referenced by ArClientHandlerConfig(), and handleGetConfigDefaults(). |
|
Definition at line 151 of file ArClientHandlerConfig.h. Referenced by addSaveConfigFailedCB(), handleSetConfig(), and remSaveConfigFailedCB(). |
|
Definition at line 150 of file ArClientHandlerConfig.h. Referenced by addSaveConfigSucceededCB(), handleSetConfig(), and remSaveConfigSucceededCB(). |