Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members

VIEW::Server Class Reference
[Client/Server request handling]

Server class. More...

#include <server.h>

Inheritance diagram for VIEW::Server:

VIEW::ModularWidget Embeddable VIEW::ConnectionObject List of all members.

Public Member Functions

Constructors
 Server (QWidget *parent=0, const char *name=0) throw ()
 Default Constructor.
 Server (const Server &server)
Destructors
virtual ~Server () throw ()
 Destructor.
virtual void clear () throw ()
 Explicit default initialization.
Accessors: inspectors and mutators
void activate () throw ()
 Activates the server.
void deactivate () throw ()
 Deactivates the server.
void setPort (const int port) throw ()
 Set the server port.
int getPort () const throw ()
 Return the server port.
void registerObjectCreator (const ObjectCreator &s) throw ()
 Register a ObjectCreator that is used for converting PersistentObject objects into Composite objects.
void unregisterObjectCreator () throw ()
 Reset the ObjectCreator.
virtual void initializeWidget (MainControl &main_control) throw ()
 Initialize the server widget.
virtual void finalizeWidget (MainControl &main_control) throw ()
 Remove the server widget.
virtual void initializePreferencesTab (Preferences &preferences) throw ()
 Initialize a preferences tab for the server.
virtual void finalizePreferencesTab (Preferences &preferences) throw ()
 Remove the preferences tab.
virtual void applyPreferences () throw ()
 Apply the preferences of the specific tab.
debuggers and diagnostics
virtual bool isValid () const throw ()
 Internal state and consistency self-validation.
virtual void dump (std::ostream &s=std::cout, Size depth=0) const throw ()
 Dump the current state of this server to the output ostream with a dumping depth.

Protected Member Functions

Timer method.
virtual void timer ()
 Timer method.

Detailed Description

Server class.

The class Server handles all incoming PersistentObject objects, converts them into Composite objects (if possible) and sents them through the ConnectionObject tree with the message NewCompositeMessage. Also it stores all received Composite objects and replaces them if the same Composite object is received again. If a Composite object is replaced the message RemovedCompositeMessage will be sent through the ConnectionObject tree and after that the the message NewCompositeMessage with the new received composite will be sent.


Constructor & Destructor Documentation

VIEW::Server::Server QWidget *  parent = 0,
const char *  name = 0
throw ()
 

Default Constructor.

The state of this server is:

  • no object creator registered
  • server listening on VIEW_DEFAULT_PORT if activated
    See also:
    QTTimer

    ModularWidget

virtual VIEW::Server::~Server  )  throw () [virtual]
 

Destructor.


Member Function Documentation

void VIEW::Server::activate  )  throw ()
 

Activates the server.

Creates a new socket stream with the given port and enables the timer that will check every second whether an object will be available at the stream. After this method the timer method will be called every second. Must be called before other methods! Calls QTTimer::startTimer

See also:
QTTimer::startTimer

timer

virtual void VIEW::Server::applyPreferences  )  throw () [virtual]
 

Apply the preferences of the specific tab.

This method applies the preferences of the own tab ServerPreferences to this server. This method is called automatically by the method applyPreferencesTab of the class MainControl. See ModularWidget for more information concerning preferences tabs.

Parameters:
preferences the Preferences dialog of the MainControl
See also:
applyPreferencesTab

ServerPreferences

Preferences

Reimplemented from VIEW::ModularWidget.

virtual void VIEW::Server::clear  )  throw () [virtual]
 

Explicit default initialization.

Calls QTTimer::clear. Calls ConnectionObject::clear.

See also:
QTTimer::clear

ConnectionObject::clear

Reimplemented from VIEW::ModularWidget.

void VIEW::Server::deactivate  )  throw ()
 

Deactivates the server.

If this server is already running this method stops the server and closes the socket stream. Calls QTTimer::stopTimer

See also:
QTTimer::stopTimer

virtual void VIEW::Server::dump std::ostream &  s = std::cout,
Size  depth = 0
const throw () [virtual]
 

Dump the current state of this server to the output ostream with a dumping depth.

Parameters:
s output stream where to output the state of this server
depth the dumping depth
See also:
ConnectionObject::dump

QTTimer::dump

Reimplemented from VIEW::ModularWidget.

virtual void VIEW::Server::finalizePreferencesTab Preferences preferences  )  throw () [virtual]
 

Remove the preferences tab.

This method removes the ServerPreferences tab of this server from the Preferences dialog of the MainControl. This method is called automatically by the method aboutToExit method of the class MainControl at the end of the application. See ModularWidget for more information concerning preferences tabs.

Parameters:
preferences the Preferences dialog of the MainControl
See also:
aboutToExit

ServerPreferences

Preferences

Reimplemented from VIEW::ModularWidget.

virtual void VIEW::Server::finalizeWidget MainControl main_control  )  throw () [virtual]
 

Remove the server widget.

This method deletes the icon of this server and removes it from MainControl. This method will be called by aboutToExit of the class MainControl.

See also:
ModularWidget

aboutToExit

Reimplemented from VIEW::ModularWidget.

int VIEW::Server::getPort  )  const throw ()
 

Return the server port.

Return the port of this server.

Returns:
int the port of this server

virtual void VIEW::Server::initializePreferencesTab Preferences preferences  )  throw () [virtual]
 

Initialize a preferences tab for the server.

This method creates the preferences tab ServerPreferences for this server and inserts it into the Preferences dialog of the MainControl. This method is called automatically by the method show of the class MainControl at the start of the application. See ModularWidget for more information concerning preferences tabs.

Parameters:
preferences the Preferences dialog of the MainControl
See also:
show

ServerPreferences

Preferences

Reimplemented from VIEW::ModularWidget.

virtual void VIEW::Server::initializeWidget MainControl main_control  )  throw () [virtual]
 

Initialize the server widget.

This method initializes the icon of this server and adds it to MainControl. This method will be called by show of the class MainControl.

See also:
ModularWidget

show

Reimplemented from VIEW::ModularWidget.

virtual bool VIEW::Server::isValid  )  const throw () [virtual]
 

Internal state and consistency self-validation.

Calls {ConnectionObject::isValid}.

Returns:
bool true if the internal state of this server is correct
See also:
ConnectionObject::isValid

Reimplemented from VIEW::ConnectionObject.

void VIEW::Server::registerObjectCreator const ObjectCreator s  )  throw ()
 

Register a ObjectCreator that is used for converting PersistentObject objects into Composite objects.

Every ObjectCreator, that is still registered, when a Server instance is destructed, will be deleted.

See also:
ObjectCreator

void VIEW::Server::setPort const int  port  )  throw ()
 

Set the server port.

Set port of this server. Must be called before activate to have any effect.

Parameters:
port the new port

virtual void VIEW::Server::timer  )  [protected, virtual]
 

Timer method.

Virtually overridden method. This method handles the socket stream. Every second it checks whether a new object is available at the stream. If this is the case the stream will be accepted and the incoming object will be reveiced. At the moment only Composite objects will be accepted. If another object is received the exception NotCompositeObject will be thrown.

See also:
QTTimer::timer
Exceptions:
NotCompositeObject thrown if another object than Composite object is received

void VIEW::Server::unregisterObjectCreator  )  throw ()
 

Reset the ObjectCreator.

After calling this method PersistentObject objects will be converted using the default ObjectCreator.

See also:
ObjectCreator