diff options
Diffstat (limited to 'src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h')
-rw-r--r-- | src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h | 106 |
1 files changed, 48 insertions, 58 deletions
diff --git a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h index 39932fea1..79292fd78 100644 --- a/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h +++ b/src/systemc/ext/tlm_core/tlm_1/tlm_req_rsp/tlm_channels/tlm_fifo/tlm_fifo_resize.h @@ -17,77 +17,67 @@ *****************************************************************************/ -#ifndef __TLM_FIFO_RESIZE_H__ -#define __TLM_FIFO_RESIZE_H__ - -/****************************************************************** -// -// resize interface -// -******************************************************************/ - -namespace tlm { - -template < typename T> -inline -void -tlm_fifo<T>::nb_expand( unsigned int n ) { - - if( m_size >= 0 ) { - m_expand = true; - m_size += n; - request_update(); - } +#ifndef \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ +#define \ + __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ + +// Resize interface. +namespace tlm +{ + +template <typename T> +inline void +tlm_fifo<T>::nb_expand(unsigned int n) +{ + if (m_size >= 0) { + m_expand = true; + m_size += n; + request_update(); + } } -template < typename T> -inline -void -tlm_fifo<T>::nb_unbound( unsigned int n ) { - - m_expand = true; - m_size = -n; - - if( buffer.size() < static_cast<int>( n ) ) { - buffer.resize( n ); - } +template <typename T> +inline void +tlm_fifo<T>::nb_unbound(unsigned int n) +{ + m_expand = true; + m_size = -n; - request_update(); + if (buffer.size() < static_cast<int>(n)) { + buffer.resize(n); + } + request_update(); } -template < typename T> -inline -bool -tlm_fifo<T>::nb_reduce( unsigned int n ) { - - if( m_size < 0 ) { - return false; - } - - return nb_bound( size() - n ); +template <typename T> +inline bool +tlm_fifo<T>::nb_reduce(unsigned int n) +{ + if (m_size < 0) { + return false; + } + return nb_bound(size() - n); } -template < typename T> -inline -bool -tlm_fifo<T>::nb_bound( unsigned int new_size ) { - - bool ret = true; - - if( static_cast<int>( new_size ) < used() ) { - - new_size = used(); - ret = false; - - } +template <typename T> +inline bool +tlm_fifo<T>::nb_bound(unsigned int new_size) +{ + bool ret = true; - m_size = new_size; - return ret; + if (static_cast<int>(new_size) < used()) { + new_size = used(); + ret = false; + } + m_size = new_size; + return ret; } } // namespace tlm #endif +/* __TLM_CORE_TLM_1_TLM_REQ_RSP_TLM_CHANNELS_TLM_FIFO_TLM_FIFO_RESIZE_H__ */ |