diff options
Diffstat (limited to 'src/jtutil/linear_map.cc')
-rw-r--r-- | src/jtutil/linear_map.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/jtutil/linear_map.cc b/src/jtutil/linear_map.cc index b44b466..636675e 100644 --- a/src/jtutil/linear_map.cc +++ b/src/jtutil/linear_map.cc @@ -16,12 +16,7 @@ #include "stdc.h" #include "util.hh" #include "linear_map.hh" - -// everything in this file is inside these namespaces -namespace AHFinderDirect - { -namespace jtutil - { +using jtutil::error_exit; //****************************************************************************** //****************************************************************************** @@ -32,6 +27,8 @@ namespace jtutil // // This function constructs a linear_map<fp_t> object. // +namespace jtutil + { template <typename fp_t> linear_map<fp_t>::linear_map(int min_int_in, int max_int_in, fp_t min_fp_in, fp_t delta_fp_in, fp_t max_fp_in) @@ -40,6 +37,7 @@ linear_map<fp_t>::linear_map(int min_int_in, int max_int_in, { constructor_common(min_fp_in, max_fp_in); } + } // namespace jtutil:: //****************************************************************************** @@ -47,6 +45,8 @@ constructor_common(min_fp_in, max_fp_in); // This function constructs a linear_map<fp_t> object with a subrange // of an existing one. // +namespace jtutil + { template <typename fp_t> linear_map<fp_t>::linear_map(const linear_map<fp_t> &lm_in, int min_int_in, int max_int_in) // subrange @@ -65,6 +65,7 @@ if (! (is_in_range(min_int_in) && is_in_range(max_int_in)) ) constructor_common(lm_in.fp_of_int_unchecked(min_int_in), lm_in.fp_of_int_unchecked(max_int_in)); } + } // namespace jtutil:: //****************************************************************************** @@ -72,6 +73,8 @@ constructor_common(lm_in.fp_of_int_unchecked(min_int_in), // This function does the common argument validation and setup for // all the constructors of class linear_map<fp_t>:: . // +namespace jtutil + { template <typename fp_t> void linear_map<fp_t>::constructor_common(fp_t min_fp_in, fp_t max_fp_in) // assumes @@ -98,6 +101,7 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in)) double(min_fp_in), double(delta_fp()), double(max_fp_in)); /*NOTREACHED*/ } + } // namespace jtutil:: //****************************************************************************** @@ -105,6 +109,8 @@ if (fuzzy<fp_t>::NE(fp_of_int_unchecked(max_int()), max_fp_in)) // This function converts fp --> int coordinate, returning the result // as an fp (which need not be fuzzily integral). // +namespace jtutil + { template <typename fp_t> fp_t linear_map<fp_t>::fp_int_of_fp(fp_t x) const @@ -121,6 +127,7 @@ if (! is_in_range(x)) return inverse_delta_ * (x - origin_); } + } // namespace jtutil:: //****************************************************************************** @@ -133,6 +140,8 @@ return inverse_delta_ * (x - origin_); // Having to explicitly specify the namespace for jtutil::round<fp_t>:: // is ++ugly. :( // +namespace jtutil + { template <typename fp_t> int linear_map<fp_t>::int_of_fp(fp_t x, noninteger_action nia /* = nia_error */) const @@ -187,6 +196,7 @@ default: return 0; // dummy return to quiet gcc // (which doesn't grok that error_exit() never returns) } + } // namespace jtutil:: //****************************************************************************** @@ -200,6 +210,8 @@ return 0; // dummy return to quiet gcc // Having to explicitly specify the namespace for jtutil::round<fp_t>:: // is ++ugly. :( // +namespace jtutil + { template <typename fp_t> int linear_map<fp_t>::delta_int_of_delta_fp (fp_t delta_x, noninteger_action nia /* = nia_error */) @@ -259,6 +271,7 @@ default: return 0; // dummy return to quiet gcc // (which doesn't grok that error_exit() never returns) } + } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -268,12 +281,5 @@ return 0; // dummy return to quiet gcc // ***** template instantiation ***** // -template class linear_map<float>; -template class linear_map<double>; - -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** - - } // namespace jtutil - } // namespace AHFinderDirect +template class jtutil::linear_map<float>; +template class jtutil::linear_map<double>; |