Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

rmStatusArray.h

Go to the documentation of this file.
00001 #ifndef __rmStatusArray_h_
00002 #define __rmStatusArray_h_
00003 
00004 #include "rmBaseArray.h"
00005 
00019 template<class T>
00020 class rmStatusArray : public rmBaseArray<T>
00021 {
00022   public:
00023     rmStatusArray(){}
00024     virtual ~rmStatusArray(){}
00025 
00027     virtual int addDefaultElement(unsigned long aID);
00028 
00030     virtual int updateStatus(T & aElement);
00031 
00033     virtual int setStatus(T & aElement, unsigned long aID, long aStatus);
00034 };
00035 
00054 template<class T> int
00055 rmStatusArray<T>::addDefaultElement(unsigned long aID)
00056 {
00057   T element;
00058 
00059   memset(&element, 0, sizeof(T));
00060 
00061   element.status = NOTREADY;
00062 
00063   return addElement(element, aID);
00064 }
00065 
00083 template<class T> int
00084 rmStatusArray<T>::updateStatus(T & aElement)
00085 {
00086   if(elementIsReady(aElement)) {
00087     if(aElement.status != ACTIVE)
00088       aElement.status = NOTINSERVICE;
00089   }
00090   else
00091     aElement.status = NOTREADY;
00092 
00093   return RMCLIENT_SUCCESS;
00094 }
00095 
00114 template<class T> int
00115 rmStatusArray<T>::setStatus(T & aElement, unsigned long aID, long aStatus)
00116 {
00117   if(aStatus != ACTIVE && aStatus != NOTINSERVICE)
00118     return RMCLIENT_ERROR_NOSUCHVALUE;
00119 
00120   if(aElement.status == NOTREADY)
00121     return RMCLIENT_ERROR_STATE;
00122 
00123   aElement.status = aStatus;
00124   return RMCLIENT_SUCCESS;
00125 }
00126 
00127 
00128 
00129 
00130 #endif // __rmStatusArray_h_

Generated on Tue Sep 10 16:46:33 2002 for ResourceMonitorSNMPSubagent by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002