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

Client Class Reference
[Object Persistence.]

Client class. More...

#include <client.h>

List of all members.

Public Types

enum  Command { COMMAND__UNKOWN = 0, COMMAND__SEND_OBJECT = 1, NUMBER_OF_COMMANDS }
 Command enums for the Client and Server. More...

Public Member Functions

Constructors
 Client () throw ()
 Default Constructor.
 Client (const String &host, int port=20000) throw ()
 Detailed state initializing constructor.
Destructors
virtual ~Client () throw ()
 Destructor.
virtual void clear () throw ()
 Explicit default initialization.
Accessors: inspectors and mutators
void connect (const String &host, int port=20000) throw ()
 Connects to a specified host and port.
void insert (Composite &composite) throw (InvalidClient, NoPersistentObject)
 Adds a new composite.
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 ()
 Internal value dump.


Detailed Description

Client class.

The class Client introduces a rudimentary interface for sending Composite objects to the visualization. In this version only the one way direction from this client to the visualization is possible. In the future there is also a bidirectional data exchange intended. If a Composite is sent two times than the graphical representation of the first one will be replaced through the new graphical representation of the second one. For example if the structure of the Composite is continually changed by a program so the visualization of this Composite changes as well. The Client class connects to the Server class that is part of the VIEW library. See Server for further information.

See also:
Server


Member Enumeration Documentation

enum Client::Command
 

Command enums for the Client and Server.

These enums specify the commands the server is able to understand (at the moment).

See also:
Server

Client

Enumeration values:
COMMAND__UNKOWN  unknown command.
COMMAND__SEND_OBJECT  sent command. This command will be used for indicating a new object that is about to be received
NUMBER_OF_COMMANDS  next free command.


Constructor & Destructor Documentation

Client::Client  )  throw ()
 

Default Constructor.

Constructs new client. The client will have no working connection yet.

Returns:
Client new constructed client
See also:
connect

Client::Client const String host,
int  port = 20000
throw ()
 

Detailed state initializing constructor.

Constructs new client. The state of this client is:

  • host is host
  • port is port (Default = 20000
    Parameters:
    host the host to connect to
    port the port of the host to connect to
    Returns:
    Client new constructed client
    See also:
    connect

virtual Client::~Client  )  throw () [virtual]
 

Destructor.


Member Function Documentation

virtual void Client::clear  )  throw () [virtual]
 

Explicit default initialization.

Empty for further purpose.

void Client::connect const String host,
int  port = 20000
throw ()
 

Connects to a specified host and port.

This method connects this client to a specified host and port. Must be called before any other methodes!

Parameters:
host the host (a string) to connect to
port the port number of the host

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

Internal value dump.

Dumps the current host and port of this client to the output ostream s with dumping depth depth.

Parameters:
s output stream where to output the host and port of this client
depth the dumping depth

void Client::insert Composite composite  )  throw (InvalidClient, NoPersistentObject)
 

Adds a new composite.

Inserts a new Composite to this client. With this method Composite's can be added to the visualization. If the same Composite was already added before it will be replaced by the new representation of composite. The Composite will be put into the TextPersistenceManager that has a connection to a socket stream connected to the given host and port. The TextPersistenceManager will then use that socket stream to write the Composite into.

Parameters:
composite the Composite to be added to the client (visualization)
See also:
TextPersistenceManager::TextPersistenceManager
Exceptions:
InvalidClient if the client has no connection to a server
NoPersistentObject if the composite is not a PersistentObject

virtual bool Client::isValid  )  const throw () [virtual]
 

Internal state and consistency self-validation.

Initiates self-validation of the internal state of this client. If the this client has a connection to a server than true is returned, false otherwise.

Returns:
bool - true if this client has a connection to a server, false otherwise