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

ArSyncTask.h

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 ARSYNCTASK_H
00027 #define ARSYNCTASK_H
00028 
00029 #include <string>
00030 #include <map>
00031 #include "ariaTypedefs.h"
00032 #include "ArFunctor.h"
00033 #include "ArTaskState.h"
00034 
00036 
00076 class ArSyncTask
00077 {
00078 public:
00080   AREXPORT ArSyncTask(const char *name, ArFunctor * functor = NULL, 
00081               ArTaskState::State *state = NULL,
00082               ArSyncTask * parent = NULL);
00084   AREXPORT virtual ~ArSyncTask();
00085 
00087   AREXPORT void run(void);
00089   AREXPORT void log(int depth = 0);
00090 
00092   AREXPORT ArTaskState::State getState(void);
00094   AREXPORT void setState(ArTaskState::State state);
00095     
00097   AREXPORT ArSyncTask *findNonRecursive(const char *name);
00099   AREXPORT ArSyncTask *findNonRecursive(ArFunctor *functor);
00100 
00102   AREXPORT ArSyncTask *find(const char *name); 
00104   AREXPORT ArSyncTask *find(ArFunctor *functor);
00105 
00107   AREXPORT void addNewBranch(const char *nameOfNew, int position, 
00108                  ArTaskState::State *state = NULL);
00110   AREXPORT void addNewLeaf(const char *nameOfNew, int position, 
00111                ArFunctor *functor, 
00112                ArTaskState::State *state = NULL);
00113 
00115   AREXPORT std::string getName(void);
00116 
00118   AREXPORT ArFunctor *getFunctor(void);
00119 
00121   AREXPORT void setWarningTimeCB(
00122       ArRetFunctor<unsigned int> *functor);
00124   AREXPORT ArRetFunctor<unsigned int> *getWarningTimeCB(void);
00125 
00127   AREXPORT void setNoTimeWarningCB(
00128       ArRetFunctor<bool> *functor);
00130   AREXPORT ArRetFunctor<bool> *getNoTimeWarningCB(void);
00131   
00132   // removes this task from the map
00133   AREXPORT void remove(ArSyncTask * proc);
00134 
00135   // returns whether this node is deleting or not
00136   AREXPORT bool isDeleting(void);
00137 protected:
00138   std::multimap<int, ArSyncTask *> myMultiMap;
00139   ArTaskState::State *myStatePointer;
00140   ArTaskState::State myState;
00141   ArFunctor *myFunctor;
00142   std::string myName;
00143   ArSyncTask *myParent;
00144   bool myIsDeleting;
00145   ArRetFunctor<unsigned int> *myWarningTimeCB;
00146   ArRetFunctor<bool> *myNoTimeWarningCB;
00147 };
00148 
00149 
00150 
00151 #endif
00152 
00153 
00154 
00155 

Generated on Tue Feb 20 10:51:41 2007 for Aria by  doxygen 1.4.0