00001 // gstack.cpp -- Version 0.1 00002 00003 #include "gstack.h" 00004 //////////////////////////////////////////////////////////// 00005 // Static members 00006 // --------------------------------------------------------- 00007 // void! 00008 00009 //////////////////////////////////////////////////////////// 00010 gStorage* gStack::GetCurrent () 00011 { 00012 gElem* myEndPtr = EndPtr(); 00013 if ( myEndPtr==nil ) return nil; 00014 gStorage* pObx = myEndPtr->me; 00015 if ( N()==0 ) return nil; 00016 // To be faster would be 'EndPtr()->me' 00017 ///return GetObjectPtr( n ); 00018 ASSERTION(pObx!=nil,"pObx!=nil"); 00019 return pObx; 00020 } 00021 bool gStack::Push (gStorage* newObj) 00022 { 00023 ASSERTION(newObj!=nil,"newObj!=nil"); 00024 return AppendObject( newObj ); 00025 } 00026 00027 bool gStack::Pop () 00028 { 00029 unsigned n = N(); 00030 if ( n==0 ) return false; 00031 Delete( n, n ); 00032 return true; 00033 } 00034 //////////////////////////////////////////////////////////// 00035