libmapper 2.4.12
mapper::Map Class Reference

#include <mapper_cpp.h>

Inheritance diagram for mapper::Map:
mapper::Object

Public Types

enum class  Location { SRC = MPR_LOC_SRC , DST = MPR_LOC_DST , ANY = MPR_LOC_ANY }
 
enum class  Protocol { UDP = MPR_PROTO_UDP , TCP = MPR_PROTO_TCP }
 
- Public Types inherited from mapper::Object
enum class  Status {
  UNDEFINED = MPR_STATUS_UNDEFINED , EXPIRED = MPR_STATUS_EXPIRED , NEW = MPR_STATUS_NEW , MODIFIED = MPR_STATUS_MODIFIED ,
  STAGED = MPR_STATUS_STAGED , ACTIVE = MPR_STATUS_ACTIVE , REMOVED = MPR_STATUS_REMOVED , HAS_VALUE = MPR_STATUS_HAS_VALUE ,
  NEW_VALUE = MPR_STATUS_NEW_VALUE , UPDATE_LOC = MPR_STATUS_UPDATE_LOC , UPDATE_REM = MPR_STATUS_UPDATE_REM , REL_UPSTRM = MPR_STATUS_REL_UPSTRM ,
  REL_DNSTRM = MPR_STATUS_REL_DNSTRM , INST_OFLW = MPR_STATUS_OVERFLOW , ANY = MPR_STATUS_ANY
}
 

Public Member Functions

 Map (signal_type src, signal_type dst)
 
template<typename... Args>
 Map (const str_type &expression, Args ...args)
 
 Map (int num_srcs, signal_type srcs[], int num_dsts, signal_type dsts[])
 
template<size_t N, size_t M>
 Map (std::array< signal_type, N > &srcs, std::array< signal_type, M > &dsts)
 
 Map (std::vector< signal_type > &srcs, std::vector< signal_type > &dsts)
 
 operator mpr_map () const
 
const Maprefresh () const
 
void release () const
 
bool ready () const
 
Mapadd_scope (const Device &dev)
 
Mapremove_scope (const Device &dev)
 
int signal_idx (signal_type sig) const
 
List< Signalsignals (Location loc=Location::ANY) const
 
const Mappush () const
 
- Public Member Functions inherited from mapper::Object
 operator bool () const
 
Type type () const
 
Graph graph () const
 
int get_status () const
 
Objectreset_status ()
 
template<typename... Values>
Objectset_property (const Values... vals)
 
template<typename... Values>
Objectset_local_property (const Values... vals)
 
virtual Objectremove_property (Property prop)
 
virtual Objectremove_property (const str_type &key)
 
int num_props (bool staged=false) const
 
PropVal property (const str_type &key=NULL) const
 
PropVal property (Property prop) const
 
PropVal property (int idx) const
 

Detailed Description

Maps define dataflow connections between sets of Signals. A Map consists of one or more source Signals, one or more destination Signal (currently), restricted to one) and properties which determine how the source data is processed.

Member Enumeration Documentation

◆ Location

enum class mapper::Map::Location
strong

Describes the possible endpoints of a map.

Enumerator
SRC 

Source signal(s) for this map.

DST 

Destination signal(s) for this map.

ANY 

Either source or destination signals.

◆ Protocol

enum class mapper::Map::Protocol
strong

Describes the possible network protocols for map communication.

Enumerator
UDP 

Map updates are sent using UDP.

TCP 

Map updates are sent using TCP.

Constructor & Destructor Documentation

◆ Map() [1/5]

mapper::Map::Map ( signal_type src,
signal_type dst )
inline

Create a Map between a pair of Signals. If a matching map already exists in the graph, the new Map object will refer to the existing map, otherwise a new map will be created. Changes to the Map will not take effect until it has been added to the distributed graph using push().

Parameters
srcSource Signal.
dstDestination Signal object.

◆ Map() [2/5]

template<typename... Args>
mapper::Map::Map ( const str_type & expression,
Args ... args )
inline

