1 // File: Model_FeatureValidator.cpp
3 // Author: Vitaly SMETANNIKOV
5 #include <Model_FeatureValidator.h>
6 #include <ModelAPI_Attribute.h>
7 #include <ModelAPI_Data.h>
8 #include <ModelAPI_Feature.h>
9 #include <ModelAPI_Object.h>
12 #include <boost/shared_ptr.hpp>
14 bool Model_FeatureValidator::isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature,
15 const std::list<std::string>& theArguments) const
17 boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
20 if (!aData->isValid())
22 const std::string kAllTypes = "";
23 std::list<std::string> aLtAttributes = aData->attributesIDs(kAllTypes);
24 std::list<std::string>::iterator it = aLtAttributes.begin();
25 for (; it != aLtAttributes.end(); it++) {
26 AttributePtr anAttr = aData->attribute(*it);
27 if (!anAttr->isInitialized()) {
28 std::map<std::string, std::set<std::string> >::const_iterator aFeatureFind =
29 myNotObligatory.find(theFeature->getKind());
30 if (aFeatureFind == myNotObligatory.end() ||
31 aFeatureFind->second.find(*it) == aFeatureFind->second.end()) {
39 void Model_FeatureValidator::registerNotObligatory(std::string theFeature, std::string theAttribute)
41 std::set<std::string>& anAttrs = myNotObligatory[theFeature];
42 anAttrs.insert(theAttribute);