From: eap Date: Tue, 18 Dec 2012 12:09:55 +0000 (+0000) Subject: 22016: [CEA 740] BLSURF is verbose even with SetVerbosity (0) X-Git-Tag: V6_main_FINAL~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8e184e2f651831e9ba1d7c392737ce50d786600f;p=plugins%2Fblsurfplugin.git 22016: [CEA 740] BLSURF is verbose even with SetVerbosity (0) --- diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 455ef94..9420b16 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -867,7 +867,8 @@ void BLSURFPlugin_BLSURF::SetParameters( cadsurf_set_param(css, "verbose", to_string(_verb).c_str()); _smp_phy_size = _phySizeRel ? _phySize*diagonal : _phySize; - std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl; + if ( _verb > 0 ) + std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl; if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize){ TopoDS_Shape GeomShape; @@ -1488,6 +1489,15 @@ namespace } }; + /*! + * \brief A structure holding an error description and a verbisity level + */ + struct message_cb_user_data + { + std::string * _error; + int _verbosity; + }; + } // namespace @@ -1590,13 +1600,15 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, context_t *ctx = context_new(); /* Set the message callback in the working context */ - context_set_message_callback(ctx, message_cb, &_comment); -#ifdef WITH_SMESH_CANCEL_COMPUTE + message_cb_user_data mcud; + mcud._error = & this->SMESH_Algo::_comment; + mcud._verbosity = + _hypothesis ? _hypothesis->GetVerbosity() : BLSURFPlugin_Hypothesis::GetDefaultVerbosity(); + context_set_message_callback(ctx, message_cb, &mcud); + + /* set the interruption callback */ _compute_canceled = false; context_set_interrupt_callback(ctx, interrupt_cb, this); -#else - context_set_interrupt_callback(ctx, interrupt_cb, NULL); -#endif /* create the CAD object we will work on. It is associated to the context ctx. */ cad_t *c = cad_new(ctx); @@ -2758,18 +2770,16 @@ status_t message_cb(message_t *msg, void *user_data) message_get_number(msg, &errnumber); message_get_description(msg, &desc); string err( desc ); + message_cb_user_data * mcud = (message_cb_user_data*)user_data; if ( errnumber < 0 || err.find("license") != string::npos ) { - string * error = (string*)user_data; -// if ( !error->empty() ) -// *error += "\n"; // remove ^A from the tail int len = strlen( desc ); while (len > 0 && desc[len-1] != '\n') len--; - error->append( desc, len ); + mcud->_error->append( desc, len ); } - else { - std::cout << desc << std::endl; + else if ( mcud->_verbosity > 0 ) { + std::cout << desc << std::endl; } return STATUS_OK; }