00001 /* 00002 MobileRobots Advanced Robotics Interface for Applications (ARIA) 00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC 00004 Copyright (C) 2006, 2007 MobileRobots Inc. 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 If you wish to redistribute ARIA under different terms, contact 00021 MobileRobots for information about a commercial version of ARIA at 00022 robots@mobilerobots.com or 00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481 00024 */ 00025 00026 #ifndef ARCLIENTDATA_H 00027 #define ARCLIENTDATA_H 00028 00029 #include "Aria.h" 00030 class ArNetPacket; 00031 00033 00049 class ArClientData 00050 { 00051 public: 00053 AREXPORT ArClientData(const char *name, const char *description, 00054 unsigned int command, 00055 ArFunctor1<ArNetPacket *> *functor); 00057 AREXPORT virtual ~ArClientData(); 00059 const char *getName(void) { return myName.c_str(); } 00061 const char *getDescription(void) { return myDescription.c_str(); } 00062 unsigned int getCommand(void) { return myCommand; } 00064 const char *getArgumentDescription(void) 00065 { return myArgumentDescription.c_str(); } 00067 const char *getReturnDescription(void) 00068 { return myReturnDescription.c_str(); } 00070 const char *getCommandGroup(void) { return myCommandGroup.c_str(); } 00071 AREXPORT bool hasDataFlag(const char *dataFlag); 00072 const char *getDataFlagsString(void) 00073 { return myDataFlagsBuilder.getFullString(); } 00075 const std::list<ArFunctor1<ArNetPacket *> *> *getFunctorList(void) const 00076 { return &myFunctorList; }; 00078 AREXPORT int lockFunctorList(void) { return myMutex.lock(); } 00080 AREXPORT int tryLockFunctorList(void) { return myMutex.tryLock(); } 00082 AREXPORT int unlockFunctorList(void) { return myMutex.unlock(); } 00083 00085 void addFunctor(ArFunctor1<ArNetPacket *> *functor) 00086 { myFunctorList.push_back(functor); } 00088 void remFunctor(ArFunctor1<ArNetPacket *> *functor) 00089 { myFunctorList.remove(functor); } 00091 void setArgRetDescs(const char *argDesc, const char *retDesc) 00092 { myArgumentDescription = argDesc; myReturnDescription = retDesc; } 00094 void setCommandGroup(const char *commandGroup) 00095 { myCommandGroup = commandGroup; } 00097 AREXPORT void addDataFlags(const char *dataFlags); 00098 protected: 00099 std::string myName; 00100 std::string myDescription; 00101 unsigned int myCommand; 00102 std::string myArgumentDescription; 00103 std::string myReturnDescription; 00104 std::string myCommandGroup; 00105 ArMutex myDataMutex; 00106 ArArgumentBuilder myDataFlagsBuilder; 00107 ArMutex myMutex; 00108 std::list<ArFunctor1<ArNetPacket *> *> myFunctorList; 00109 }; 00110 00111 #endif // ARCLIENTDATA_H