Skip to content
Snippets Groups Projects
Commit 87da4377 authored by Marco Biasini's avatar Marco Biasini
Browse files

print diagnostics when running process

parent fdff0243
Branches
Tags
No related merge requests found
...@@ -67,7 +67,8 @@ void export_processor() { ...@@ -67,7 +67,8 @@ void export_processor() {
&Processor::SetUnkResidueTreatment) &Processor::SetUnkResidueTreatment)
.add_property("unk_atom_treatment", &Processor::GetUnkAtomTreatment, .add_property("unk_atom_treatment", &Processor::GetUnkAtomTreatment,
&Processor::SetUnkAtomTreatment) &Processor::SetUnkAtomTreatment)
.def("Process", &Processor::Process) .def("Process", &Processor::Process,
(arg("ent"), arg("log_diags")=true))
; ;
class_<PyProcessor, boost::noncopyable, class_<PyProcessor, boost::noncopyable,
boost::shared_ptr<WrappedProcessor>, boost::shared_ptr<WrappedProcessor>,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
// along with this library; if not, write to the Free Software Foundation, Inc., // along with this library; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#include <ost/log.hh>
#include <ost/mol/xcs_editor.hh> #include <ost/mol/xcs_editor.hh>
#include <ost/mol/bond_handle.hh> #include <ost/mol/bond_handle.hh>
#include <ost/mol/torsion_handle.hh> #include <ost/mol/torsion_handle.hh>
...@@ -23,7 +24,8 @@ ...@@ -23,7 +24,8 @@
namespace ost { namespace conop { namespace ost { namespace conop {
DiagnosticsPtr Processor::Process(mol::EntityHandle ent) const DiagnosticsPtr Processor::Process(mol::EntityHandle ent,
bool log_diags) const
{ {
DiagnosticsPtr diags(new Diagnostics); DiagnosticsPtr diags(new Diagnostics);
if (!this->BeginProcessing(diags, ent)) { if (!this->BeginProcessing(diags, ent)) {
...@@ -32,6 +34,12 @@ DiagnosticsPtr Processor::Process(mol::EntityHandle ent) const ...@@ -32,6 +34,12 @@ DiagnosticsPtr Processor::Process(mol::EntityHandle ent) const
this->DoProcess(diags, ent); this->DoProcess(diags, ent);
this->EndProcessing(diags, ent); this->EndProcessing(diags, ent);
if (log_diags) {
for (Diagnostics::diag_iterator i = diags->diags_begin(),
e = diags->diags_end(); i != e; ++i) {
LOG_WARNING((*i)->Format(false));
}
}
return diags; return diags;
} }
......
...@@ -44,7 +44,7 @@ typedef boost::shared_ptr<Processor> ProcessorPtr; ...@@ -44,7 +44,7 @@ typedef boost::shared_ptr<Processor> ProcessorPtr;
// the base class for all options // the base class for all options
class DLLEXPORT_OST_CONOP Processor { class DLLEXPORT_OST_CONOP Processor {
public: public:
DiagnosticsPtr Process(mol::EntityHandle ent) const; DiagnosticsPtr Process(mol::EntityHandle ent, bool log_diags=true) const;
virtual ProcessorPtr Copy() const = 0; virtual ProcessorPtr Copy() const = 0;
protected: protected:
virtual void DoProcess(DiagnosticsPtr diags, virtual void DoProcess(DiagnosticsPtr diags,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment