KiCad PCB EDA Suite
hed::NODE Class Reference

Node class for data structures (Inherits from HandleId) More...

#include <hetriang.h>

Public Member Functions

 NODE (int aX=0, int aY=0)
 Constructor. More...
 
 ~NODE ()
 Destructor. More...
 
int GetX () const
 Returns the x-coordinate. More...
 
int GetY () const
 Returns the y-coordinate. More...
 
int GetTag () const
 Returns tag, common identifier for connected nodes. More...
 
void SetTag (int aTag)
 Sets tag, common identifier for connected nodes. More...
 
void SetNoLine (bool aEnable)
 Decides whether this node can be a ratsnest line target. More...
 
const bool & GetNoLine () const
 Returns true if this node can be a target for ratsnest lines. More...
 
unsigned int GetRefCount () const
 
void AddParent (const BOARD_CONNECTED_ITEM *aParent)
 
void RemoveParent (const BOARD_CONNECTED_ITEM *aParent)
 
const LSETGetLayers ()
 

Static Public Attributes

static const int TAG_UNCONNECTED = -1
 

Protected Member Functions

void updateLayers ()
 Recomputes the layers used by this node. More...
 

Protected Attributes

const int m_x
 Node coordinates. More...
 
const int m_y
 
int m_tag
 Tag for quick connection resolution. More...
 
bool m_noline
 Whether it the node can be a target for ratsnest lines. More...
 
std::unordered_set< const BOARD_CONNECTED_ITEM * > m_parents
 List of board items that share this node. More...
 
LSET m_layers
 Layers that are occupied by this node. More...
 

Detailed Description

Node class for data structures (Inherits from HandleId)

Note
  • To enable node IDs, TTL_USE_NODE_ID must be defined.
  • To enable node flags, TTL_USE_NODE_FLAG must be defined.
  • TTL_USE_NODE_ID and TTL_USE_NODE_FLAG should only be enabled if this functionality is required by the application, because they increase the memory usage for each Node object.

Definition at line 87 of file hetriang.h.

Constructor & Destructor Documentation

hed::NODE::NODE ( int  aX = 0,
int  aY = 0 
)
inline

Constructor.

Definition at line 123 of file hetriang.h.

123  :
124 #ifdef TTL_USE_NODE_FLAG
125  m_flag( false ),
126 #endif
127 #ifdef TTL_USE_NODE_ID
128  m_id( id_count++ ),
129 #endif
130  m_x( aX ), m_y( aY ), m_tag( -1 ), m_noline( false )
131  {
132  m_layers.reset();
133  }
int m_tag
Tag for quick connection resolution.
Definition: hetriang.h:107
LSET m_layers
Layers that are occupied by this node.
Definition: hetriang.h:116
const int m_y
Definition: hetriang.h:104
const int m_x
Node coordinates.
Definition: hetriang.h:104
bool m_noline
Whether it the node can be a target for ratsnest lines.
Definition: hetriang.h:110
hed::NODE::~NODE ( )
inline

Destructor.

Definition at line 136 of file hetriang.h.

136 {}

Member Function Documentation

void hed::NODE::AddParent ( const BOARD_CONNECTED_ITEM aParent)
inline

Definition at line 201 of file hetriang.h.

202  {
203  m_parents.insert( aParent );
204  m_layers.reset(); // mark as needs updating
205  }
std::unordered_set< const BOARD_CONNECTED_ITEM * > m_parents
List of board items that share this node.
Definition: hetriang.h:113
LSET m_layers
Layers that are occupied by this node.
Definition: hetriang.h:116
const LSET& hed::NODE::GetLayers ( )
inline

Definition at line 218 of file hetriang.h.

References m_layers, and updateLayers().

219  {
220  if( m_layers.none() )
221  updateLayers();
222 
223  return m_layers;
224  }
void updateLayers()
Recomputes the layers used by this node.
Definition: hetriang.cpp:58
LSET m_layers
Layers that are occupied by this node.
Definition: hetriang.h:116
const bool& hed::NODE::GetNoLine ( ) const
inline

Returns true if this node can be a target for ratsnest lines.

Definition at line 169 of file hetriang.h.

