From: mpv Date: Mon, 10 Nov 2014 14:22:20 +0000 (+0300) Subject: Make default validator initializer not global: to be initialized when it is needed X-Git-Tag: V_0.5~6^2~4^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f00fc09bceb084c9cc79eb28cf037b16a6aba931;p=modules%2Fshaper.git Make default validator initializer not global: to be initialized when it is needed --- diff --git a/src/Model/Model_Validator.cpp b/src/Model/Model_Validator.cpp index 9db3a3cba..e7750131e 100644 --- a/src/Model/Model_Validator.cpp +++ b/src/Model/Model_Validator.cpp @@ -10,8 +10,6 @@ #include #include -const static std::string kDefaultId = "Model_FeatureValidator"; - void Model_ValidatorsFactory::registerValidator(const std::string& theID, ModelAPI_Validator* theValidator) { @@ -121,6 +119,7 @@ void Model_ValidatorsFactory::validators(const std::string& theFeatureID, Model_ValidatorsFactory::Model_ValidatorsFactory() : ModelAPI_ValidatorsFactory() { + const static std::string kDefaultId = "Model_FeatureValidator"; registerValidator(kDefaultId, new Model_FeatureValidator); } @@ -135,6 +134,7 @@ const ModelAPI_Validator* Model_ValidatorsFactory::validator(const std::string& void Model_ValidatorsFactory::addDefaultValidators(std::list& theValidators) const { + const static std::string kDefaultId = "Model_FeatureValidator"; std::map::const_iterator it = myIDs.find(kDefaultId); if(it == myIDs.end()) return; @@ -143,6 +143,7 @@ void Model_ValidatorsFactory::addDefaultValidators(std::list& theFeature) const { + const static std::string kDefaultId = "Model_FeatureValidator"; // check feature validators first std::map::const_iterator aFeature = myFeatures.find(theFeature->getKind()); @@ -213,6 +214,7 @@ bool Model_ValidatorsFactory::validate(const boost::shared_ptr void Model_ValidatorsFactory::registerNotObligatory(std::string theFeature, std::string theAttribute) { + const static std::string kDefaultId = "Model_FeatureValidator"; std::map::const_iterator it = myIDs.find(kDefaultId); if (it != myIDs.end()) { Model_FeatureValidator* aValidator = dynamic_cast(it->second);