Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SofaCore] Add virtual getPathName function in Base #1455

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions SofaKernel/modules/SofaCore/src/sofa/core/objectmodel/Base.h
Expand Up @@ -180,6 +180,9 @@ class SOFA_CORE_API Base
std::initializer_list<BaseData*> outputs);
void addOutputsToCallback(const std::string& name, std::initializer_list<BaseData*> outputs);


virtual std::string getPathName() const { return ""; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ugly, I don't like it much but I can't put a virtual pure here since BaseContext also inherits Base, which means more than 1 final overrider for Node (inherits BaseNode & BaseContext...)


/// Accessor to the object name
const std::string& getName() const
{
Expand Down
Expand Up @@ -224,7 +224,7 @@ class SOFA_CORE_API BaseData : public DDGNode
/// @}

/// If we use the Data as a link and not as value directly
std::string getLinkPath() const { return parentBaseData.getPath(); }
virtual std::string getLinkPath() const { return parentBaseData.getPath(); }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with the PR, but I need this to be overridable for custom Data in SofaQtQuick

/// Return whether this %Data can be used as a linkPath.
///
/// True by default.
Expand Down
Expand Up @@ -131,7 +131,7 @@ class SOFA_CORE_API BaseNode : public virtual Base
virtual const BaseContext* getContext() const = 0;

/// Return the full path name of this node
virtual std::string getPathName() const;
virtual std::string getPathName() const override;

/// Return the path from this node to the root node
virtual std::string getRootPath() const;
Expand Down
Expand Up @@ -439,7 +439,7 @@ class SOFA_CORE_API BaseObject : public virtual Base


/// Return the full path name of this object
virtual std::string getPathName() const;
virtual std::string getPathName() const override;

/// @name internalupdate
/// Methods related to tracking of data and the internal update
Expand Down