rusEFI
The most advanced open source ECU
Public Member Functions | Private Attributes
static_vector< T, TSlots > Struct Template Reference

#include <static_vector.h>

Collaboration diagram for static_vector< T, TSlots >:
Collaboration graph
[legend]

Public Member Functions

void clear ()
 
template<typename TSearch >
T * find (const TSearch &search) const
 
T * add (const T &value)
 
T & get (size_t i)
 
size_t getCount () const
 

Private Attributes

m_storage [TSlots]
 
size_t m_size = 0
 

Detailed Description

template<typename T, int TSlots>
struct static_vector< T, TSlots >

Definition at line 4 of file static_vector.h.

Member Function Documentation

◆ add()

template<typename T , int TSlots>
T* static_vector< T, TSlots >::add ( const T &  value)
inline

Definition at line 21 of file static_vector.h.

21  {
22  if (m_size >= TSlots) {
23  // vector full, discard
24  return nullptr;
25  }
26 
27  T& location = m_storage[m_size];
28 
29  location = value;
30  m_size++;
31 
32  return &location;
33  }
T m_storage[TSlots]
Definition: static_vector.h:44

Referenced by WarningCodeState::addWarningCode().

Here is the caller graph for this function:

◆ clear()

template<typename T , int TSlots>
void static_vector< T, TSlots >::clear ( void  )
inline

Definition at line 6 of file static_vector.h.

6  {
7  m_size = 0;
8  }

Referenced by WarningCodeState::clear().

Here is the caller graph for this function:

◆ find()

template<typename T , int TSlots>
template<typename TSearch >
T* static_vector< T, TSlots >::find ( const TSearch &  search) const
inline

Definition at line 11 of file static_vector.h.

11  {
12  for (size_t i = 0; i < m_size; i++) {
13  if (m_storage[i] == search) {
14  return const_cast<T*>(&m_storage[i]);
15  }
16  }
17 
18  return nullptr;
19  }

Referenced by WarningCodeState::addWarningCode(), and WarningCodeState::isWarningNow().

Here is the caller graph for this function:

◆ get()

template<typename T , int TSlots>
T& static_vector< T, TSlots >::get ( size_t  i)
inline

Definition at line 35 of file static_vector.h.

35  {
36  return m_storage[i];
37  }

Referenced by updateWarningCodes().

Here is the caller graph for this function:

◆ getCount()

template<typename T , int TSlots>
size_t static_vector< T, TSlots >::getCount ( ) const
inline

Definition at line 39 of file static_vector.h.

39  {
40  return m_size;
41  }

Referenced by updateWarningCodes().

Here is the caller graph for this function:

Field Documentation

◆ m_size

template<typename T , int TSlots>
size_t static_vector< T, TSlots >::m_size = 0
private

◆ m_storage

template<typename T , int TSlots>
T static_vector< T, TSlots >::m_storage[TSlots]
private

The documentation for this struct was generated from the following file: