~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/common_cpp/API/OutputBase-inl.hh

  • Committer: Christopher Hunt
  • Date: 2015-06-18 14:48:59 UTC
  • mfrom: (697.69.1 merge)
  • mto: (697.69.2 merge_hunt)
  • mto: This revision was merged to the branch mainline in revision 708.
  • Revision ID: christopher.hunt08@imperial.ac.uk-20150618144859-rki5ma1lv8722w41
Merged in latest trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "src/common_cpp/Utils/CppErrorHandler.hh"
24
24
 
25
25
namespace MAUS {
26
 
 
27
 
 
28
 
  template <typename T>
29
 
  OutputBase<T>::OutputBase(const std::string& s) : IOutput<T>(), ModuleBase(s) {}
30
 
 
31
 
  template <typename T>
32
 
  OutputBase<T>::OutputBase(const OutputBase& ob) : IOutput<T>(), ModuleBase(ob._classname) {}
33
 
 
34
 
  template <typename T>
35
 
  OutputBase<T>::~OutputBase() {}
36
 
 
37
 
  template <typename T>
38
 
  bool OutputBase<T>::save(T t) {
 
26
  OutputBase::OutputBase(const std::string& s) : ModuleBase(s) {}
 
27
 
 
28
  OutputBase::OutputBase(const OutputBase& ob) : ModuleBase(ob._classname) {}
 
29
 
 
30
  OutputBase::~OutputBase() {}
 
31
 
 
32
  PyObject* OutputBase::save_pyobj(PyObject* data_in) {
39
33
    bool ret = false;
40
34
    try {
41
 
      ret = _save(t);
 
35
      ret = _save(data_in);
42
36
    }
43
37
    catch (std::exception& e) {
 
38
      std::cerr << e.what() << std::endl;
44
39
      CppErrorHandler::getInstance()->HandleStdExcNoJson(e, _classname);
45
40
    }
46
41
    catch (...) {
47
42
      throw UnhandledException(_classname);
48
43
    }
49
 
    return ret;
 
44
    if (ret) {
 
45
        PyObject* py_true_ = reinterpret_cast<PyObject*>(Py_True);
 
46
        Py_INCREF(py_true_);
 
47
        return py_true_;
 
48
    } else {
 
49
        PyObject* py_false_ = reinterpret_cast<PyObject*>(Py_False);
 
50
        Py_INCREF(py_false_);
 
51
        return py_false_;
 
52
    }
50
53
  }
51
54
 
52
55
}// end of namespace