smtk::service Class Reference

service pure virtual base class More...

Inheritance diagram for smtk::service:

Inheritance graph
[legend]
List of all members.

Public Member Functions

int get_file_descriptor (void)
 get file descriptor
virtual void interupt (void)
 unblock the wait() call
bool is_invalid (void) const
 see if the object is invalid
bool is_valid (void) const
 see if the object is valid
virtual int serve (void)=0
 give service
 service (void)
virtual int wait (void)
 wait for service
virtual ~service (void)

Protected Member Functions

template<class T>
invalidate (T t)
 invalidate the object
void invalidate (void)
 invalidate the object
template<class T>
validate (T t)
 validate the object
void validate (void)
 validate the object

Protected Attributes

int fd
 service file descriptor

Detailed Description

service pure virtual base class

This defines the server to service interface for SmTk service modules (plug-ins). The SmTk server (smtk_server) can load dynamic shared objects that contain the C++ smtk::service class objects. A class that inherits this class must call validate() in order to let the server know that this is a usable service, otherwise the service will be deleted by the server.


Constructor & Destructor Documentation

service::service ( void   ) 

This will not validate the object.

service::~service ( void   )  [virtual]

virtual destructor of this pure virtual class.


Member Function Documentation

int smtk::service::get_file_descriptor ( void   )  [inline]

get file descriptor

This is used by the SmTk server to get the file descriptor to do multiplexing with select(2). This is used by the SmTk server.

Returns:
the file descriptor that is associated with the service. If the file descriptor is -1 (not set) the SmTk server spawn a thread and call wait().

void service::interupt ( void   )  [virtual]

unblock the wait() call

This should interept a call to wait() and cause it to return.

template<class T>
T smtk::validation::invalidate ( t  )  [inline, protected, inherited]

invalidate the object

Make the object invalid.

Returns:
t the argument the user passed.

void smtk::validation::invalidate ( void   )  [inline, protected, inherited]

invalidate the object

Make the object invalid.

bool smtk::validation::is_invalid ( void   )  const [inline, inherited]

see if the object is invalid

Returns:
true if the object is invalid, and false if not.

bool smtk::validation::is_valid ( void   )  const [inline, inherited]

see if the object is valid

Returns:
true if the object is valid, and false if not.

virtual int smtk::service::serve ( void   )  [pure virtual]

give service

serve() is called by the server after a call to select(2), if there is a valid file descriptor, or after calling wait() when it returns 1.

Returns:
0 to instruct the server to continue serving this service, and 1 to instruct the server to delete this service.

template<class T>
T smtk::validation::validate ( t  )  [inline, protected, inherited]

validate the object

Make the object valid.

Returns:
t the argument the user passed.

void smtk::validation::validate ( void   )  [inline, protected, inherited]

validate the object

Make the object valid.

int service::wait ( void   )  [virtual]

wait for service

A blocking call that returns when a service event ready or the call was interepted.

Returns:
1 if a service event it ready, 0 if there is no service event ready and the call was interupted, and -1 on error. If the server calls wait and -1 is returned the service will be deleted.


Member Data Documentation

int smtk::service::fd [protected]

service file descriptor

Is not set (-1) by default. The implementer of the service can either set this to a valid file descriptor or over write the wait() method making it a blocking call that waits for a service event is ready to act on, as the implementer defines it.


The documentation for this class was generated from the following files:
Generated on Sat Aug 11 22:25:57 2007 for Simulation Toolkit (SmTk) by  doxygen 1.5.2