This directory contains a set of examples illustrating the use of the
different Open-ORG core modules.

Note: On non-Unix platforms (missing the fork system call) you have to
start the node managers manually (type "python nodemngr.py" before you
run any of the examples below capsule.py).


lbind-ex.py
===========

The `lbind-ex.py' example illustrates the usage of interface
references (instances of the IRef class) and local bindings.

To run:
-------

Type "python lbind-ex.py" in your prompt.

Resulting output:
-----------------

a.f: helo
b.g: hello
b.h: helllo
i.g raised AttributeError: IRef instance has no attribute 'g'
b.g: rebound
i.g raised AttributeError: IRef instance has no attribute 'g'
b.g: rebound again
f directly   (calls per second): 2644746.83145 ,  0.00000038
f indirectly (calls per second):  328072.14874 , 0.00000305


component-ex.py
===============

The `component-ex.py' example shows the creation and usage of
components (also with the component factory).

To run:
-------

Type "python component-ex.py" in your prompt.

Resulting output:
-----------------

O msg: first
O msg: second
O msg: third and last
Signal sink: `msg called'.
O msg: msg with event
Method: `signal recv'.

event-ex.py
===========

The `event-ex.py' example shows the usage of component events.

To run:
-------

Type "python event-ex.py" in your prompt.

Resulting output (example):
---------------------------

7
1
Warning: out of range
-2
8
  (removed similar lines: the result is 100 lines with numbers and a
  warning message before every numbers less than 0 or grater than 10)
5
0
6
Warning: out of range
11



composite-ex.py
===============

The `composite-ex.py' example includes the creation and usage of
composite components.  Composite components are created with the
composite class and using the composite factory.  An example of a
replacement of a component in a setup is also included.

To run:
-------

Type "python composite-ex.py" in your prompt.

Resulting output:
-----------------

C: test through `co'
C: test through `cco'


capsule-ex.py
=============

The `capsule-ex.py' example illustrates the usage of the local capsule
to create, register and call components.  It also illustrate the
difference between local and global (remote) interface references and
creation of a local binding by the (local) capsule.

To run:
-------

Type "python capsule-ex.py" in your prompt.

Resulting output (made readable):
---------------------------------

Msg: a message
ca com iref: {
  '__expID__': ['msg'],
  '__impID__': [],
  '__remote__': {},
  '__local__': {
    'object': <__main__.A instance at daa60>,
    'iobj': <lbind.IObj instance at dab60>}}
ci com iref: {
  '__expID__': [],
  '__impID__': ['msg'],
  '__remote__': {},
  '__local__': {
    'object': {
      'iface': 'com',
      'capsule': <__capsule__.Capsule instance at 99200>,
      'comp': '<component.Component instance at da9e0>'}}}
Msg: another message


nodemngr-ex.py
==============

The `nodemngr-ex.py' example illustrates the usage of the node
manager (create and delete ports).  It can also be used to terminate a
node manager running on this host.

To run:
-------

Type "python nodemngr-ex.py" in your prompt.

Resulting output:
-----------------

Ping node manager: NodeMngr at <host> is alive
New port: 50200


Other examples
==============

The `nameserver-ex.py' shows some of the features of our (simple)
name-server.  The `nameserver-ex.py' file itself includes instruction
about how to run this example.

The `caps-client-ex.py' and `caps-server-ex.py' files contains another
capsule example.  The `caps-client-ex.py' file includes instruction
about how to run this example.

The `opbind-client-ex.py' and `opbind-server-ex.py' files contains
opbind examples.  The `opbind-client-ex.py' file includes instruction
about how to run this example.

The `stream-src-ex.py' and `stream-sink-ex.py' files contains
streambind examples.  The `stream-sink-ex.py' file includes
instruction about how to run this example.

The `sig-src-ex.py' and `sig-sink-ex.py' files contains sigbind
examples.  The `sig-sink-ex.py' file includes instruction about how to
run this example.

