AREXPORT ArMode::~ArMode() { ArKeyHandler *keyHandler; if ((keyHandler = Aria::getKeyHandler()) != NULL) { if (myKey != '\0') keyHandler->remKeyHandler(myKey); if (myKey2 != '\0') keyHandler->remKeyHandler(myKey2); } if (myRobot != NULL) myRobot->remUserTask(&myUserTaskCB); }
AREXPORT void ArRatioInputKeydrive::giveUpKeys(void) { ArKeyHandler *keyHandler; myHaveKeys = false; if ((keyHandler = Aria::getKeyHandler()) == NULL) { ArLog::log(ArLog::Terse, "ArRatioInputKeydrive::giveUpKeys: There is no key handler, something is probably horribly wrong ."); } // now that we have one, add our keys as callbacks, print out big // warning messages if they fail if (!keyHandler->remKeyHandler(&myUpCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler already didn't have a key for up, something is wrong."); if (!keyHandler->remKeyHandler(&myDownCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler already didn't have a key for down, something is wrong."); if (!keyHandler->remKeyHandler(&myLeftCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler already didn't have a key for left, something is wrong."); if (!keyHandler->remKeyHandler(&myRightCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler already didn't have a key for right, something is wrong."); if (!keyHandler->remKeyHandler(&mySpaceCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler didn't have a key for space, something is wrong."); if (myRobot != NULL && myRobot->hasLatVel()) { if (!keyHandler->remKeyHandler(&myZCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler didn't have a key for z, something is wrong."); if (!keyHandler->remKeyHandler(&myXCB)) ArLog::log(ArLog::Terse, "ArRatioInputKeydrive: The key handler didn't have a key for x, something is wrong."); } }
void ArMode::remKeyHandler(ArFunctor *functor) { ArKeyHandler *keyHandler; std::string charStr; // see if there is already a keyhandler, if not something is wrong // (since constructor should make one if there isn't one yet if ((keyHandler = Aria::getKeyHandler()) == NULL) { ArLog::log(ArLog::Terse,"ArMode '%s'::keyHandler: There should already be a key handler, but there isn't... mode won't work right.", getName()); return; } if (!keyHandler->remKeyHandler(functor)) ArLog::log(ArLog::Terse, "ArMode '%s': The key handler already didn't have the given functor so the mode may not be working right.", getName()); }