IvyAccess
Constructor
IvyAccess <id> (String "ip:port", String name, String READY_message)
Action
Create and connect an Ivy (out
) and read (in/any_regex...
)Predefined children
- TextProperty:
in.any_regex.xx
. whereany_regex
is a regex andxx
is the regex's arg in which you are interested. You can use https://regex101.com/ with pcre to help you to build regex - TextProperty:
out
. - TextProperty:
arriving
. - TextProperty:
leaving
.
Cookbook recipe
directory:smala/cookbook/network/
helloIvy
run :
make helloIvy_test
Example - smala style
/* launch 2 instances of this program */
use core
use base
use comms
_main_
Component root {
/* Log Printer to receive a Message in Terminal */
LogPrinter lp ("ivybus in: ")
IvyAccess ivybus ("224.1.2.3:2010", "smala", "READY")
{
// define your regexs
String my_regex ("smala (\\S*)")
//...
}
/* creating a connector to display incomming messages in the text */
ivybus.in.my_regex.[1] => lp.input
Clock cl (1000)
/* write on the bus any String or textProperty */
AssignmentSequence test_to_write (1) {
"smala Hello" =: ivybus.out
}
/* every second we write on the bus: smala Hello */
cl.tick -> test_to_write
}
Example - legacy style
/* launch 2 instances of this program */
use core
use base
use comms
_main_
Component root {
/* ------- Log Printer to receive a Message in Terminal ---*/
LogPrinter lp ("ivybus in: ")
IvyAccess ivybus ("224.1.2.3:2010", "smala", "READY")
/* creating a connector to display incomming messages in the text */
Connector c1 (ivybus, "in/smala (\\S*)/1", lp, "input", 0)
Clock cl (1000)
/* write on the bus any String or textProperty */
AssignmentSequence test_to_write (1) {
"smala Hello" =: ivybus.out
}
/* every second we write on the bus: smala Hello */
cl.tick -> test_to_write
}