48 #include "IterationPack_AlgorithmState.hpp"
49 #include "IterationPack_IterQuantityAccess.hpp"
51 namespace IterationPack {
67 IterQuantityAccess<T>& cast_iq(
68 AlgorithmState& state,
const std::string& iq_name );
72 const IterQuantityAccess<T>& cast_iq(
73 const AlgorithmState& state,
const std::string& iq_name );
91 IterQuantityAccess<T>& cast_iq(
96 const IterQuantityAccess<T>& cast_iq(
101 void imp_cast_iq_throw_error(
102 const std::string& iq_name
103 ,
const std::string& iq_is_type_name
104 ,
const std::string& iq_want_type_name
107 void imp_cast_iq_throw_error(
109 ,
const std::string& iq_name
110 ,
const std::string& iq_is_type_name
111 ,
const std::string& iq_want_type_name
119 IterQuantityAccess<T>& cast_iq(
120 AlgorithmState& state,
const std::string& iq_name )
123 &iq = state.iter_quant( iq_name );
124 IterQuantityAccess<T>
125 *p =
dynamic_cast<IterQuantityAccess<T>*
>( &iq );
128 imp_cast_iq_throw_error( iq_name,
typeName(iq), TypeNameTraits<T>::name() );
134 const IterQuantityAccess<T>& cast_iq(
135 const AlgorithmState& state,
const std::string& iq_name )
138 &iq = state.iter_quant( iq_name );
139 const IterQuantityAccess<T>
140 *p =
dynamic_cast<const IterQuantityAccess<T>*
>( &iq );
143 imp_cast_iq_throw_error( iq_name,
typeName(iq), TypeNameTraits<T>::name() );
149 IterQuantityAccess<T>& cast_iq(
153 &iq = state.iter_quant( iq_id );
154 IterQuantityAccess<T>
155 *p =
dynamic_cast<IterQuantityAccess<T>*
>( &iq );
158 imp_cast_iq_throw_error( iq_id, iq_name,
typeName(iq), TypeNameTraits<T>::name() );
164 const IterQuantityAccess<T>& cast_iq(
168 &iq = state.iter_quant( iq_id );
169 const IterQuantityAccess<T>
170 *p =
dynamic_cast<const IterQuantityAccess<T>*
>( &iq );
173 imp_cast_iq_throw_error( iq_id, iq_name,
typeName(iq), TypeNameTraits<T>::name() );
179 #endif // GIP_CAST_IQ_H
std::string typeName(const T &t)