MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
List< T > Class Template Reference

#include <list.h>

Inheritance diagram for List< T >:
[legend]

Public Member Functions

 List (MLong maxSize)
 
 ~List ()
 
MInt size ()
 
MInt maxSize ()
 
void append ()
 
MLong memoryUseage ()
 
T * operator[] (const MInt index)
 
MInt setSize (MInt inputSize)
 
MInt resetSize (MInt inputSize)
 
char * getRawPointer ()
 

Public Attributes

T * a = nullptr
 
MLong m_rawMemoryCounter
 

Private Attributes

MLong m_maxSize
 
MInt m_size
 

Detailed Description

template<typename T>
class List< T >

Definition at line 16 of file list.h.

Constructor & Destructor Documentation

◆ List()

template<typename T >
List< T >::List ( MLong  maxSize)

Definition at line 57 of file list.h.

57 {
58 m_size = 0;
60 m_maxSize = inputMaxSize;
61
62 a = new T[(inputMaxSize + 1)];
63}
MLong m_maxSize
Definition: list.h:52
MLong m_rawMemoryCounter
Definition: list.h:29
MInt m_size
Definition: list.h:53
Definition: contexttypes.h:19

◆ ~List()

template<typename T >
List< T >::~List ( )
inline

Definition at line 19 of file list.h.

19{ delete[] a; };
T * a
Definition: list.h:28

Member Function Documentation

◆ append()

template<typename T >
void List< T >::append

Definition at line 66 of file list.h.

66 {
67 if(m_size < m_maxSize)
68 m_size++;
69 else {
70 std::stringstream errorMessage;
71 errorMessage << " Error in list, maxSize reached ( " << m_maxSize << " cells ).";
72 mTerm(1, AT_, errorMessage.str());
73 }
74}
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29

◆ getRawPointer()

template<typename T >
char * List< T >::getRawPointer ( )

◆ maxSize()

template<typename T >
MInt List< T >::maxSize ( )
inline

Definition at line 22 of file list.h.

22{ return (MInt)m_maxSize; };
int32_t MInt
Definition: maiatypes.h:62

◆ memoryUseage()

template<typename T >
MLong List< T >::memoryUseage ( )
inline

Definition at line 25 of file list.h.

25{ return (MLong)((m_maxSize + 1) * sizeof(T)); };
int64_t MLong
Definition: maiatypes.h:64

◆ operator[]()

template<typename T >
T * List< T >::operator[] ( const MInt  index)

Definition at line 78 of file list.h.

78 {
79 return &a[index];
80}
IdType index(const FloatType *const x, const IdType level)
Return Hilbert index for given location and level in 2D or 3D.
Definition: hilbert.h:165

◆ resetSize()

template<typename T >
MInt List< T >::resetSize ( MInt  inputSize)
inline

Definition at line 36 of file list.h.

36 {
37 if(inputSize < 0) {
38 mTerm(1, AT_, "Input size is < 0!");
39 }
40 if(inputSize > m_maxSize) {
41 std::stringstream errorMessage;
42 errorMessage << " Error in list, maxSize reached ( " << m_maxSize << " cells ).";
43 mTerm(1, AT_, errorMessage.str());
44 }
45 m_size = inputSize;
46 return (MInt)inputSize;
47 }

◆ setSize()

template<typename T >
MInt List< T >::setSize ( MInt  inputSize)
inline

Definition at line 31 of file list.h.

31 {
32 if(inputSize < m_size) m_size = inputSize;
33 return (MInt)inputSize;
34 }

◆ size()

template<typename T >
MInt List< T >::size ( )
inline

Definition at line 20 of file list.h.

20{ return (MInt)m_size; };

Member Data Documentation

◆ a

template<typename T >
T* List< T >::a = nullptr

Definition at line 28 of file list.h.

◆ m_maxSize

template<typename T >
MLong List< T >::m_maxSize
private

Definition at line 52 of file list.h.

◆ m_rawMemoryCounter

template<typename T >
MLong List< T >::m_rawMemoryCounter

Definition at line 29 of file list.h.

◆ m_size

template<typename T >
MInt List< T >::m_size
private

Definition at line 53 of file list.h.


The documentation for this class was generated from the following files: