Elements  6.2
A C++ base framework for the Euclid Software.
callBackExample.cpp
Go to the documentation of this file.
1 
22 #include <functional> // for function
23 #include <vector> // for vector
24 
25 #include "ElementsKernel/Logging.h" // for Logging
26 
28 
29 using std::vector;
30 
31 namespace Elements {
32 namespace Examples {
33 
34 double testCallBack(vector<double> x, const std::function<double(vector<double>)>& fun) {
35 
36  auto log = Logging::getLogger("ElementsExamples");
37 
38  log.info() << "Calling the Python function from C++";
39 
40  double f = fun(x);
41 
42  log.info() << "The value of the function is " << f;
43 
44  log.info() << "Returning the result";
45 
46  return (f);
47 }
48 
49 } // namespace Examples
50 } // namespace Elements
std::vector
STL class.
std::function
callBackExample.h
Elements::Examples::log
auto log
Definition: BackTrace.cpp:36
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Definition: Logging.cpp:63
Elements::Examples::testCallBack
ELEMENTS_API double testCallBack(std::vector< double > x, const std::function< double(std::vector< double >)> &fun)
Definition: callBackExample.cpp:34
Logging.h
Logging facility.
Elements
Definition: callBackExample.h:35