# ace::SumDecompositions Class Reference

Class purpose is to hold information about all decompositions of given sum (N) into given number of addends (M). More...

`#include <utils.h>`

List of all members.

## Public Member Functions
| SumDecompositions (size_t sum, size_t addends)
| Initializes decompositions tables up to maximum `sum` and maximum number of `addends`.
| ~SumDecompositions (void)
| Deletes all dynamically allocated memory.
const sum_decompositions_t * | get_decompositions_table (size_t sum, size_t addends)
## Private Types
typedef std::map< size_t, sum_decompositions_t * > | overflow_sum_decompositions_mapping_t
## Private Member Functions
void | _init (void)
| Initialization procedure.
| SumDecompositions (const SumDecompositions &sum_decompositions)
SumDecompositions & | operator= (const SumDecompositions &sum_decompositions)
## Private Attributes
size_t | _n
| Variables to store sum (N) and number of addends (M).
size_t | _m
sum_decompositions_t ** | _tables
| Pointer to the beginning of array of pointers to the decompositions tables.
overflow_sum_decompositions_mapping_t | _overflow
| Map to hold the overflowed tables - tables that has one of their params bigger than corresponding param in class constructor.

## Detailed Description

Class purpose is to hold information about all decompositions of given sum (N) into given number of addends (M).

Class stores decompositions not only for given numbers, but up to them. So for constructor parameters N = 4, M = 7 it's possible to ask for all decompositions of sum 4 into 7 addends (and one of them is: 0+0+2+0+1+1+0). Moreover it's possible to ask for all decompositions of params higher than those passed to constructor (e.g. decompositions of sum 5 into 10 addends), but this calls have slower performance, because results for them are counted at first-ask-time, not during object initialization.

## Member Typedef Documentation

typedef std::map<size_t, sum_decompositions_t*> ace::SumDecompositions::overflow_sum_decompositions_mapping_t`[private]`

## Constructor & Destructor Documentation

ace::SumDecompositions::SumDecompositions | ( | const SumDecompositions & | sum_decompositions | ) | `[private]`

ace::SumDecompositions::SumDecompositions | ( | size_t | sum,
|  | size_t | addends |
| ) |  |  | `[inline]`

Initializes decompositions tables up to maximum `sum` and maximum number of `addends`.

ace::SumDecompositions::~SumDecompositions | ( | void |  | ) |

Deletes all dynamically allocated memory.

## Member Function Documentation

void ace::SumDecompositions::_init | ( | void |  | ) | `[private]`

Initialization procedure.

SumDecompositions& ace::SumDecompositions::operator= | ( | const SumDecompositions & | sum_decompositions | ) | `[private]`

const sum_decompositions_t * ace::SumDecompositions::get_decompositions_table | ( | size_t | sum,
|  | size_t | addends |
| ) |  |  |

Returns:
  Pointer to decompositions table corresponding to given params.

Parameters:

  | sum | Determines the sum.
  | addends | Determines the number of addends.

## Member Data Documentation

size_t ace::SumDecompositions::_n`[private]`

Variables to store sum (N) and number of addends (M).

size_t ace::SumDecompositions::_m`[private]`

sum_decompositions_t** ace::SumDecompositions::_tables`[private]`

Pointer to the beginning of array of pointers to the decompositions tables.

overflow_sum_decompositions_mapping_t ace::SumDecompositions::_overflow`[private]`

Map to hold the overflowed tables - tables that has one of their params bigger than corresponding param in class constructor.

The documentation for this class was generated from the following files:

- proto/Source/utils.h
- proto/Source/utils.cpp