Renamed caf::PdmXmlObjectHandle::isOfClassKeyword to ::inheritsClassWithKeyword

This commit is contained in:
Gaute Lindkvist 2019-10-09 09:26:30 +02:00
parent 11117383db
commit 2961782be1
4 changed files with 12 additions and 9 deletions

View File

@ -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) {}

View File

@ -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<PdmObject*>(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<PdmObject*>& descendants) const
{
if (this->isOfClassKeywordType(classKeyword))
if (this->inheritsClassWithKeyword(classKeyword))
{
descendants.push_back(const_cast<PdmObject*>(this));
}

View File

@ -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();
}
//--------------------------------------------------------------------------------------------------

View File

@ -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<QString> m_classHierarchy;
std::list<QString> m_classInheritanceStack;
PdmObjectHandle* m_owner;
};