std::string Model_Data::name()
{
Handle(TDataStd_Name) aName;
- if (myLab.FindAttribute(TDataStd_Name::GetID(), aName))
+ if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
+#ifdef DEBUG_NAMES
+ myObject->myName = TCollection_AsciiString(aName->Get()).ToCString();
+#endif
return std::string(TCollection_AsciiString(aName->Get()).ToCString());
+ }
return ""; // not defined
}
std::dynamic_pointer_cast<Model_Document>(myObject->document())->
changeNamingName(anOldName, theName);
}
+#ifdef DEBUG_NAMES
+ myObject->myName = theName;
+#endif
}
AttributePtr Model_Data::addAttribute(const std::string& theID, const std::string theAttrType)
class ModelAPI_Data;
class ModelAPI_Document;
+// sometimes it is usefull for debug to see name of each object (bad for memory and performance)
+//#define DEBUG_NAMES
+
/**\class ModelAPI_Object
* \ingroup DataModel
* \brief Represents any object in the data model and in the object browser.
std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
std::shared_ptr<ModelAPI_Document> myDoc; ///< document this object belongs to
public:
+#ifdef DEBUG_NAMES
+ std::string myName; // name of this object
+#endif
/// By default object is displayed in the object browser.
MODELAPI_EXPORT virtual bool isInHistory();