AddrBook:
Filter:
Classes (extension) | Utopia | External Control > OSC

AddrBook : Object
ExtensionExtension

Dictionary of networked Peers
Subclasses: RepAddrBook

Description

AddrBook is essentially a dictionary of Peer instances, which represent participants or nodes in a networked music system. AddrBook is not a singleton, and a given system could use multiple instances of it to represent different subgroups, etc. Most objects in Utopia take an AddrBook as an argument, and respond to changes in it when appropriate. An AddrBook is generally used as a (possibly dynamic) collection of intended recipients for one or more types of communication.

Class Methods

AddrBook.new

Create a new instance.

Returns:

An AddrBook

Inherited class methods

Instance Methods

.add(peer)

Add a Peer to this AddrBook.

Arguments:

peer

The Peer to add.

.remove(peer)

Remove a Peer from this AddrBook.

Arguments:

peer

The Peer to remove.

.removeAt(name)

Remove a Peer from this AddrBook, specified by name.

Arguments:

name

A Symbol corresponding to the name of the Peer to remove.

.addMe(mePeer)

Add a Peer to this AddrBook which represents the localhost.

Arguments:

mePeer

An optional Peer to add as me. If nil this method will automatically create a Peer, whose name var will be set using the 'whoami' command line utility.

.send(name ... msg)

Send an OSC message to one of the Peers in this AddrBook.

Arguments:

name

A Symbol corresponding to the name of the Peer to whom the message should be sent.

 ... msg

One or more additional arguments comprising the OSC message to send.

.sendAll( ... msg)

Send an OSC message to all of the Peers in this AddrBook.

Arguments:

 ... msg

One or more arguments comprising the OSC message to send.

.sendAllBundle(time ... msg)

Send an OSC bundle to all of the Peers in this AddrBook.

Arguments:

time

The timestamp for the bundle, specified as some number of seconds into the future. A nil time indicates 'as soon as possible'.

 ... msg

One or more Arrays consisting of the OSC messages in the bundle.

.sendExcluding(name ... msg)

Send an OSC message to all of the Peers in this AddrBook, except for the one specified by name.

Arguments:

name

A Symbol corresponding to the name of the Peer to whom the message should not be sent.

 ... msg

One or more arguments comprising the OSC message to send.

.at(name)

Look up a Peer by name.

Arguments:

name

A Symbol corresponding to the name of the Peer to look up.

Returns:

A Peer if one with the specified name is found, otherwise nil.

.names

Get the names of the Peers in this AddrBook.

Returns:

A Set containing Symbols corresponding to the names of the Peers in this AddrBook.

.peers

Get all the Peers in this AddrBook

Returns:

A Set containing the Peers in this AddrBook.

.onlinePeers

Get all the currently online Peers in this AddrBook

Returns:

A Set containing the Peers in this AddrBook which are currently online.

.me

Get the Peer representing the localhost.

Returns:

A Peer if me is defined, otherwise nil.

.addrs

Get all the addresses of the Peers in this AddrBook

Returns:

A Set containing the NetAddrs of the Peers in this AddrBook.

.includesAddr(addr)

Test to see if this AddrBook includes the supplied address, or an equivalent one in the case of the local computer (e.g. loopback address will match externally visible ones).

Arguments:

addr

A NetAddr to check for.

Returns:

A Boolean indicating if the the NetAddr matches one in this AddrBook.

.excluding(name)

Get all Peers excluding the named Peer.

Arguments:

name

A Symbol corresponding to the name of the Peer to exclude.

Returns:

.others

Get all Peers excluding AddrBook.me.

Returns:

.asAddrBook

Returns this.

Inherited instance methods