JX Application Framework
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
JStack< T, S > Class Template Reference

#include <JStack.h>

Inheritance diagram for JStack< T, S >:
[legend]

Public Member Functions

 JStack ()
 
 JStack (const JStack< T, S > &source)
 
 ~JStack () override
 
JStack< T, S > & operator= (const JStack< T, S > &source)
 
void Push (const T &newElement)
 
Pop ()
 
bool Pop (T *element)
 
Peek () const
 
bool Peek (T *element) const
 
Peek (const JIndex index) const
 
bool Peek (const JIndex index, T *element) const
 
void Clear ()
 
void Unwind (const JSize numToUnwind)
 
JListIterator< T > * NewIterator ()
 
JListIterator< T > * NewIterator () const
 
- Public Member Functions inherited from JContainer
 JContainer ()
 
 JContainer (const JContainer &source)
 
JContaineroperator= (const JContainer &source)
 
- Public Member Functions inherited from JCollection
 JCollection ()
 
 JCollection (const JCollection &source)
 
 ~JCollection () override
 
JCollectionoperator= (const JCollection &source)
 
JSize GetItemCount () const
 
bool IsEmpty () const
 
bool IndexValid (const JIndex index) const
 
JIndex GetIndexFromEnd (const JIndex index) const
 
JString ToString () const override
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Protected Member Functions

S * GetElements ()
 
- Protected Member Functions inherited from JContainer
void InstallCollection (JCollection *list)
 
const JCollectionGetList () const
 
void Receive (JBroadcaster *sender, const Message &message) override
 
- Protected Member Functions inherited from JCollection
void ItemAdded ()
 
void ItemRemoved ()
 
void SetItemCount (const JSize newItemCount)
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 
virtual void ReceiveGoingAway (JBroadcaster *sender)
 

Detailed Description

template<class T, class S>
class JStack< T, S >

Interface for JStack class

Constructor & Destructor Documentation

◆ JStack() [1/2]

template<class T , class S >
JStack< T, S >::JStack ( )
                        The Stack Class

This class manages a stack. The first template argument must be a derived class of JList. The second template argument is the data type of the stack.

Refer to JArray.tmpl for warning associated with using JArray's.

◆ JStack() [2/2]

template<class T , class S >
JStack< T, S >::JStack ( const JStack< T, S > &  source)

◆ ~JStack()

template<class T , class S >
JStack< T, S >::~JStack ( )
override

Member Function Documentation

◆ Clear()

template<class T , class S >
void JStack< T, S >::Clear ( )

Remove all the elements from the stack.

◆ GetElements()

template<class T , class S >
S * JStack< T, S >::GetElements ( )
protected

◆ NewIterator() [1/2]

template<class T , class S >
JListIterator< T > * JStack< T, S >::NewIterator ( )

This provides an iterator for looking at all the elements in the Stack. The caller must jdelete the iterator.

Because of the order in which the elements are stored, use Prev() instead of Next().

◆ NewIterator() [2/2]

template<class T , class S >
JListIterator< T > * JStack< T, S >::NewIterator ( ) const

◆ operator=()

template<class T , class S >
JStack< T, S > & JStack< T, S >::operator= ( const JStack< T, S > &  source)

◆ Peek() [1/4]

template<class T , class S >
T JStack< T, S >::Peek ( ) const

Return the top element from the stack without removing it.

◆ Peek() [2/4]

template<class T , class S >
T JStack< T, S >::Peek ( const JIndex  index) const

Return the specified element from the stack without removing it. The top element is indexed 1.

◆ Peek() [3/4]

template<class T , class S >
bool JStack< T, S >::Peek ( const JIndex  index,
T *  element 
) const

◆ Peek() [4/4]

template<class T , class S >
bool JStack< T, S >::Peek ( T *  element) const

◆ Pop() [1/2]

template<class T , class S >
T JStack< T, S >::Pop ( )

Remove the top element from the stack and return it.

◆ Pop() [2/2]

template<class T , class S >
bool JStack< T, S >::Pop ( T *  element)

◆ Push()

template<class T , class S >
void JStack< T, S >::Push ( const T &  newElement)

Add a new element on top of the stack.

◆ Unwind()

template<class T , class S >
void JStack< T, S >::Unwind ( const JSize  numToUnwind)

Remove the first few elements from the top of the stack.


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