CCR Extension Methods

Microsoft Robotics

Glossary Item Box

Microsoft Robotics Developer StudioSend feedback on this topic

CCR Extension Methods

To simplify programming with CCR, several extensions are defined on the DispatcherQueue class. These are visible through Intellisense. Equivalents to a lot of these methods are available in DSS via the DsspServiceBase class, so they are only relevant when programming with CCR outside the DSS environment. For example, in CCR:

    Ccr.Core.DispatcherQueue q = new DispatcherQueue();

    yield return q.TimeoutPort(100).Receive();

is equivalent to the following code in a DSS service (and even the base.TaskQueue is optional):

    yield return base.TaskQueue.TimeoutPort(100).Receive();

The following table lists all of the Extension Methods.

 

Extension Method

Parameters

Description

void Spawn

Handler handler

Invoke a message handler asynchronously that does not take any arguments.

void Spawn<T0>

T0 t0,
Handler<T0> handler

Invoke a message handler asynchronously, supplying a single argument explicitly.

void Spawn<T0, T1>

T0 t0,
T1 t1,
Handler<T0, T1> handler

Invoke a message handler asynchronously, supplying two arguments explicitly.

void Spawn<T0, T1, T2>

T0 t0,
T1 t1,
T2 t2,
Handler<T0, T1, T2> handler

Invoke a message handler asynchronously, supplying three arguments explicitly.

void SpawnIterator

IteratorHandler handler

Invoke an iterator-based message handler asynchronously that does not take any arguments.

void SpawnIterator<T0>

T0 t0,
IteratorHandler<T0> handler

Invoke an iterator-based message handler asynchronously, supplying a single argument explicitly.

void SpawnIterator<T0, T1>

T0 t0,
T1 t1,
IteratorHandler<T0, T1> handler

Invoke an iterator-based message handler asynchronously, supplying two arguments explicitly.

void SpawnIterator<T0, T1, T2>

T0 t0,
T1 t1,
T2 t2,
IteratorHandler<T0, T1> handler

Invoke an iterator-based message handler asynchronously, supplying three arguments explicitly.

void Activate<T>

params T[] tasks where T : ITask

Submits CCR tasks to the dispatcher port for execution. If the task was a receiver orchestration like join or choice, executing it means registering constraints on ports to guard the execution of user code.

void EmptyHandler<T>

T message

An empty handler implementation that can be used in a receiver to handle a message without side effects.

Port<DateTime> TimeoutPort

int milliseconds

Creates a port to receive a time signal, registers a timeout with the sequencer, supplying the private port.

Port<DateTime> TimeoutPort

TimeSpan ts

Creates a port to receive a time signal, registers a timeout with the sequencer, supplying the private port.

 

 

© 2012 Microsoft Corporation. All Rights Reserved.

Show: