A talk by Timothy L. Tomkinson of COMPANY: Northrop Grumman at Tcl2008.
Typical test stand: operator PC, connected to:
Control PC :
Custom Middleware: create custom client server applications. Need to know network programming on different platforms. (Steep learning curve on some platforms/languages). Need to define network protocol and message structures (separate code required to encapsulate and extract messages; tedious to maintain). Expensive.
Off the shelf solutions, ala CORBA (Common Object Request Broker Architecture). Platform-independent infrastructure for communication over a network. Messages are defined using a generic Interface Definition Language (IDL). IDL compiler generates client and server objects. Client object used to connect to server object and execute remote method calls. Method arguments, return values, and exceptions are encapsulated and extracted automatically according to IDL. ORB (Object Request Broker) provides main event loop processing and message dispatching. Very complicated, very expensive.
(... showed diagram of CORBA architecture ...)
Tcl Distributed Objects:
Advantages:
Used Ffidl package to call shared libraries. Allows Tcl to write C functions (DLLs on Windows; .so on Unix). Eliminated the need to write Tcl extensions. Ported to VxWorks. Uses VxWorks symbol table and allows direct calls to kernel and user modules there. Wrapper class created for each library to provide object-oriented interface.
Layers:
(... showed sample itcl code for device driver class ...) Command table contains method names vs command strings. Initialization code creates public methods for each command. Public methods call the same private method to write to device. Same concept used for query commands.
Server side code:
% # start the server % package require Remote % Remote::config -port 5000 -local 0
Client side (sans comments that were on the slide--elided due to lack of time to copy them--MC):
% package require Remote % set remote [Remote #auto $hostname 5000] % $remote send "package require PowerSupply" % set ps [$remote new PowerSupply] % $ps reset % $ps voltage 5.0
Conclusion:
CORBA paradigm very easy to implement in Tcl. Itcl provides all necessary object-oriented extensions. Tcl's introspection facility eliminates need for IDL files. Comm package provides robust remote procedure calls. Ffidl is perfect for controlling hardware. Tcl's portability allows seamless control across multiple platforms. Distributed object architecture provides rapid development. (Code can be tested and debugged on local PC. To deploy, only a few extra lines are needed.) ...