Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WvCont Class Reference

#include <wvcont.h>

Collaboration diagram for WvCont:

[legend]
List of all members.

Public Types

typedef void * R
 These are hardcoded because I'm too lazy to templatize this.

typedef void * P1
typedef WvCallback< R, P1Callback

Public Member Functions

 WvCont (const Callback &cb, unsigned long stacksize=64 *1024)
 Construct a WvCont using an existing WvCallback.

 WvCont (const WvCont &cb)
 Copy constructor.

 ~WvCont ()
 Destructor.

R operator() (P1 p1=0)
 call the callback, making p1 the return value of yield() or the parameter to the function, and returning Ret, the argument of yield() or the return value of the function.


Static Public Member Functions

WvCont current ()
 Get a copy of the current WvCont.

P1 yield (R ret=0)
 "return" from the current callback, giving value 'ret' to the person who called us.

bool isok ()
 Tell us if the current context is "okay", that is, not trying to die.


Member Typedef Documentation

typedef WvCallback<R, P1> WvCont::Callback
 

Definition at line 33 of file wvcont.h.

Referenced by WvCont().

typedef void* WvCont::P1
 

Definition at line 31 of file wvcont.h.

typedef void* WvCont::R
 

These are hardcoded because I'm too lazy to templatize this.

Most people will ignore the return and parameter values anyhow.

Definition at line 30 of file wvcont.h.

Referenced by operator()().


Constructor & Destructor Documentation

WvCont::WvCont const Callback cb,
unsigned long  stacksize = 64 *1024
 

Construct a WvCont using an existing WvCallback.

The WvCont object can be used in place of that callback, and stored in a callback of the same data type.

Definition at line 54 of file wvcont.cc.

References Callback.

Referenced by current().

WvCont::WvCont const WvCont cb  ) 
 

Copy constructor.

Definition at line 47 of file wvcont.cc.

References data.

WvCont::~WvCont  ) 
 

Destructor.

Definition at line 60 of file wvcont.cc.


Member Function Documentation

WvCont WvCont::current  )  [static]
 

Get a copy of the current WvCont.

Definition at line 131 of file wvcont.cc.

References isok(), and WvCont().

bool WvCont::isok  )  [static]
 

Tell us if the current context is "okay", that is, not trying to die.

If !isok(), you shouldn't yield(), because the caller is just going to keep calling you until you die. Return as soon as you can.

Definition at line 151 of file wvcont.cc.

Referenced by current(), and yield().

WvCont::R WvCont::operator() P1  p1 = 0  ) 
 

call the callback, making p1 the return value of yield() or the parameter to the function, and returning Ret, the argument of yield() or the return value of the function.

Definition at line 115 of file wvcont.cc.

References R.

WvCont::P1 WvCont::yield R  ret = 0  )  [static]
 

"return" from the current callback, giving value 'ret' to the person who called us.

Next time this callback is called, it's as if yield() had returned, and the parameter to the callback is the value of yield().

Definition at line 140 of file wvcont.cc.

References isok().


The documentation for this class was generated from the following files:
Generated on Sat Mar 13 14:57:21 2004 for WvStreams by doxygen 1.3.6-20040222