# Poco

# template < class TKey, class TValue >

# class StrategyCollection

Library: Foundation
Package: Cache
Header: Poco/StrategyCollection.h

## Description

An StrategyCollection is a decorator masking n collections as a single one.

## Inheritance

Direct Base Classes: AbstractStrategy < TKey, TValue >

All Base Classes: AbstractStrategy < TKey, TValue >

## Member Summary

Member Functions: onAdd, onClear, onGet, onIsValid, onRemove, onReplace, popBack, pushBack

## Types Aliases

### ConstIterator

using ConstIterator = typename Strategies::const_iterator;

### Iterator

using Iterator = typename Strategies::iterator;

### Strategies

using Strategies = std::vector < SharedPtr < AbstractStrategy < TKey, TValue >> >;

## Constructors

### StrategyCollection

StrategyCollection() = default;

## Destructor

### ~StrategyCollection

~StrategyCollection() = default;

## Member Functions

### onAdd

void onAdd(
const void * pSender,
const KeyValueArgs < TKey, TValue > & key
);

Adds the key to the strategy. If for the key already an entry exists, it will be overwritten.

### onClear

void onClear(
const void * pSender,
const EventArgs & args
);

### onGet

void onGet(
const void * pSender,
const TKey & key
);

### onIsValid

void onIsValid(
const void * pSender,
ValidArgs < TKey > & key
);

### onRemove

void onRemove(
const void * pSender,
const TKey & key
);

Removes an entry from the strategy. If the entry is not found the remove is ignored.

### onReplace

void onReplace(
const void * pSender,
std::set < TKey > & elemsToRemove
);

### popBack

void popBack();

Removes the last added AbstractStrategy from the collection.

### pushBack

void pushBack(
AbstractStrategy < TKey, TValue > * pStrat
);

Adds an AbstractStrategy to the collection. Class takes ownership of pointer

## Variables

### _strategies

Strategies _strategies;