SeC class to assist with checking for events. More...
#include <Simulation/SimEventQueue.H>
Public Member Functions | |
SeC (const rutz::shared_ptr< T > event) throw () | |
SeC (const SeC< T > &other) throw () | |
virtual | ~SeC () |
Destructor. | |
T * | operator-> () const throw () |
Get the underlying event. | |
T & | operator* () const throw () |
Get the underlying event. | |
operator bool () const | |
Convert to bool by checking whether underlying event is valid. | |
bool | is_valid () const |
Check whether the pointee is non-null (there is an event). | |
rutz::shared_ptr< T > & | getPtr () |
Get the underlying shared_ptr. | |
const rutz::shared_ptr< T > & | getPtr () const |
Get the underlying shared_ptr, const version. |
SeC class to assist with checking for events.
This class is to allow for a simple syntax when checking for events:
assume a SimEventQueue q if (SeC<SimEventBreak> e = q.check<SimEventBreak>(this)) { a matching event was found and is in 'e' cerr<<"Break: "<<e->toString()<<endl; }
With this syntax, matching event 'e' will only live within the scope of the 'if' statement. Note that this is a somewhat weird syntax and other seemingly equivalent syntaxes do not work. There must be an assignment and a provision to convert to bool for this to work.
Definition at line 332 of file SimEventQueue.H.
Destructor.
Definition at line 595 of file SimEventQueue.H.
const rutz::shared_ptr< T > & SeC< T >::getPtr | ( | ) | const [inline] |
Get the underlying shared_ptr, const version.
Definition at line 619 of file SimEventQueue.H.
rutz::shared_ptr< T > & SeC< T >::getPtr | ( | ) | [inline] |
Get the underlying shared_ptr.
Definition at line 615 of file SimEventQueue.H.
bool SeC< T >::is_valid | ( | ) | const [inline] |
Check whether the pointee is non-null (there is an event).
Definition at line 611 of file SimEventQueue.H.
SeC< T >::operator bool | ( | ) | const [inline] |
Convert to bool by checking whether underlying event is valid.
This is the key to enabling declaration of a SeC variable inside an if(...) statement.
Definition at line 607 of file SimEventQueue.H.
T & SeC< T >::operator* | ( | ) | const throw () [inline] |
Get the underlying event.
Definition at line 603 of file SimEventQueue.H.
T * SeC< T >::operator-> | ( | ) | const throw () [inline] |
Get the underlying event.
Definition at line 599 of file SimEventQueue.H.