gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits > Class Template Reference

Like a Queue but with a restricted interface and a setTail function which, when the queue is empty, just takes a reference to the pushed item as the single element. More...

#include <buffers.hh>

Inheritance diagram for Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >:
Minor::Reservable

Public Member Functions

 InputBuffer (const std::string &name, const std::string &data_name, unsigned int capacity_)
 
void setTail (ElemType &new_element)
 Set the tail of the queue, this is like push but needs to be followed by pushTail for the new tail to make its way into the queue proper. More...
 
bool empty () const
 No single element or queue entries. More...
 
const ElemType & front () const
 Return the element, or the front of the queue. More...
 
ElemType & front ()
 
void pop ()
 Pop either the head, or if none, the head of the queue. More...
 
void pushTail () const
 Push the single element (if any) into the queue proper. More...
 
void minorTrace () const
 Report elements. More...
 
bool canReserve () const
 Reservable interface, passed on to queue. More...
 
void reserve ()
 Reserve a slot in whatever structure this is attached to. More...
 
void freeReservation ()
 Free a reserved slot. More...
 
unsigned int unreservedRemainingSpace ()
 Like remainingSpace but does not count reserved spaces. More...
 

Protected Attributes

Queue< ElemType, ReportTraits,
BubbleTraits > 
queue
 Underlying queue. More...
 
ElemType * elementPtr
 Pointer to the single element (if not NULL) More...
 

Detailed Description

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
class Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >

Like a Queue but with a restricted interface and a setTail function which, when the queue is empty, just takes a reference to the pushed item as the single element.

Calling pushTail will push that element onto the queue.

The purpose of this class is to allow the faster operation of queues of items which usually don't get deeper than one item and for which the copy associated with a push is expensive enough to want to avoid

The intended use case is the input buffer for pipeline stages, hence the class name

Definition at line 563 of file buffers.hh.

Constructor & Destructor Documentation

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::InputBuffer ( const std::string &  name,
const std::string &  data_name,
unsigned int  capacity_ 
)
inline

Definition at line 573 of file buffers.hh.

Member Function Documentation

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
bool Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::canReserve ( ) const
inlinevirtual

Reservable interface, passed on to queue.

Implements Minor::Reservable.

Definition at line 639 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
bool Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::empty ( ) const
inline

No single element or queue entries.

Definition at line 596 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::freeReservation ( )
inlinevirtual

Free a reserved slot.

Implements Minor::Reservable.

Definition at line 641 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
const ElemType& Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::front ( ) const
inline

Return the element, or the front of the queue.

Definition at line 599 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
ElemType& Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::front ( )
inline

Definition at line 602 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::minorTrace ( ) const
inline

Report elements.

Definition at line 632 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::pop ( )
inline

Pop either the head, or if none, the head of the queue.

Definition at line 607 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::pushTail ( ) const
inline

Push the single element (if any) into the queue proper.

If the element's reference points to a transient object, remember to always do this before the end of that object's life

Definition at line 623 of file buffers.hh.

Referenced by Minor::InputBuffer< Minor::ForwardInstData >::minorTrace(), and Minor::InputBuffer< Minor::ForwardInstData >::unreservedRemainingSpace().

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::reserve ( )
inlinevirtual

Reserve a slot in whatever structure this is attached to.

Implements Minor::Reservable.

Definition at line 640 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
void Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::setTail ( ElemType &  new_element)
inline

Set the tail of the queue, this is like push but needs to be followed by pushTail for the new tail to make its way into the queue proper.

Definition at line 584 of file buffers.hh.

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
unsigned int Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::unreservedRemainingSpace ( )
inline

Like remainingSpace but does not count reserved spaces.

Definition at line 645 of file buffers.hh.

Member Data Documentation

template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
ElemType* Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::elementPtr
mutableprotected
template<typename ElemType, typename ReportTraits = ReportTraitsAdaptor<ElemType>, typename BubbleTraits = BubbleTraitsAdaptor<ElemType>>
Queue<ElemType, ReportTraits, BubbleTraits> Minor::InputBuffer< ElemType, ReportTraits, BubbleTraits >::queue
mutableprotected

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

Generated on Fri Jun 9 2017 13:04:33 for gem5 by doxygen 1.8.6