Guest User

Untitled

a guest
Jul 17th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #ifndef EVALUATOR_H_
  2. #define EVALUATOR_H_
  3. #include "Expression.h"
  4. #include "ValueModel.h"
  5. #include <vector>
  6.  
  7. namespace core {
  8.  
  9. template<class T> class Evaluator
  10. {
  11. public:
  12. typedef std::pair <std::vector<T>, std::vector<T>> Shape;
  13.  
  14. static Shape BuildShape (const T&, const T&, const T&, ValueModel<T>*, Expression<T>*);
  15. };
  16.  
  17. template<class T>
  18. typename Evaluator<T>::Shape Evaluator<T>::BuildShape (const T& min, const T& max, const T& step, ValueModel<T>* v, Expression<T>* e)
  19. {
  20. std::vector<T> x,y;
  21. for (T i=min; i <= max; i+= step)
  22. {
  23. v->setValue(i);
  24. x.push_back(i);
  25. y.push_back(e->evaluate());
  26. }
  27.  
  28. return Shape(x,y);
  29. }
  30. }
  31.  
  32. #endif
Add Comment
Please, Sign In to add comment