BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | List of all members
BALL::Client Class Reference

#include <BALL/CONCEPT/client.h>

Classes

class  InvalidClient
 
class  NoPersistentObject
 

Public Types

enum  Command { COMMAND__UNKOWN = 0, COMMAND__SEND_OBJECT = 1, NUMBER_OF_COMMANDS }
 

Public Member Functions

Constructors
 Client ()
 
 Client (const String &host, int port=20000)
 
Destructors
virtual ~Client ()
 
virtual void clear ()
 
Accessors: inspectors and mutators
void connect (const String &host, int port=20000)
 
void insert (Composite &composite)
 
debuggers and diagnostics
virtual bool isValid () const
 
virtual void dump (std::ostream &s=std::cout, Size depth=0) const
 

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

Definition at line 47 of file client.h.

Member Enumeration Documentation

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
Enumerator
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.

Definition at line 57 of file client.h.

Constructor & Destructor Documentation

BALL::Client::Client ( )

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

Returns
Client new constructed client
See also
connect
BALL::Client::Client ( const String host,
int  port = 20000 
)

Detailed state initializing constructor. Constructs new client. The state of this client is:

  • host is host
  • port is port (Default = 20000
    Parameters
    hostthe host to connect to
    portthe port of the host to connect to
    Returns
    Client new constructed client
    See also
    connect
virtual BALL::Client::~Client ( )
virtual

Destructor.

Member Function Documentation

virtual void BALL::Client::clear ( )
virtual

Explicit default initialization. Empty for further purpose.

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

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
hostthe host (a string) to connect to
portthe port number of the host
virtual void BALL::Client::dump ( std::ostream &  s = std::cout,
Size  depth = 0 
) const
virtual

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

Parameters
soutput stream where to output the host and port of this client
depththe dumping depth
void BALL::Client::insert ( Composite composite)

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
compositethe Composite to be added to the client (visualization)
See also
TextPersistenceManager::TextPersistenceManager
Exceptions
InvalidClientif the client has no connection to a server
NoPersistentObjectif the composite is not a PersistentObject
virtual bool BALL::Client::isValid ( ) const
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