Create a map between a set of signals using an expression string containing embedded format specifiers that are replaced by mpr_sig values specified in subsequent additional arguments. If a matching map already exists in the graph, the new Map object will refer to the existing map, otherwise a new map will be created. Changes to the Map will not take effect until it has been added to the distributed graph using push().

Parameters
expressionA string specifying the map expression to use when mapping source to destination signals. The format specifier "%x" is used to specify source signals and the "%y" is used to specify the destination signal.
argsA sequence of additional Signal arguments, one for each format specifier in the format string.

◆ Map() [3/5]

mapper::Map::Map ( int num_srcs,
signal_type srcs[],
int num_dsts,
signal_type dsts[] )
inline

Create a map between a set of Signals. If a matching map already exists in the graph, the new Map object will refer to the existing map, otherwise a new map will be created. Changes to the Map will not take effect until it has been added to the distributed graph using push().

Parameters
num_srcsThe number of source signals in this map.
srcsArray of source Signal objects.
num_dstsThe number of destination signals in this map, currently restricted to 1.
dstsArray of destination Signal objects.

◆ Map() [4/5]

template<size_t N, size_t M>
mapper::Map::Map ( std::array< signal_type, N > & srcs,
std::array< signal_type, M > & dsts )
inline

Create a map between a set of Signals. If a matching map already exists in the graph, the new Map object will refer to the existing map, otherwise a new map will be created. Changes to the Map will not take effect until it has been added to the distributed graph using push().

Parameters
srcsstd::array of source Signal objects.
dstsstd::array of destination Signal objects.

◆ Map() [5/5]

mapper::Map::Map ( std::vector< signal_type > & srcs,
std::vector< signal_type > & dsts )
inline

Create a map between a set of Signals. If a matching map already exists in the graph, the new Map object will refer to the existing map, otherwise a new map will be created. Changes to the Map will not take effect until it has been added to the distributed graph using push().

Parameters
srcsstd::vector of source Signal objects.
dstsstd::vector of destination Signal objects.

Member Function Documentation

◆ add_scope()

Map & mapper::Map::add_scope ( const Device & dev)
inline

Add a scope to this Map. Map scopes configure the propagation of Signal updates across the Map. Changes will not take effect until synchronized with the distributed graph using push().

Parameters
devDevice to add as a scope for this Map. After taking effect, this setting will cause instance updates originating from the specified Device to be propagated across the Map.
Returns
Self.

◆ operator mpr_map()

mapper::Map::operator mpr_map ( ) const
inline

Return C data structure mpr_map corresponding to this object.

Returns
C mpr_map data structure.

◆ push()

const Map & mapper::Map::push ( ) const
inlinevirtual

Push "staged" property changes out to the distributed graph.

Returns
Self.

Reimplemented from mapper::Object.

◆ ready()

bool mapper::Map::ready ( ) const
inline

Detect whether a Map is completely initialized.

Returns
True if map is completely initialized.

◆ refresh()

const Map & mapper::Map::refresh ( ) const
inline

Re-create stale map if necessary.

Returns
Self.

◆ release()

void mapper::Map::release ( ) const
inline

Release the Map between a set of Signals.

◆ remove_scope()

Map & mapper::Map::remove_scope ( const Device & dev)
inline

Remove a scope from this Map. Map scopes configure the propagation of Signal updates across the Map. Changes will not take effect until synchronized with the distributed graph using push().

Parameters
devDevice to remove as a scope for this Map. After taking effect, this setting will cause instance updates originating from the specified Device to be blocked from propagating across the Map.
Returns
Self.

◆ signal_idx()

int mapper::Map::signal_idx ( signal_type sig) const
inline

Get the index of the Map endpoint matching a specific Signal.

Parameters
sigThe Signal to look for.
Returns
Index of the signal in this map, or -1 if not found.

◆ signals()

List< Signal > mapper::Map::signals ( Location loc = Location::ANY) const
inline

Retrieve a list of connected Signals for this Map.

Parameters
locMPR_LOC_SRC for source signals for this Map, MPR_LOC_DST for destinations, or MPR_LOC_ANY for both.
Returns
A List of Signals.