WPILib 2012
WPILibRoboticsLibraryforFRC
|
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 RESOURCE_H_ 00008 #define RESOURCE_H_ 00009 00010 #include "ErrorBase.h" 00011 #include <vxWorks.h> 00012 00026 class Resource : public ErrorBase 00027 { 00028 public: 00029 virtual ~Resource(); 00030 static void CreateResourceObject(Resource **r, UINT32 elements); 00031 UINT32 Allocate(const char *resourceDesc); 00032 UINT32 Allocate(UINT32 index, const char *resourceDesc); 00033 void Free(UINT32 index); 00034 00035 protected: 00036 explicit Resource(UINT32 size); 00037 00038 private: 00039 bool *m_isAllocated; 00040 UINT32 m_size; 00041 Resource *m_nextResource; 00042 00043 static Resource *m_resourceList; 00044 }; 00045 00046 #endif