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

ArSyncTask.h

00001 /*
00002 ActivMedia Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics, LLC
00004 
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 ActivMedia Robotics for information about a commercial version of ARIA at 
00022 robots@activmedia.com or 
00023 ActivMedia Robotics, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 
00025 */
00026 
00027 #ifndef ARSYNCTASK_H
00028 #define ARSYNCTASK_H
00029 
00030 #include <string>
00031 #include <map>
00032 #include "ariaTypedefs.h"
00033 #include "ArFunctor.h"
00034 #include "ArTaskState.h"
00035 
00037 
00081 class ArSyncTask
00082 {
00083 public:
00085   ArSyncTask(const char *name, ArFunctor * functor = NULL, 
00086                       ArTaskState::State *state = NULL,
00087                       ArSyncTask * parent = NULL);
00089   virtual ~ArSyncTask();
00090 
00092   void run(void);
00094   void log(int depth = 0);
00095 
00097   ArTaskState::State getState(void);
00099   void setState(ArTaskState::State state);
00100     
00102   ArSyncTask *findNonRecursive(const char *name);
00104   ArSyncTask *findNonRecursive(ArFunctor *functor);
00105 
00107   ArSyncTask *find(const char *name); 
00109   ArSyncTask *find(ArFunctor *functor);
00110 
00112   void addNewBranch(const char *nameOfNew, int position, 
00113                              ArTaskState::State *state = NULL);
00115   void addNewLeaf(const char *nameOfNew, int position, 
00116                            ArFunctor *functor, 
00117                            ArTaskState::State *state = NULL);
00118 
00120   std::string getName(void);
00121 
00123   ArFunctor *getFunctor(void);
00124 
00126   void setWarningTimeCB(
00127           ArRetFunctor<unsigned int> *functor);
00129   ArRetFunctor<unsigned int> *getWarningTimeCB(void);
00130 
00132   void setNoTimeWarningCB(
00133           ArRetFunctor<bool> *functor);
00135   ArRetFunctor<bool> *getNoTimeWarningCB(void);
00136   
00137   // removes this task from the map
00138   void remove(ArSyncTask * proc);
00139 
00140   // returns whether this node is deleting or not
00141   bool isDeleting(void);
00142 protected:
00143   std::multimap<int, ArSyncTask *> myMultiMap;
00144   ArTaskState::State *myStatePointer;
00145   ArTaskState::State myState;
00146   ArFunctor *myFunctor;
00147   std::string myName;
00148   ArSyncTask *myParent;
00149   bool myIsDeleting;
00150   ArRetFunctor<unsigned int> *myWarningTimeCB;
00151   ArRetFunctor<bool> *myNoTimeWarningCB;
00152 };
00153 
00154 
00155 
00156 #endif
00157 
00158 
00159 
00160 

Generated on Wed Oct 19 12:56:37 2005 for Aria by  doxygen 1.4.0