return _internal->_context;
}
+std::string AdaoExchangeLayer::printContext() const
+{
+ AutoGIL agil;
+ PyObject *obj(this->getPythonContext());
+ if(!PyDict_Check(obj))
+ throw AdaoExchangeLayerException("printContext : not a dict !");
+ PyObject *key(nullptr), *value(nullptr);
+ Py_ssize_t pos(0);
+ std::ostringstream oss;
+ while( PyDict_Next(obj, &pos, &key, &value) )
+ {
+ if(!PyUnicode_Check(key))
+ throw AdaoExchangeLayerException("printContext : not a string as key !");
+ oss << PyUnicode_AsUTF8(key) << " = ";
+ PyObjectRAII reprOfValue(PyObjectRAII::FromNew(PyObject_Repr(value)));
+ oss << PyUnicode_AsUTF8(reprOfValue);
+ oss << std::endl;
+ }
+ return oss.str();
+}
+
/*!
* AdaoExchangeLayer is based on multithreaded paradigm.
* Master thread (thread calling this method) and slave thread (thread calling ADAO algo)
#include "Python.h"
+#include <string>
+
class AdaoCallbackSt;
namespace AdaoModel
AdaoExchangeLayer();
~AdaoExchangeLayer();
PyObject *getPythonContext() const;
+ std::string printContext() const;
void init();
void loadTemplate(AdaoModel::MainModel *model);
void execute();
ObservationOperator::ObservationOperator():DictKeyVal(KEY)
{
std::shared_ptr<OneFunction> v0(std::make_shared<OneFunction>());
- std::shared_ptr<ObservationOperatorParameters> v1(std::make_shared<ObservationOperatorParameters>());
- std::shared_ptr<InputFunctionAsMulti> v2(std::make_shared<InputFunctionAsMulti>());
+ std::shared_ptr<MatrixBackgroundError> v1(std::make_shared<MatrixBackgroundError>());
+ std::shared_ptr<ObservationOperatorParameters> v2(std::make_shared<ObservationOperatorParameters>());
+ std::shared_ptr<InputFunctionAsMulti> v3(std::make_shared<InputFunctionAsMulti>());
_pairs.push_back(std::static_pointer_cast<GenericKeyVal,OneFunction>(v0));
- _pairs.push_back(std::static_pointer_cast<GenericKeyVal,ObservationOperatorParameters>(v1));
- _pairs.push_back(std::static_pointer_cast<GenericKeyVal,InputFunctionAsMulti>(v2));
+ _pairs.push_back(std::static_pointer_cast<GenericKeyVal,MatrixBackgroundError>(v1));
+ _pairs.push_back(std::static_pointer_cast<GenericKeyVal,ObservationOperatorParameters>(v2));
+ _pairs.push_back(std::static_pointer_cast<GenericKeyVal,InputFunctionAsMulti>(v3));
}
ObserverEntry::ObserverEntry():DictKeyVal(KEY)