This class implements the labelling of the nodes and slots of the network. An instance of this class is automatically created when an instance of a SWDataNetwork is created, and most methods are accessible directly from that class.
- Example -
x = SWDataNetwork.new;
x.add( \accelerometer, 1 );
x.add( \acc_x, [1,0] );
x.add( \acc_y, [1,1] );
x.add( \acc_z, [1,2] );
x.spec.map;
x.spec.save("accelerometer-example");
y = SWDataNetwork.new;
y.setSpec("accelerometer-example");
y.spec.map;
- Methods -
- *new ( netw )
- Create a new instance of SWDataNetworkSpec for the network netw
- name ( )
- The name of the spec. This is basically a label (e.g. the name of your project).
- name_ ( name )
- Set the name of the spec
- map ( )
- The IdentityDictionary holding the keys and node and slot ID's to which the keys point.
- save ( name )
- Save an SWDataNetworkSpec to file with the given name. The spec will be saved in your userAppSupportDirectory in a folder called DataNetworkSpecs. The class also creates a file with an index of known data network specs.
- fromFile ( name )
- Load an SWDataNetworkSpec with name from file.
- copyFile ( target )
- Copy the current spec to another location.
- fromFileName ( fn )
- Load an SWDataNetworkSpec from file fn.
- *all ()
- View all the specs that have been stored to file.
- findNode ( id )
- Find the key for node with id
- findSlot ( id1, id2 )
- Find the key for slot with the ID [id1,id2]
- The methods below can all be accessed from the network directly as well -
- add ( key, slot )
- Add a key (node or slot label) to the spec. slot can be the node ID (one integer), or the slot ID (an Array of two integers).
- Named access to nodes, values and actions -
- at ( key )
- Returns the node or slot at key
- value ( key )
- Get the value of the node or slot at key
- action_ ( key, action )
- Set the action of the node or slot at key
- Node bus control -
- bus ( key )
- Get the bus of the node or slot at key
- createBus ( key, server )
- Create a control bus on the server for the node or slot at key. The data that comes into the slot is automatically mapped to this bus.
- freeBus ( key )
- Free the bus of the node or slot at key
- createAllBuses ( server )
- Creates buses for all nodes that are named in the spec on the specified server
- freeAllBuses ( )
- Free all the buses that have been created.
Marije Baalman
2009-03-16