From: bangerth Date: Fri, 21 Oct 2011 21:16:54 +0000 (+0000) Subject: Move template functions back to header file as is apparently necessary. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74dd9e9c2af306d7ba3744241c80e8a11f5da36b;p=dealii-svn.git Move template functions back to header file as is apparently necessary. git-svn-id: https://svn.dealii.org/trunk@24655 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/table_handler.h b/deal.II/include/deal.II/base/table_handler.h index 5e0e73ba7a..4ada2dbb9e 100644 --- a/deal.II/include/deal.II/base/table_handler.h +++ b/deal.II/include/deal.II/base/table_handler.h @@ -689,6 +689,91 @@ namespace internal throw; } } + + + + template + void TableEntry::save (Archive & ar, + const unsigned int) const + { + // write first an identifier for the kind + // of data stored and then the actual + // data, in its correct data type + if (const int *p = boost::get(&value)) + { + char c = 'i'; + ar & c & *p; + } + else if (const unsigned int *p = boost::get(&value)) + { + char c = 'u'; + ar & c & *p; + } + else if (const double *p = boost::get(&value)) + { + char c = 'd'; + ar & c & *p; + } + else if (const std::string *p = boost::get(&value)) + { + char c = 's'; + ar & c & *p; + } + else + Assert (false, ExcInternalError()); + } + + + + template + void TableEntry::load (Archive & ar, + const unsigned int) + { + // following what we do in the save() + // function, first read in the data type + // as a one-character id, and then read + // the data + char c; + ar & c; + + switch (c) + { + case 'i': + { + int val; + ar & val; + value = val; + break; + } + + case 'u': + { + unsigned int val; + ar & val; + value = val; + break; + } + + case 'd': + { + double val; + ar & val; + value = val; + break; + } + + case 's': + { + std::string val; + ar & val; + value = val; + break; + } + + default: + Assert (false, ExcInternalError()); + } + } } template diff --git a/deal.II/source/base/table_handler.cc b/deal.II/source/base/table_handler.cc index baaec2a236..6de9f3e319 100644 --- a/deal.II/source/base/table_handler.cc +++ b/deal.II/source/base/table_handler.cc @@ -95,88 +95,6 @@ namespace internal } - template - void TableEntry::save (Archive & ar, - const unsigned int) const - { - // write first an identifier for the kind - // of data stored and then the actual - // data, in its correct data type - if (const int *p = boost::get(&value)) - { - char c = 'i'; - ar & c & *p; - } - else if (const unsigned int *p = boost::get(&value)) - { - char c = 'u'; - ar & c & *p; - } - else if (const double *p = boost::get(&value)) - { - char c = 'd'; - ar & c & *p; - } - else if (const std::string *p = boost::get(&value)) - { - char c = 's'; - ar & c & *p; - } - else - Assert (false, ExcInternalError()); - } - - - - template - void TableEntry::load (Archive & ar, - const unsigned int) - { - // following what we do in the save() - // function, first read in the data type - // as a one-character id, and then read - // the data - char c; - ar & c; - - switch (c) - { - case 'i': - { - int val; - ar & val; - value = val; - break; - } - - case 'u': - { - unsigned int val; - ar & val; - value = val; - break; - } - - case 'd': - { - double val; - ar & val; - value = val; - break; - } - - case 's': - { - std::string val; - ar & val; - value = val; - break; - } - - default: - Assert (false, ExcInternalError()); - } - } } /* ------------------------------------------------ */