GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::G::Source Class Reference

A GSource C++ interface. More...

#include <gfc/glib/main.hh>

Inheritance diagram for GFC::G::Source:

GFC::Trackable GFC::G::ChildWatchSource GFC::G::IdleSource GFC::G::IOSource GFC::G::TimeoutSource List of all members.

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A GSource C++ interface.


Constructor & Destructor Documentation

GFC::G::Source::Source GSource *  source,
bool  owns_reference = true
 

Construct a source from an existing GSource.

Parameters:
source A pointer to a GSource.
owns_reference Set true if the initial reference count is owned by this object.

The Source object takes over the ownership of the GSource and unreferences it when the destructor is called.


Member Function Documentation

unsigned int GFC::G::Source::attach MainContext context = 0  ) 
 

Adds the source to context so that it will be executed within that context.

Parameters:
context A MainContext, or null to use the default context.
Returns:
The ID for the source within the MainContext.

void GFC::G::Source::destroy  ) 
 

Removes a source from its MainContext, if any, and marks it as destroyed.

After calling this method the source cannot be subsequently added to another context.

bool GFC::G::Source::get_can_recurse  )  const
 

Checks whether a source is allowed to be called recursively (see set_can_recurse()).

Returns:
Whether recursion is allowed.

Pointer<MainContext> GFC::G::Source::get_context  )  const
 

Gets the main context with which the source is associated.

Returns:
The associated MainContext, or null if a context has not yet been added to the source.

Calling this function on a destroyed source is an error.

void GFC::G::Source::get_current_time TimeVal timeval  ) 
 

Gets the "current time" to be used when checking this source.

Parameters:
timeval A TimeVal object in which to store the current time.

The advantage of calling this function over calling G::get_current_time() directly is that when checking multiple sources, GLib can cache a single value instead of having to repeatedly get the system time.

unsigned int GFC::G::Source::get_id  )  const
 

Gets the numeric ID for a particular source.

Returns:
The ID for the source.

int GFC::G::Source::get_priority  )  const
 

Gets the priority of the source.

Returns:
The priority of the source.

bool GFC::G::Source::is_attached G::MainContext context  )  const
 

Determines whether context is attached to this source.

Returns:
true if context is attached to this source.

void GFC::G::Source::set_can_recurse bool  can_recurse  ) 
 

Sets whether a source can be called recursively.

Parameters:
can_recurse Whether recursion is allowed for this source.

If can_recurse is true, while the source is being dispatched the source will be processed normally. Otherwise, all processing of the source is blocked until the dispatch function returns.

void GFC::G::Source::set_priority int  priority  ) 
 

Sets the priority of the source.

Parameters:
priority The new priority.

While the main loop is being run, the source will be dispatched if it is ready to be dispatched and no sources at a higher (numerically smaller) priority are ready to be dispatched.

virtual void GFC::G::Source::unref  )  [virtual]
 

Decrease the source reference count by one.

When the reference count becomes zero for a heap object delete is called. Remember, as with all GFC Objects you must call unref() on a dynamically allocated IOChannel, not delete. If you use a smart you don't need to call unref(), the smart pointer will do that for you. You don't need to call unref() on a source allocated on the stack unless you first called ref().

Reimplemented from GFC::Trackable.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:04:57 2004 for GFC-Core by doxygen 1.3.8