DIS(IEEE 1278.1) Fully Implemented in C++. A complete open source implementation of DIS (Distributed Interactive Simulation) in C++. 1278.1 and 1278.1a are fully implemented including enumerations. Includes several utility classes to help with developing your DIS app.
Using the current constructor to create a Connection class is a little too verbose and tedious.
Additionally, although if some options can be modified after creation, some cannot (port).
I propose to modify the Connection class's creation process by utilizing the Builder Pattern:
const Connection connection = Connection::builder("1.2.3.4") // Automatically determine if address is multicast or not
.port(3000) // Send/Receive port
.interface("eth0") // Send/Receive interface
.timeout(3, 0) // Send/Receive timeout
.blocking(true)
.factory(myFactory)
.receiveAddress("1.2.3.4")
.receivePort(12000)
.receiveInterface("eth0") // Interface name
.receiveTimeout(6, 0)
.sendAddress("4.3.2.1")
.sendPort(6000)
.sendInterface("9.9.9.9") // Interface IP
.sendInterface(0) // Interface index -> 0 is default interface
.sendTimeout(12, 0)
.receive(false) // Disable receive -> If both receive/send (after .build() call) are false throw error
.send(false) // Disable send -> If both receive/send (after .build() call) are false throw error
.addSubscriber(S0)
.removeSubscriber(S0)
.build();
connection.connect();
// ...
connection.disconnect();
Using the current constructor to create a
Connection
class is a little too verbose and tedious. Additionally, although if some options can be modified after creation, some cannot (port
). I propose to modify theConnection
class's creation process by utilizing theBuilder Pattern
:What do yuo think? 🥳