- // check default validator
- std::map<std::string, ModuleBase_Filter*>::const_iterator aDefaultVal = myIDs.find(kDefaultId);
- if(aDefaultVal != myIDs.end()) {
- static const std::list<std::string> anEmptyArgList;
- const ModelAPI_FeatureValidator* aFValidator =
- dynamic_cast<const ModelAPI_FeatureValidator*>(aDefaultVal->second);
- if (aFValidator) {
- if (!aFValidator->isValid(theFeature, anEmptyArgList))
- return false;
- }
- }
-
- // check all attributes for validity
- std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- // Validity of data is checked by "Model_FeatureValidator" (kDefaultId)
- // if (!aData || !aData->isValid())
- // return false;
- static const std::string kAllTypes = "";
- std::map<std::string, std::map<std::string, AttrValidators> >::const_iterator aFeatureIter =
- myAttrs.find(theFeature->getKind());
- if (aFeatureIter != myAttrs.cend()) {
- std::list<std::string> aLtAttributes = aData->attributesIDs(kAllTypes);
- std::list<std::string>::iterator anAttrIter = aLtAttributes.begin();
- for (; anAttrIter != aLtAttributes.end(); anAttrIter++) {
- std::map<std::string, AttrValidators>::const_iterator anAttr =
- aFeatureIter->second.find(*anAttrIter);
- if (anAttr != aFeatureIter->second.end()) {
- AttrValidators::const_iterator aValIter = anAttr->second.cbegin();
- for (; aValIter != anAttr->second.cend(); aValIter++) {
- std::map<std::string, ModuleBase_Filter*>::const_iterator aFound = myIDs.find(
- aValIter->first);
- if (aFound == myIDs.end()) {
- Events_Error::send(std::string("Validator ") + aValIter->first + " was not registered");
- } else {
- const ModelAPI_AttributeValidator* anAttrValidator =
- dynamic_cast<const ModelAPI_AttributeValidator*>(aFound->second);
- if (anAttrValidator) {
- AttributePtr anAttribute = theFeature->data()->attribute(*anAttrIter);
- if (!anAttrValidator->isValid(anAttribute, aValIter->second)) {
- return false;
- }
- }
- }
- }
- }
- }
- }
- */
- return true;
-}
-
-void ModuleBase_FilterFactory::registerNotObligatory(std::string theFeature, std::string theAttribute)
-{
-/* const static std::string kDefaultId = "Model_FeatureValidator";
- std::map<std::string, ModuleBase_Filter*>::const_iterator it = myIDs.find(kDefaultId);
- if (it != myIDs.end()) {
- Model_FeatureValidator* aValidator = dynamic_cast<Model_FeatureValidator*>(it->second);
- if (aValidator) {
- aValidator->registerNotObligatory(theFeature, theAttribute);
- }
- }*/
-}
-
-bool ModuleBase_FilterFactory::isNotObligatory(std::string theFeature, std::string theAttribute)
-{
-/* const static std::string kDefaultId = "Model_FeatureValidator";
- std::map<std::string, ModuleBase_Filter*>::const_iterator it = myIDs.find(kDefaultId);
- if (it != myIDs.end()) {
- Model_FeatureValidator* aValidator = dynamic_cast<Model_FeatureValidator*>(it->second);
- if (aValidator) {
- return aValidator->isNotObligatory(theFeature, theAttribute);
- }
- }*/
- return false; // default
-}
-
-void ModuleBase_FilterFactory::registerConcealment(std::string theFeature, std::string theAttribute)
-{
-/* std::map<std::string, std::set<std::string> >::iterator aFind = myConcealed.find(theFeature);
- if (aFind == myConcealed.end()) {
- std::set<std::string> aNewSet;
- aNewSet.insert(theAttribute);
- myConcealed[theFeature] = aNewSet;
- } else {
- aFind->second.insert(theAttribute);
- }*/
-}
-
-bool ModuleBase_FilterFactory::isConcealed(std::string theFeature, std::string theAttribute)
-{
- /*std::map<std::string, std::set<std::string> >::iterator aFind = myConcealed.find(theFeature);
- return aFind != myConcealed.end() && aFind->second.find(theAttribute) != aFind->second.end();*/
- return true;