diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /sp/src/public/arraystack.h | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'sp/src/public/arraystack.h')
| -rw-r--r-- | sp/src/public/arraystack.h | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/sp/src/public/arraystack.h b/sp/src/public/arraystack.h index 5f490e6d..907fb614 100644 --- a/sp/src/public/arraystack.h +++ b/sp/src/public/arraystack.h @@ -1,69 +1,69 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $Workfile: $
-// $Date: $
-//
-//-----------------------------------------------------------------------------
-// $Log: $
-//
-// $NoKeywords: $
-//=============================================================================//
-
-#ifndef ARRAYSTACK_H
-#define ARRAYSTACK_H
-#pragma once
-
-#include <assert.h>
-#include "List.h"
-
-template <class T> class ArrayStack
-{
-protected:
- T *data;
- int m_stackDepth;
- int m_maxNumElements;
-
-public:
- ArrayStack( int maxNumElements )
- {
- data = new T[maxNumElements];
- m_maxNumElements = maxNumElements;
- m_stackDepth = 0;
- assert( data );
- }
-
- void Push( T elem )
- {
- data[m_stackDepth++] = elem;
- if( m_stackDepth > m_maxNumElements )
- {
- printf( "ArrayStack overflow\n" );
- assert( 0 );
- }
- }
-
- T Pop( void )
- {
- if( m_stackDepth == 0 )
- {
- printf( "ArrayStack underflow\n" );
- assert( 0 );
- }
- return data[--m_stackDepth];
- }
-
- bool IsEmpty()
- {
- return ( m_stackDepth == 0 );
- }
-
- int GetDepth()
- {
- return m_stackDepth;
- }
-};
-
-
-#endif // ARRAYSTACK_H
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef ARRAYSTACK_H +#define ARRAYSTACK_H +#pragma once + +#include <assert.h> +#include "List.h" + +template <class T> class ArrayStack +{ +protected: + T *data; + int m_stackDepth; + int m_maxNumElements; + +public: + ArrayStack( int maxNumElements ) + { + data = new T[maxNumElements]; + m_maxNumElements = maxNumElements; + m_stackDepth = 0; + assert( data ); + } + + void Push( T elem ) + { + data[m_stackDepth++] = elem; + if( m_stackDepth > m_maxNumElements ) + { + printf( "ArrayStack overflow\n" ); + assert( 0 ); + } + } + + T Pop( void ) + { + if( m_stackDepth == 0 ) + { + printf( "ArrayStack underflow\n" ); + assert( 0 ); + } + return data[--m_stackDepth]; + } + + bool IsEmpty() + { + return ( m_stackDepth == 0 ); + } + + int GetDepth() + { + return m_stackDepth; + } +}; + + +#endif // ARRAYSTACK_H |