---
name: "ACE_Creation_Strategy"
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_Creation_Strategy"
---

# ACE\_Creation\_Strategy(3)

Defines the interface for specifying a creation strategy for a SVC\_HANDLER.

## NAME

ACE\_Creation\_Strategy -  Defines the interface for specifying a creation strategy for a SVC\_HANDLER.

## SYNOPSIS

```
#include <ace/ACE_Strategies_T.h>
template<class SVC_HANDLER>
class ACE_Creation_Strategy
{
  public:
    ACE_Creation_Strategy (ACE_Thread_Manager * = 0);
    int open (ACE_Thread_Manager * = 0);
    virtual ~ACE_Creation_Strategy (void);
    virtual int make_svc_handler (SVC_HANDLER *&sh);
    void dump (void) const;
    ACE_ALLOC_HOOK_DECLARE;
  protected:
    ACE_Thread_Manager *thr_mgr_;
};
```

## DESCRIPTION

The default behavior is to make a new SVC\_HANDLER.  However, subclasses can override this strategy to perform SVC\_HANDLER creation in any way that they like (such as creating subclass instances of SVC\_HANDLER, using a singleton, dynamically linking the handler, etc.).

## Initialization and termination methods.

```
ACE_Creation_Strategy (ACE_Thread_Manager * = 0);
```

Default constructor.

```
int open (ACE_Thread_Manager * = 0);
```

A Thread\_Manager is useful when creating active objects.

```
virtual ~ACE_Creation_Strategy (void);
```

## Factory method.

```
virtual int make_svc_handler (SVC_HANDLER *&sh);
```

Create a SVC\_HANDLER with the appropriate creation strategy.  The default behavior of this method is to make a new SVC\_HANDLER if sh == 0 (passing in the Thread\_Manager), else sh is unchanged.  Returns -1 on failure, else 0.

```
void dump (void) const;
```

Dump the state of an object.

```
ACE_ALLOC_HOOK_DECLARE;
```

Declare the dynamic allocation hooks.

## AUTHOR

Doug Schmidt

## LIBRARY

ace
