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

ServerWidget class. More...

#include <serverWidget.h>

Inheritance diagram for BALL::VIEW::ServerWidget:
Inheritance graph
[legend]

List of all members.


Classes

class BALLViewServer
BALLView server thread. More...
class NotCompositeObject
NotCompositeObject Exception class. More...

Public Member Functions

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

Signals and Slots

void handleLocking (bool lock)
void lockRequested (bool lock)

Detailed Description

ServerWidget class.

The class ServerWidget 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

BALL::VIEW::ServerWidget::ServerWidget ( QWidget * parent = 0,
const char * name = 0
)

Default Constructor.

The state of this server is:

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

Member Function Documentation

virtual void BALL::VIEW::ServerWidget::applyPreferences ( ) [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 BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::changeLock ( bool lock ) [virtual]

This function is used by the server thread to handle locking of composites across several threads.

The protocol is rather complicated: the server thread reacts to a connection, creates a composite, calls changeLock(), this emits the signal "lockRequested", which is finally handled in the slot handleLocking(). The reason for this involved setup is the separation of server and GUI threads, which does not allow to safely lock the composites in the server thread.

virtual void BALL::VIEW::ServerWidget::clear ( ) [virtual]

Explicit default initialization.

Calls ConnectionObject::clear.

See also:
ConnectionObject::clear

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::dump ( std::ostream & s = std::cout,
Size depth = 0
) const [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

Reimplemented from BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::finalizePreferencesTab ( Preferences & preferences ) [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 BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::finalizeWidget ( MainControl & main_control ) [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 BALL::VIEW::ModularWidget.

int BALL::VIEW::ServerWidget::getPort ( ) const

Return the server port.

Return the port of this server.

Returns:
int the port of this server

virtual void BALL::VIEW::ServerWidget::initializePreferencesTab ( Preferences & preferences ) [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 BALL::VIEW::ModularWidget.

virtual void BALL::VIEW::ServerWidget::initializeWidget ( MainControl & main_control ) [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 BALL::VIEW::ModularWidget.

virtual bool BALL::VIEW::ServerWidget::isValid ( ) const [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 BALL::VIEW::ConnectionObject.

void BALL::VIEW::ServerWidget::registerObjectCreator ( const ObjectCreator & s )

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

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

See also:
ObjectCreator

void BALL::VIEW::ServerWidget::setPort ( const int port )

Set the server port.

Parameters:
port the new port

void BALL::VIEW::ServerWidget::unregisterObjectCreator ( )

Reset the ObjectCreator.

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

See also:
ObjectCreator

Generated on Thu Aug 6 18:30:56 2009 for BALL by doxygen 1.5.8