Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions | List of all members
JTOOLS::JHashMapToolkit Struct Reference

Toolkit for JHashMap. More...

#include <JHashMapToolkit.hh>

Inheritance diagram for JTOOLS::JHashMapToolkit:
JACOUSTICS::JModel

Static Public Member Functions

template<class JKey_t , class JValue_t , class JEvaluator_t >
static void reset (JHashMap< JKey_t, JValue_t, JEvaluator_t > &buffer)
 Reset buffer. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void set (JHashMap< JKey_t, JValue_t, JEvaluator_t > &target, const JHashMap< JKey_t, JValue_t, JEvaluator_t > &source, const JValue_t &value)
 Set values in target corresponding to keys in source. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void evaluate (JHashMap< JKey_t, JValue_t, JEvaluator_t > &buffer, JValue_t &(JValue_t::*f1)())
 Evaluate arithmetic operation on buffer. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void evaluate (JHashMap< JKey_t, JValue_t, JEvaluator_t > &first, const JHashMap< JKey_t, JValue_t, JEvaluator_t > &second, JValue_t &(JValue_t::*f1)(const JValue_t &))
 Evaluate arithmetic operation on buffers. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void evaluate (JHashMap< JKey_t, JValue_t, JEvaluator_t > &buffer, JValue_t &(JValue_t::*f1)(const double), const double factor)
 Evaluate arithmetic operation on buffer. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static bool equals (const JHashMap< JKey_t, JValue_t, JEvaluator_t > &first, const JHashMap< JKey_t, JValue_t, JEvaluator_t > &second)
 Check equality of buffers. More...
 
template<class JKey_t , class JValue_t , class JEvaluator_t >
static bool equals (const JHashMap< JKey_t, JValue_t, JEvaluator_t > &first, const JHashMap< JKey_t, JValue_t, JEvaluator_t > &second, const double precision)
 Check equality of buffers. More...
 

Detailed Description

Toolkit for JHashMap.

The various pointers to member functions refer to policy methods used in base class JMATH::JMath.

Definition at line 25 of file JHashMapToolkit.hh.

Member Function Documentation

template<class JKey_t , class JValue_t , class JEvaluator_t >
static void JTOOLS::JHashMapToolkit::reset ( JHashMap< JKey_t, JValue_t, JEvaluator_t > &  buffer)
inlinestatic

Reset buffer.

Parameters
bufferbuffer

Definition at line 32 of file JHashMapToolkit.hh.

33  {
34  for (typename JHashMap<JKey_t, JValue_t, JEvaluator_t>::iterator i = buffer.begin(); i != buffer.end(); ++i) {
35  i->second = JValue_t();
36  }
37  }
container_type::iterator iterator
Definition: JHashMap.hh:87
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void JTOOLS::JHashMapToolkit::set ( JHashMap< JKey_t, JValue_t, JEvaluator_t > &  target,
const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  source,
const JValue_t &  value 
)
inlinestatic

Set values in target corresponding to keys in source.

Parameters
targettarget buffer
sourcesource buffer
valuevalue

Definition at line 48 of file JHashMapToolkit.hh.

51  {
52  target.clear();
53 
54  for (typename JHashMap<JKey_t, JValue_t, JEvaluator_t>::const_iterator i = source.begin(); i != source.end(); ++i) {
55  target[i->first] = value;
56  }
57  }
virtual void clear() override
Clear.
Definition: JHashMap.hh:106
container_type::const_iterator const_iterator
Definition: JHashMap.hh:85
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void JTOOLS::JHashMapToolkit::evaluate ( JHashMap< JKey_t, JValue_t, JEvaluator_t > &  buffer,
JValue_t &(JValue_t::*)()  f1 
)
inlinestatic

Evaluate arithmetic operation on buffer.

Parameters
bufferbuffer
f1operation

Definition at line 67 of file JHashMapToolkit.hh.

69  {
70  for (typename JHashMap<JKey_t, JValue_t, JEvaluator_t>::iterator i = buffer.begin(); i != buffer.end(); ++i) {
71  (i->second.*f1)();
72  }
73  }
container_type::iterator iterator
Definition: JHashMap.hh:87
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void JTOOLS::JHashMapToolkit::evaluate ( JHashMap< JKey_t, JValue_t, JEvaluator_t > &  first,
const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  second,
JValue_t &(JValue_t::*)(const JValue_t &)  f1 
)
inlinestatic

Evaluate arithmetic operation on buffers.

Parameters
firstfirst buffer
secondsecond buffer
f1operation

Definition at line 84 of file JHashMapToolkit.hh.

87  {
88  for (typename JHashMap<JKey_t, JValue_t, JEvaluator_t>::const_iterator i = second.begin(); i != second.end(); ++i) {
89  (first[i->first].*f1)(i->second);
90  }
91  }
container_type::const_iterator const_iterator
Definition: JHashMap.hh:85
template<class JKey_t , class JValue_t , class JEvaluator_t >
static void JTOOLS::JHashMapToolkit::evaluate ( JHashMap< JKey_t, JValue_t, JEvaluator_t > &  buffer,
JValue_t &(JValue_t::*)(const double)  f1,
const double  factor 
)
inlinestatic

Evaluate arithmetic operation on buffer.

Parameters
bufferbuffer
f1operation
factorfactor

Definition at line 102 of file JHashMapToolkit.hh.

105  {
106  for (typename JHashMap<JKey_t, JValue_t, JEvaluator_t>::iterator i = buffer.begin(); i != buffer.end(); ++i) {
107  (i->second.*f1)(factor);
108  }
109  }
container_type::iterator iterator
Definition: JHashMap.hh:87
template<class JKey_t , class JValue_t , class JEvaluator_t >
static bool JTOOLS::JHashMapToolkit::equals ( const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  first,
const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  second 
)
inlinestatic

Check equality of buffers.

Parameters
firstfirst buffer
secondsecond buffer
Returns
true if buffers are equal; else false

Definition at line 120 of file JHashMapToolkit.hh.

122  {
124  p = first .begin(),
125  q = second.begin(); ; ++p, ++q) {
126 
127  if (p != first.end() && q != second.end()) {
128 
129  if (p->first != q->first || p->second != q->second) {
130  return false;
131  }
132 
133  } else if (p == first.end() && q == second.end()) {
134 
135  return true;
136 
137  } else {
138 
139  return false;
140  }
141  }
142  }
container_type::const_iterator const_iterator
Definition: JHashMap.hh:85
template<class JKey_t , class JValue_t , class JEvaluator_t >
static bool JTOOLS::JHashMapToolkit::equals ( const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  first,
const JHashMap< JKey_t, JValue_t, JEvaluator_t > &  second,
const double  precision 
)
inlinestatic

Check equality of buffers.

Parameters
firstfirst buffer
secondsecond buffer
precisionprecision
Returns
true if buffers are equal; else false

Definition at line 154 of file JHashMapToolkit.hh.

157  {
159  p = first .begin(),
160  q = second.begin(); ; ++p, ++q) {
161 
162  if (p != first.end() && q != second.end()) {
163 
164  if (p->first != q->first || !p->second.equals(q->second, precision)) {
165  return false;
166  }
167 
168  } else if (p == first.end() && q == second.end()) {
169 
170  return true;
171 
172  } else {
173 
174  return false;
175  }
176  }
177  }
container_type::const_iterator const_iterator
Definition: JHashMap.hh:85

The documentation for this struct was generated from the following file: