From 2961782be1b7730008433510c350b53d8d10eeee Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Wed, 9 Oct 2019 09:26:30 +0200 Subject: [PATCH] Renamed caf::PdmXmlObjectHandle::isOfClassKeyword to ::inheritsClassWithKeyword --- ApplicationCode/GrpcInterface/GrpcProtos/Commands.proto | 5 ++++- Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp | 6 +++--- .../cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp | 6 +++--- .../cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ApplicationCode/GrpcInterface/GrpcProtos/Commands.proto b/ApplicationCode/GrpcInterface/GrpcProtos/Commands.proto index f38380c920..a75b15a6e5 100644 --- a/ApplicationCode/GrpcInterface/GrpcProtos/Commands.proto +++ b/ApplicationCode/GrpcInterface/GrpcProtos/Commands.proto @@ -8,7 +8,10 @@ package rips; /* * The Commands service handles generic ResInsight RicfCommandObject-commands * The CommandParams is used to deduce command name from the chosen oneof-message - * .. and the parameters are in the oneof-message itself. */ + * .. and the parameters are in the oneof-message itself. + * Note that we several times duplicate nearly the same message. This is because + * it is not recommended to reuse existing messages for different purposes. + */ service Commands { rpc Execute(CommandParams) returns(CommandReply) {} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp index 2f22539c3c..a04104bfda 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp @@ -11,7 +11,7 @@ void PdmObject::firstAncestorOrThisFromClassKeyword( ancestor = nullptr; // Check if this matches the type - if (this->classKeyword() == classKeyword) + if (this->inheritsClassWithKeyword(classKeyword)) { ancestor = const_cast(this); return; @@ -25,7 +25,7 @@ void PdmObject::firstAncestorOrThisFromClassKeyword( while (parent != nullptr) { - if (parent->isOfClassKeywordType(classKeyword)) + if (parent->inheritsClassWithKeyword(classKeyword)) { ancestor = parent; return; @@ -51,7 +51,7 @@ void PdmObject::descendantsIncludingThisFromClassKeyword( const QString& classKeyword, std::vector& descendants) const { - if (this->isOfClassKeywordType(classKeyword)) + if (this->inheritsClassWithKeyword(classKeyword)) { descendants.push_back(const_cast(this)); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp index f8f11a9773..bde704a5bd 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp @@ -277,15 +277,15 @@ bool PdmXmlObjectHandle::isValidXmlElementName(const QString& name) //-------------------------------------------------------------------------------------------------- void PdmXmlObjectHandle::registerClassKeyword(const QString& registerKeyword) { - m_classHierarchy.push_back(registerKeyword); + m_classInheritanceStack.push_back(registerKeyword); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool PdmXmlObjectHandle::isOfClassKeywordType(const QString& testClassKeyword) const +bool PdmXmlObjectHandle::inheritsClassWithKeyword(const QString& testClassKeyword) const { - return std::find(m_classHierarchy.begin(), m_classHierarchy.end(), testClassKeyword) != m_classHierarchy.end(); + return std::find(m_classInheritanceStack.begin(), m_classInheritanceStack.end(), testClassKeyword) != m_classInheritanceStack.end(); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h index 5ac398520f..3135a2f3d1 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.h @@ -71,7 +71,7 @@ protected: // Virtual bool isInheritedFromPdmXmlSerializable() { return true; } void registerClassKeyword(const QString& registerKeyword); - bool isOfClassKeywordType(const QString& testClassKeyword) const; + bool inheritsClassWithKeyword(const QString& testClassKeyword) const; private: void initAfterReadRecursively(PdmObjectHandle* object); @@ -81,7 +81,7 @@ private: private: friend class PdmObjectHandle ; // Only temporary for void PdmObject::addFieldNoDefault( ) accessing findField - std::list m_classHierarchy; + std::list m_classInheritanceStack; PdmObjectHandle* m_owner; };