WPILib 2012
WPILibRoboticsLibraryforFRC
Task.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2008. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __TASK_H__
00008 #define __TASK_H__
00009 
00010 #include "ErrorBase.h"
00011 #include <vxWorks.h>
00012 
00017 class Task : public ErrorBase
00018 {
00019 public:
00020         static const UINT32 kDefaultPriority = 101;
00021         static const INT32 kInvalidTaskID = -1;
00022 
00023         Task(const char* name, FUNCPTR function, INT32 priority = kDefaultPriority, UINT32 stackSize = 20000);
00024         virtual ~Task();
00025 
00026         bool Start(UINT32 arg0 = 0, UINT32 arg1 = 0, UINT32 arg2 = 0, UINT32 arg3 = 0, UINT32 arg4 = 0, 
00027                         UINT32 arg5 = 0, UINT32 arg6 = 0, UINT32 arg7 = 0, UINT32 arg8 = 0, UINT32 arg9 = 0);
00028         bool Restart();
00029         bool Stop();
00030 
00031         bool IsReady();
00032         bool IsSuspended();
00033 
00034         bool Suspend();
00035         bool Resume();
00036 
00037         bool Verify();
00038 
00039         INT32 GetPriority();
00040         bool SetPriority(INT32 priority);
00041         const char* GetName();
00042         INT32 GetID();
00043 
00044 private:
00045         FUNCPTR m_function;
00046         char* m_taskName;
00047         INT32 m_taskID;
00048         UINT32 m_stackSize;
00049         INT32 m_priority;
00050         bool HandleError(STATUS results);
00051         DISALLOW_COPY_AND_ASSIGN(Task);
00052 };
00053 
00054 #endif // __TASK_H__
 All Classes Functions Variables