← Back to team overview

lucadestudios team mailing list archive

Re: Detailed networking API design

 

Pleeeeease do this as an UML class diagram! It'll be way easyer to
understand if you have a quick glance on it, can generate code and shows the
overall dependencies...

Otherwise looks good.. but did you think about my traits idea?

2009/2/26 Luke Benstead <kazade@xxxxxxxxx>

> I've been working on the design a bit more and have come up with a
> list of classes/interfaces and I've got a fair idea how it's all going
> to work, The next step is to develop some interfaces and unit tests
> before writing the concrete code. Here are the classes I've come up
> with:
>
> CLASSES/INTERFACES
>
> namespace network;
>
> //Responsibility - node factory
> controller_interface
> initialize() : bool
> spawn_packet<T>() : T*
> run_server() : server_interface*
> run_client() : client_interface*
> shutdown() : void
>
> node_interface
> receive()
> send()
> attach_observer(node_observer_interface*)
> remove_observer(node_observer_interface*)
>
> //Responsibility – running a server process
> server_interface : node_interface
> listen_for_clients(max_clients=1) : bool
> is_running() : bool
> get_connected_count() : unsigned int
> get_max_client_count() : unsigned int
> has_queued_outgoing() : bool
>
> //Responsibility – handle node events
> node_observer_interface
> on_packet_received(abstract_packet* p);
> on_packet_sent(abstract_packet* p);
> on_disconnected();
> on_connected();
>
> packet_header //structure used by the connection, internal
>
> abstract_packet
>      //holds packet_header
>      //holds packet_serializer
> get_unique_id() : unsigned int
> serialize() : const char*
>
> //Responsibility – to turn a packet into a stream of bytes ready
> //to send across the network (probably using boost,serialization)
> packet_serializer_interface
> serialize_packet(abstract_packet* p) : const char*
>
> //Responsibility – to run a thread which communicates with remote nodes
> abstract_node_process
> run()
>
> _______________________________________________
> Mailing list: https://launchpad.net/~lucadestudios<https://launchpad.net/%7Elucadestudios>
> Post to     : lucadestudios@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~lucadestudios<https://launchpad.net/%7Elucadestudios>
> More help   : https://help.launchpad.net/ListHelp
>

References