Dasyne Class Overview




Here you will find an overview of the Dasyne classes, and how they fit together.


Events

DEngine

Every program will have one or more DEngine classes to handle event dispatching. Classes that produce events take a DEngine in their constructors, which registers them with the DEngine. Whenever you call the DEngine's update function, any queued events from registered objects will be dispatched sequentially. As long as update is being called in the same thread, the event handlers will not require cross-thread synchronization.

In a multi-threaded program, it might make sense to have one DEngine per thread. We can balance the event-handling load across cores, and each DEngine can dispatch its own thread's events without needing thread synchronization.

DEvent

DEvent lets you define a custom function that will be called whenever its DEngine updates.


TCP Networking

DServer

DServer accepts connections from clients, and creates a new DClient object for each one. It provides the following event handlers: connectHandler and errorHandler. These will be called whenever the DEngine updates.

DClient

The DClient class handles a single TCP connection. It lets us connect to a server, and send and receive data. DClient has these event handlers: connectHandler, errorHandler, receiveHandler and sendHandler. As with DServer, these will be called whenever you call the associated DEngine's update function.

DDispatcher

DDispatcher inherits from DClient, and provides additional functionality. It splits the TCP input stream into messages, removing the need to deal with partially-received data. It can also split a single TCP connection into different channels, and can provide a different event handler for each one.


UDP Networking

DUdpSocket

DUdpSocket is a stand-alone UDP socket.

DUdpModule

DUdpModule is a UDP socket that adds UDP communication to one or more DDispatchers.


Timing

DTime

DTime provides millisecond-accurate timing.

DTimer

DTimer periodically generates events at a specified time interval.


Serialization and Data Storage

DBuffer

DBuffer is a container for network data, and includes compression, serialization, hashing, and efficient bounds-checking and resizing.

DBufferIter

DBufferIter provides efficient iteration across a DBuffer object.

DField

A DField contains one or more values that are part of a network message. For example, a DField might hold five user names.

DProtocol

DProtocol contains DFields that make up a network message. It can automatically generate a DBuffer with the message contents, and extract values from received DBuffers.











Back to contents