|
Reference documentation for deal.II version 9.2.0
|
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\)
\(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\)
\(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\)
\(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Go to the documentation of this file.
16 #ifndef dealii_algorithms_general_data_storage_h
17 #define dealii_algorithms_general_data_storage_h
24 #include <boost/any.hpp>
25 #include <boost/core/demangle.hpp>
94 template <
class Stream>
193 template <
typename Type>
206 template <
typename Type>
219 template <
typename Type>
233 template <
typename Type>
247 template <
typename Type,
typename Arg,
typename... Args>
251 Args &... arguments);
263 template <
typename Type,
typename Arg,
typename... Args>
267 Args &&... arguments);
272 template <
typename Type>
283 template <
typename Type>
294 template <
typename Type>
317 <<
"No entry with the name " << arg1 <<
" exists.");
324 <<
"An entry with the name " << arg1 <<
" already exists.");
333 <<
"The stored type for entry with name \"" << arg1 <<
"\" is "
334 << arg2 <<
" but you requested type " << arg3 <<
".");
350 template <
class Stream>
356 os << it.first <<
'\t' <<
'\t'
357 << boost::core::demangle(it.second.type().name()) << std::endl;
362 template <
typename Type>
371 template <
typename Type>
380 template <
typename Type>
389 template <
typename Type>
399 template <
typename Type>
407 if (
any_data[name].type() ==
typeid(Type *))
409 p = boost::any_cast<Type *>(
any_data[name]);
411 else if (
any_data[name].type() ==
typeid(Type))
413 p = boost::any_cast<Type>(&
any_data[name]);
420 typeid(Type).name()));
427 template <
typename Type>
433 const auto it =
any_data.find(name);
435 if (it->second.type() ==
typeid(Type *))
437 const Type *p = boost::any_cast<Type *>(it->second);
440 else if (it->second.type() ==
typeid(Type))
442 const Type *p = boost::any_cast<Type>(&it->second);
449 it->second.type().name(),
450 typeid(Type).name()));
451 const Type *p =
nullptr;
457 template <
typename Type,
typename Arg,
typename... Args>
466 return get_object_with_name<Type>(name);
470 template <
typename Type,
typename Arg,
typename... Args>
474 Args &&... arguments)
478 Type(std::forward<Arg>(argument),
479 std::forward<Args>(arguments)...));
481 return get_object_with_name<Type>(name);
485 template <
typename Type>
492 return get_object_with_name<Type>(name);
501 #endif // dealii_algorithms_general_data_storage_h
void remove_object_with_name(const std::string &name)
void add_unique_copy(const std::string &name, const Type &entry)
void print_info(Stream &stream)
void add_unique_reference(const std::string &name, Type &entry)
void add_or_overwrite_copy(const std::string &name, const Type &entry)
std::map< std::string, boost::any > any_data
void add_or_overwrite_reference(const std::string &name, Type &entry)
Type & get_object_with_name(const std::string &name)
static ::ExceptionBase & ExcTypeMismatch(std::string arg1, const char *arg2, const char *arg3)
bool stores_object_with_name(const std::string &name) const
GeneralDataStorage()=default
#define DEAL_II_NAMESPACE_OPEN
void merge(const GeneralDataStorage &other_data)
#define DeclException3(Exception3, type1, type2, type3, outsequence)
static ::ExceptionBase & ExcNameHasBeenFound(std::string arg1)
#define DeclException1(Exception1, type1, outsequence)
Type & get_or_add_object_with_name(const std::string &name, Arg &argument, Args &... arguments)
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNameNotFound(std::string arg1)
#define AssertThrow(cond, exc)