Added Path::contains(Instance*) method.

This commit is contained in:
Jean-Paul Chaput 2021-01-27 10:57:35 +01:00
parent 087ef239c2
commit 88081fae12
2 changed files with 13 additions and 6 deletions

View File

@ -233,6 +233,17 @@ bool Path::isEmpty() const
return (_sharedPath == NULL);
}
int32_t Path::contains(Instance* element) const
// ********************************************
{
int32_t depth = 0;
for ( Instance* instance : getInstances() ) {
if (instance == element) return depth;
++depth;
}
return -1;
}
void Path::makeEmpty()
// *******************
{

View File

@ -17,9 +17,7 @@
// not, see <http://www.gnu.org/licenses/>.
// ****************************************************************************************************
#ifndef HURRICANE_PATH
#define HURRICANE_PATH
#pragma once
#include "hurricane/Instances.h"
#include "hurricane/Transformation.h"
@ -87,6 +85,7 @@ class Path {
// **********
public: bool isEmpty() const;
public: int32_t contains(Instance*) const;
// Updators
// ********
@ -115,9 +114,6 @@ class Path {
INSPECTOR_PR_SUPPORT(Hurricane::Path);
#endif // HURRICANE_PATH
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2018, All Rights Reserved
// ****************************************************************************************************