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