Actors

| Actors |

Actors are functors. Actors are the main driving force behind the framework. An actor can accept 0 to N arguments (where N is a predefined maximum). In an abstract point of view, an actor is the metaphor of a function declaration. The actor has no function body at all, which means that it does not know how to perform any function at all.

an actor is the metaphor of a function declaration

The actor is a template class though, and its sole template parameter fills in the missing function body and does the actual function evaluation. The actor class derives from its template argument. Here's the simplified actor class declaration:

`

        template <typename BaseT>
        struct actor : public BaseT { /*...*/ };

`

To avoid being overwhelmed in details, the following is a brief overview of what an actor is. First, imagine an actor as a non- lazy function that accepts 0..N arguments:

`

        actor(a0, a1, ... aN)

`

Not knowing what to do with the arguments passed in, the actor forwards the arguments received from the client (caller) onto its base class BaseT. It is the base class that does the actual operation, finally returning a result. In essence, the actor's base class is the metaphor of the function body. The sequence of events that transpire is outlined informally as follows:

1) actor is called, passing in N arguments:

client --> actor(a0, a1, ... aN)

2) actor forwards the arguments to its base:

--> actor's base(a0, a1, ... aN)

3) actor's base does some computation and returns a result back to the actor, and finally, the actor returns this back to the client:

actor's base operation --> return result --> actor --> client

In essence, the actor's base class is the metaphor of the function body

For further details, we shall see more in-depth information later as we move on to the more technical side of the framework.

Copyright © 2001-2002 Joel de Guzman
Use, modification and distribution is subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)