I'm working on mechanisms to directly connect OpenDX to other processes.
To this end I've added a new module, SocketConnection, that supports
sending objects from an external process to OpenDX across a socket (and
back, as a future enhancement).    Although I haven't nailed down the
external-process interface, the idea is that the process makes a call to
see if an OpenDX instance has opened a port.  If it has, it can send data
to OpenDX by creating an object using the data model calls in the DXlite
library,  buffer it, and write it to the socket.  On the OpenDX side,
SocketConnection creates a port and an associated fd, then adds an input
handler to watch for input on the fd.  When input arrives, its read off the
socket and converted to a DX object via _dxfImportBin_Buffer, and
DXReadyToRun is called to indicate that new data is available.  When the
module runs, the received object is the module result.  This allows the
external process to send arbitrary objects to OpenDX across a socket.

I've also added a new subclass of Array to further assist here.  A
SharedArray is very similar to a generic Array, but allows the array
contents to be shared with the external process directly.    When a
SharedArray is created, DXNewSharedArray is given a shared memory segment
ID and the address of the data, which must lie in that segment.  Unlike
generic Arrays, which copy data using the DXAddArrayData call, SharedArrays
use it directly.   DX keeps track of how many SharedArrays reference each
segment, and maintains an attachment to that segment as long as there are
references to it.   When the external process creates an object containing
a SharedArray, the buffering process transmits the segment id and offset
within the segment to OpenDX.  When its unbuffered, a new OpenDX-side
SharedArray is created, the segment is attached (if necessary - it may have
been seen before), and the SharedArray stores the address of the data in
OpenDX' memory space.  Thus the external-side SharedArray (which itself
shares data with the external process) and the OpenDX side SharedArray
actually share memory.

FYI.  Comments?

Greg

Reply via email to