Removed a redundant field in RN_NODE class.
This commit is contained in:
parent
e86351b1b0
commit
aadcd93ab5
|
@ -106,9 +106,6 @@ protected:
|
||||||
/// Tag for quick connection resolution
|
/// Tag for quick connection resolution
|
||||||
int m_tag;
|
int m_tag;
|
||||||
|
|
||||||
/// Reference count
|
|
||||||
unsigned int m_refCount;
|
|
||||||
|
|
||||||
/// List of board items that share this node
|
/// List of board items that share this node
|
||||||
std::list<const BOARD_CONNECTED_ITEM*> m_parents;
|
std::list<const BOARD_CONNECTED_ITEM*> m_parents;
|
||||||
|
|
||||||
|
@ -127,7 +124,7 @@ public:
|
||||||
#ifdef TTL_USE_NODE_ID
|
#ifdef TTL_USE_NODE_ID
|
||||||
m_id( id_count++ ),
|
m_id( id_count++ ),
|
||||||
#endif
|
#endif
|
||||||
m_x( aX ), m_y( aY ), m_tag( -1 ), m_refCount( 0 )
|
m_x( aX ), m_y( aY ), m_tag( -1 )
|
||||||
{
|
{
|
||||||
m_layers.reset();
|
m_layers.reset();
|
||||||
}
|
}
|
||||||
|
@ -181,19 +178,9 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline void IncRefCount()
|
|
||||||
{
|
|
||||||
m_refCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void DecRefCount()
|
|
||||||
{
|
|
||||||
m_refCount--;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline unsigned int GetRefCount() const
|
inline unsigned int GetRefCount() const
|
||||||
{
|
{
|
||||||
return m_refCount;
|
return m_parents.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void AddParent( const BOARD_CONNECTED_ITEM* aParent )
|
inline void AddParent( const BOARD_CONNECTED_ITEM* aParent )
|
||||||
|
|
|
@ -255,7 +255,6 @@ const RN_NODE_PTR& RN_LINKS::AddNode( int aX, int aY )
|
||||||
bool wasNewElement;
|
bool wasNewElement;
|
||||||
|
|
||||||
boost::tie( node, wasNewElement ) = m_nodes.emplace( boost::make_shared<RN_NODE>( aX, aY ) );
|
boost::tie( node, wasNewElement ) = m_nodes.emplace( boost::make_shared<RN_NODE>( aX, aY ) );
|
||||||
(*node)->IncRefCount(); // TODO use the shared_ptr use_count
|
|
||||||
|
|
||||||
return *node;
|
return *node;
|
||||||
}
|
}
|
||||||
|
@ -263,8 +262,6 @@ const RN_NODE_PTR& RN_LINKS::AddNode( int aX, int aY )
|
||||||
|
|
||||||
bool RN_LINKS::RemoveNode( const RN_NODE_PTR& aNode )
|
bool RN_LINKS::RemoveNode( const RN_NODE_PTR& aNode )
|
||||||
{
|
{
|
||||||
aNode->DecRefCount(); // TODO use the shared_ptr use_count
|
|
||||||
|
|
||||||
if( aNode->GetRefCount() == 0 )
|
if( aNode->GetRefCount() == 0 )
|
||||||
{
|
{
|
||||||
m_nodes.erase( aNode );
|
m_nodes.erase( aNode );
|
||||||
|
|
Loading…
Reference in New Issue