Flow123d  jenkins-Flow123d-linux-release-multijob-282
functors_impl.hh
Go to the documentation of this file.
1 #ifndef FUNCTORBASE_IMPL_H
2 #define FUNCTORBASE_IMPL_H
3 
4 #include "tools/functors.hh"
5 #include "system/xio.h"
6 
7 /**************************************** FunctorCommon *****************************************/
8 template<class Type>
10 
11 template<class Type>
13 
14 template<class Type>
15 void FunctorCommon<Type>::set_param(unsigned int param_name, double param_value)
16 {
17  if(param_name < param_.size())
18  {
19  param_[param_name] = param_value;
20  }
21  else
22  {
23  param_.push_back(param_value);
24  }
25 }
26 
27 template<class Type>
28 template<class TType>
30 {
31  unsigned int n = func->param_.size();
32  //DBGMSG("param_size = %d\n",n);
33  param_.resize(n);
34 
35  for(unsigned int i=0; i < n; i++) //copying vector
36  {
37  //DBGMSG("get_param = %d\n",i);
38  param_[i] = func->param(i);
39  }
40 }
41 
42 template<class Type>
43 double FunctorCommon<Type>::param(unsigned int param_name)
44 {
45  ASSERT(param_name < param_.size(),"Parameter of the functor was not set.");
46 
47  return param_[param_name];
48 }
49 
50 
51 /************************************************ FunctorBase ************************************/
52 template<class Type>
54 
55 template<class Type>
57 
58 
59 /************************************************ IFunctorBase ***********************************/
60 template<class Type>
62 
63 template<class Type>
65 
66 
67 #endif //FUNCTORBASE_IMPL_H
void set_param(unsigned int param_name, double param_value)
Sets a functor&#39;s parameter.
std::vector< double > param_
Definition: functors.hh:54
Class provides common functionality for functors.
Definition: functors.hh:22
FunctorBase()
Constructor.
I/O functions with filename storing, able to track current line in opened file. All standard stdio fu...
IFunctorBase()
Constructor.
virtual ~FunctorBase()
Destructor.
#define ASSERT(...)
Definition: global_defs.h:121
FunctorCommon()
Constructor.
Definition: functors_impl.hh:9
virtual ~IFunctorBase()
Destructor.
void set_param_from_func(FunctorCommon< TType > *func)
Sets a functor&#39;s parameters from another functor.
virtual ~FunctorCommon()
Destructor.
double param(unsigned int param_name)
Returns parameter.