References m_noline.

170  {
171  return m_noline;
172  }
bool m_noline
Whether it the node can be a target for ratsnest lines.
Definition: hetriang.h:110
unsigned int hed::NODE::GetRefCount ( ) const
inline

Definition at line 196 of file hetriang.h.

197  {
198  return m_parents.size();
199  }
std::unordered_set< const BOARD_CONNECTED_ITEM * > m_parents
List of board items that share this node.
Definition: hetriang.h:113
int hed::NODE::GetTag ( ) const
inline

Returns tag, common identifier for connected nodes.

Definition at line 151 of file hetriang.h.

References m_tag.

152  {
153  return m_tag;
154  }
int m_tag
Tag for quick connection resolution.
Definition: hetriang.h:107
int hed::NODE::GetX ( ) const
inline

Returns the x-coordinate.

Definition at line 139 of file hetriang.h.

References m_x.

140  {
141  return m_x;
142  }
const int m_x
Node coordinates.
Definition: hetriang.h:104
int hed::NODE::GetY ( ) const
inline

Returns the y-coordinate.

Definition at line 145 of file hetriang.h.

References m_y.

146  {
147  return m_y;
148  }
const int m_y
Definition: hetriang.h:104
void hed::NODE::RemoveParent ( const BOARD_CONNECTED_ITEM aParent)
inline

Definition at line 207 of file hetriang.h.

208  {
209  auto it = m_parents.find( aParent );
210 
211  if( it != m_parents.end() )
212  {
213  m_parents.erase( it );
214  m_layers.reset(); // mark as needs updating
215  }
216  }
std::unordered_set< const BOARD_CONNECTED_ITEM * > m_parents
List of board items that share this node.
Definition: hetriang.h:113
LSET m_layers
Layers that are occupied by this node.
Definition: hetriang.h:116
void hed::NODE::SetNoLine ( bool  aEnable)
inline

Decides whether this node can be a ratsnest line target.

Definition at line 163 of file hetriang.h.

164  {
165  m_noline = aEnable;
166  }
bool m_noline
Whether it the node can be a target for ratsnest lines.
Definition: hetriang.h:110
void hed::NODE::SetTag ( int  aTag)
inline

Sets tag, common identifier for connected nodes.

Definition at line 157 of file hetriang.h.

158  {
159  m_tag = aTag;
160  }
int m_tag
Tag for quick connection resolution.
Definition: hetriang.h:107
void NODE::updateLayers ( )
protected

Recomputes the layers used by this node.

Definition at line 58 of file hetriang.cpp.

References m_layers, and m_parents.

Referenced by GetLayers().

59 {
60  assert( m_layers.none() );
61 
62  for( const BOARD_CONNECTED_ITEM* item : m_parents )
63  m_layers |= item->GetLayerSet();
64 }
std::unordered_set< const BOARD_CONNECTED_ITEM * > m_parents
List of board items that share this node.
Definition: hetriang.h:113
LSET m_layers
Layers that are occupied by this node.
Definition: hetriang.h:116
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...

Member Data Documentation

LSET hed::NODE::m_layers
protected

Layers that are occupied by this node.

Definition at line 116 of file hetriang.h.

Referenced by GetLayers(), and updateLayers().

bool hed::NODE::m_noline
protected

Whether it the node can be a target for ratsnest lines.

Definition at line 110 of file hetriang.h.

Referenced by GetNoLine().

std::unordered_set<const BOARD_CONNECTED_ITEM*> hed::NODE::m_parents
protected

List of board items that share this node.

Definition at line 113 of file hetriang.h.

Referenced by updateLayers().

int hed::NODE::m_tag
protected

Tag for quick connection resolution.

Definition at line 107 of file hetriang.h.

Referenced by GetTag().

const int hed::NODE::m_x
protected

Node coordinates.

Definition at line 104 of file hetriang.h.

Referenced by GetX().

const int hed::NODE::m_y
protected

Definition at line 104 of file hetriang.h.

Referenced by GetY().

const int hed::NODE::TAG_UNCONNECTED = -1
static

Definition at line 227 of file hetriang.h.


The documentation for this class was generated from the following files: