# Poco

# class DynamicAnyHolder

Library: Foundation
Package: Core
Header: Poco/DynamicAnyHolder.h

## Description

Interface for a data holder used by the DynamicAny class. Provides methods to convert between data types. Only data types for which a convert method exists are supported, which are all C++ built-in types with addition of std::string, DateTime, LocalDateTime, Timestamp, and std::vector<DynamicAny>.

## Inheritance

Known Derived Classes: DynamicAnyHolderImpl

## Member Summary

Member Functions: clone, convert, convertSignedFloatToUnsigned, convertSignedToUnsigned, convertToSmaller, convertToSmallerUnsigned, convertUnsignedToSigned, isArray, isInteger, isNumeric, isSigned, isString, type

## Constructors

### DynamicAnyHolder

DynamicAnyHolder();

Creates the DynamicAnyHolder.

## Destructor

### ~DynamicAnyHolder

virtual ~DynamicAnyHolder();

Destroys the DynamicAnyHolder.

## Member Functions

### clone

virtual DynamicAnyHolder * clone() const = 0;

Deep-copies the DynamicAnyHolder.

### convert

virtual void convert(
Int8 & val
) const = 0;

### convert

virtual void convert(
Int16 & val
) const = 0;

### convert

virtual void convert(
Int32 & val
) const = 0;

### convert

virtual void convert(
Int64 & val
) const = 0;

### convert

virtual void convert(
UInt8 & val
) const = 0;

### convert

virtual void convert(
UInt16 & val
) const = 0;

### convert

virtual void convert(
UInt32 & val
) const = 0;

### convert

virtual void convert(
UInt64 & val
) const = 0;

### convert

virtual void convert(
DateTime & val
) const = 0;

### convert

virtual void convert(
LocalDateTime & val
) const = 0;

### convert

virtual void convert(
Timestamp & val
) const = 0;

### convert

virtual void convert(
bool & val
) const = 0;

### convert

virtual void convert(
float & val
) const = 0;

### convert

virtual void convert(
double & val
) const = 0;

### convert

virtual void convert(
char & val
) const = 0;

### convert

virtual void convert(
std::string & val
) const = 0;

### isArray

virtual bool isArray() const = 0;

### isInteger

virtual bool isInteger() const = 0;

### isNumeric

virtual bool isNumeric() const = 0;

### isSigned

virtual bool isSigned() const = 0;

### isString

virtual bool isString() const = 0;

### type

virtual const std::type_info & type() const = 0;

Returns the type information of the stored content.

### convertSignedFloatToUnsigned

template < typename F, typename T > void convertSignedFloatToUnsigned(
const F & from,
T & to
) const;

This function is meant for converting floating point data types to unsigned integral data types. Negative values can not be converted and if one is encountered, RangeException is thrown. If uper limit is within the target data type limits, the conversion is performed.

### convertSignedToUnsigned

template < typename F, typename T > void convertSignedToUnsigned(
const F & from,
T & to
) const;

This function is meant for converting signed integral data types to unsigned data types. Negative values can not be converted and if one is encountered, RangeException is thrown. If upper limit is within the target data type limits, the conversion is performed.

### convertToSmaller

template < typename F, typename T > void convertToSmaller(
const F & from,
T & to
) const;

This function is meant to convert signed numeric values from larger to smaller type. It checks the upper and lower bound and if from value is within limits of type T (i.e. check calls do not throw), it is converted.

### convertToSmallerUnsigned

template < typename F, typename T > void convertToSmallerUnsigned(
const F & from,
T & to
) const;

This function is meant for converting unsigned integral data types, from larger to smaller type. Since lower limit is always 0 for unigned types, only the upper limit is checked, thus saving some cycles compared to the signed version of the function. If the value to be converted is smaller than the maximum value for the target type, the conversion is performed.

### convertUnsignedToSigned

template < typename F, typename T > void convertUnsignedToSigned(
const F & from,
T & to
) const;

This function is meant for converting unsigned integral data types to unsigned data types. Negative values can not be converted and if one is encountered, RangeException is thrown. If upper limit is within the target data type limits, the converiosn is performed.