Socket System
The socket system supports input and output data ports, called sink and source sockets, respectively. ViennaX automatically handles the dependencies and ensures that the available source sockets are linked to the corresponding sink sockets. In general, the data associated to the sockets can either be already available, thus no copying is required, or it can be generated automatically during the course of the socket creation. The following user-level code snippet depicts the basic utilization of source sockets. Note that the sink sockets are handled similarily.
Utilization of source sockets
void configure(std::size_t pid, std::string const& configstr) { // A data object is automatically created // Requires the type to be default-constructible create_source<double>("x"); // Already instantiated objects can also be used double y; link_source(y, "y"); } bool execute(std::size_t pid, std::size_t call) { // Accessing the socket-associated data objects double& x = access_source<double>("x"); double& y = access_source<double>("y"); return true; }