10#include <framework/logging/Logger.h>
12#include <tracking/trackFindingVXD/segmentNetwork/DirectedNode.h>
15#include <unordered_map>
27 template<
typename EntryType,
typename MetaInfoType>
53 delete nodePointer.second;
79 B2WARNING(
"Last OuterNode is not yet in this network! CurrentNetworkSize is: " <<
size());
84 B2WARNING(
"LastOuterNode and innerEntry are identical! Skipping linking-process");
91 B2WARNING(
"Last OuterNode and innerEntry were already in the network and were already connected."
92 "This is a sign for unintended behavior!");
102 B2WARNING(
"Last InnerNode is not yet in this network! CurrentNetworkSize is: " <<
size());
107 B2WARNING(
"OuterEntry and lastInnerNode are identical! Skipping linking-process");
115 B2WARNING(
"Last InnerNode and outerEntry were already in the network and were already connected."
116 "This is a sign for unintended behavior!");
126 if (outerNodeID == innerNodeID) {
127 B2WARNING(
"OuterNodeID and innerNodeID are identical! Skipping linking-process");
131 B2WARNING(
"Trying to link Nodes that are not present yet");
159 delete nodePointer.second;
199 typename std::vector<Node* >::iterator
begin()
207 typename std::vector<Node* >::iterator
end()
245 m_nodes.push_back(item.second);
246 if (item.second->getInnerNodes().empty())
m_innerEnds.push_back(item.second);
247 if (item.second->getOuterNodes().empty())
m_outerEnds.push_back(item.second);
Network of directed nodes of the type EntryType.
Node * getNode(NodeID toBeFound)
Returns pointer to the node carrying the entry which is equal to given parameter.
std::int64_t NodeID
NodeID should be some unique integer.
DirectedNode< EntryType, MetaInfoType > Node
Defining abbreviation for the used directed node type pack.
std::vector< Node * > getInnerEnds()
returns all nodes which have no inner nodes (but outer ones) and therefore are inner ends of the netw...
std::vector< Node * >::iterator begin()
Returns iterator for container: begin.
bool m_isFinalized
keeps track of the state of the network to fill the vectors m_nodes, m_outerEnds, m_innerEnds only if...
DirectedNodeNetwork()
************************* CONSTRUCTOR/DESTRUCTOR *************************
std::vector< Node * > & getNodes()
Returns all nodes of the network.
bool addInnerToLastOuterNode(NodeID innerNodeID)
to the last outerNode added, another innerNode will be attached
std::vector< Node * >::iterator end()
Returns iterator for container: end.
void finalize()
Finalizing the NodeNetwork.
static bool createLink(Node &outerNode, Node &innerNode)
************************* INTERNAL MEMBER FUNCTIONS *************************
~DirectedNodeNetwork()
destructor taking care of cleaning up the pointer-mess WARNING only needed when using classic pointer...
unsigned int size() const
Returns number of nodes to be found in the network.
std::vector< Node * > getOuterEnds()
getters:
std::unordered_map< NodeID, Node * > m_nodeMap
************************* DATA MEMBERS *************************
std::vector< Node * > m_innerEnds
keeps track of current innerEnds (nodes which have no innerNodes) entries are the NodeIds of the node...
bool linkNodes(NodeID outerNodeID, NodeID innerNodeID)
takes two entry IDs and weaves them into the network
bool isNodeInNetwork(const NodeID nodeID) const
Check if a given entry is already in the network.
NodeID m_lastInnerNodeID
temporal storage for last inner node added, used for speed-up
bool addNode(NodeID nodeID, EntryType &newEntry)
************************* PUBLIC MEMBER FUNCTIONS *************************
std::vector< Node * > m_outerEnds
keeps track of current outerEnds (nodes which have no outerNodes) entries are the NodeIDs of the node...
bool addOuterToLastInnerNode(NodeID outerNodeID)
to the last innerNode added, another outerNode will be attached
void clear()
Clear directed node network Called to clear the directed node network if its size grows to large.
NodeID m_lastOuterNodeID
temporal storage for last outer node added, used for speed-up
std::vector< Node * > m_nodes
After the network is finalized this vector will also carry all nodes to be able to keep the old inter...
std::vector< DirectedNode< EntryType, MetaInfoType > * > & getInnerNodes()
************************* PUBLIC MEMBER FUNCTIONS *************************
std::vector< DirectedNode< EntryType, MetaInfoType > * > & getOuterNodes()
Returns links to all outer nodes attached to this one.
void addInnerNode(DirectedNode< EntryType, MetaInfoType > &newNode)
************************* INTERNAL MEMBER FUNCTIONS *************************
void addOuterNode(DirectedNode< EntryType, MetaInfoType > &newNode)
Adds new links to the outward direction.
Abstract base class for different kinds of events.