---
name: "ACE_Command_Callback"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_Command_Callback"
---

# ACE\_Command\_Callback(3)

Defines a class template that allows us to invoke a GOF command style callback to an object without knowing anything about the object except its type.

## NAME

ACE\_Command\_Callback -  Defines a class template that allows us to invoke a GOF command style callback to an object without knowing anything about the object except its type.

## SYNOPSIS

```
#include <ace/Functor_T.h>
template<class RECEIVER, class ACTION>
class ACE_Command_Callback : public ACE_Command_Base
{
  public:
    ACE_Command_Callback (RECEIVER &recvr, ACTION action);
    virtual ~ACE_Command_Callback (void);
    virtual int execute (void *arg = 0);
  private:
    RECEIVER &receiver_;
    ACTION action_;
};
```

## DESCRIPTION

Templatized classes for implementing function objects that are used in various places in ACE.  There are currently two major categories of function objects in ACE: GOF Command Pattern objects, and STL-style functors for comparison of container elements.  The command objects are invoked via an execute method, while the STL-style functors are invoked via an operator() method.

## PUBLIC MEMBERS

```
ACE_Command_Callback (RECEIVER &recvr, ACTION action);
```

Constructor: sets the receiver\_ of the Command to recvr, and the action\_ of the Command to action.

```
virtual ~ACE_Command_Callback (void);
```

Virtual destructor.

```
virtual int execute (void *arg = 0);
```

Invokes the method action\_ from the object receiver\_.

## PRIVATE MEMBERS

```
RECEIVER &receiver_;
```

Object where the method resides.

```
ACTION action_;
```

Method that is going to be invoked.

## AUTHOR

Chris Gill cdgill@cs.wustl.edu

Based on Command Pattern implementations originally done by

Carlos O'Ryan coryan@cs.wustl.edu, Douglas C. Schmidt schmidt@cs.wustl.edu, and Sergio Flores-Gaitan sergio@cs.wustl.edu

and on STL-style functor implementations originally done by

Irfan Pyarali irfan@cs.wustl.edu

## LIBRARY

ace
