You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.2 KiB
C++

//:Header:64, "llqueue_staticarray", 3b93fb4e
//
// File: llqueue_array.h
//
// G A M E.O.N.E - LOW LEVEL LIB V1.0
// Copyright (C) 2001 LEVEL ONE ENTERTAINMENT,
// Licensed under the terms of LGPL.
//:---------------------------------------------------------------------------
//:Description
//
// Template Array mit fixer Elementanzahl
// Wirft Exception wenn mit einem ungültigen Index zugegriffen wird.
//
//:-----------------------------------------------------------------------------
#if !defined(LLQUEUE_ARRAY_INCLUDED)
#define LLQUEUE_ARRAY_INCLUDED
//:Include
#include "lib_base.h"
//:> +---------------------------------------------+
//:>--------------| llqueue_staticarray Class Declaration |---------------
//:> +---------------------------------------------+
//:Class
template<
typename T,
int N >
class llqueue_staticarray
{
public:
//::3
// +--------------+
// | GetCount() |
// +--------------+
//:Description
//
// Liefert Array Grösse.
//
inline static int GetCount();
//::1
// +-----------------+
// | operator []() |
// +-----------------+
inline T & operator [](
int i);
//::2
// +-----------------+
// | operator []() |
// +-----------------+
inline const T & operator [](
int i) const;
private:
//:=5
// +----------+
// | m_Data |
// +----------+
T m_Data[N];
};
//:> +-----------------------------------+
//:>-------------------| Member Function Definitions |--------------------
//:> +-----------------------------------+
//::3
// +--------------+
// | GetCount() |
// +--------------+
template<
typename T,
int N >
inline int llqueue_staticarray<T, N>::GetCount()
{
return N;
}
//::1
// +-----------------+
// | operator []() |
// +-----------------+
template<
typename T,
int N >
inline T & llqueue_staticarray<T, N>::operator [](
int i)
{
SYS_ASSERT( i >= 0 && i < N );
return m_Data[i];
}
//::2
// +-----------------+
// | operator []() |
// +-----------------+
template<
typename T,
int N >
inline const T & llqueue_staticarray<T, N>::operator [](
int i) const
{
SYS_ASSERT( i >= 0 && i < N );
return m_Data[i];
}
#endif // LLQUEUE_ARRAY_INCLUDED