Skip to content

Commit

Permalink
Plug : Inline direction() and node()
Browse files Browse the repository at this point in the history
This produces the following reductions in runtime :

- ValuePlugTest.testCacheOverhead : 5%
- ValuePlugTest.testContentionForOneItem : 1%
  • Loading branch information
johnhaddon committed Jul 11, 2023
1 parent c0e27a0 commit 4e7f400
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
18 changes: 17 additions & 1 deletion include/Gaffer/Plug.inl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,26 @@

#pragma once

#include "Gaffer/Node.h"

namespace Gaffer
{

inline Node *Plug::node()
{
return ancestor<Node>();
}

inline const Node *Plug::node() const
{
return ancestor<Node>();
}

inline Plug::Direction Plug::direction() const
{
return m_direction;
}

template<typename T>
T *Plug::getInput()
{
Expand All @@ -52,7 +69,6 @@ const T *Plug::getInput() const
return IECore::runTimeCast<const T>( m_input );
}


template<typename T>
T *Plug::source()
{
Expand Down
15 changes: 0 additions & 15 deletions src/Gaffer/Plug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,6 @@ bool Plug::acceptsParent( const GraphComponent *potentialParent ) const
return potentialParent->isInstanceOf( (IECore::TypeId)NodeTypeId ) || potentialParent->isInstanceOf( Plug::staticTypeId() );
}

Node *Plug::node()
{
return ancestor<Node>();
}

const Node *Plug::node() const
{
return ancestor<Node>();
}

Plug::Direction Plug::direction() const
{
return m_direction;
}

unsigned Plug::getFlags() const
{
return m_flags;
Expand Down

0 comments on commit 4e7f400

Please sign in to comment.