30#ifndef GENERICGRAPH_H_
31#define GENERICGRAPH_H_
124 return (rhs->
edgeFlag == this->edgeFlag &&
125 rhs->
getSrcID() == this->getSrcID() &&
126 rhs->
getDstID() == this->getDstID());
140template<
class NodeTy,
class EdgeTy>
190 return (
InEdges.empty() ==
false);
275 return InEdges.insert(inEdge).second;
279 return OutEdges.insert(outEdge).second;
288 assert(it !=
InEdges.end() &&
"can not find in edge in SVFG node");
295 assert(it !=
OutEdges.end() &&
"can not find out edge in SVFG node");
336template<
class NodeTy,
class EdgeTy>
400 assert(it !=
IDToNodeMap.end() &&
"Node not found!");
416 &&
"node which have edges can't be deleted");
418 assert(it !=
IDToNodeMap.end() &&
"can not find the node");
462template <
typename ItTy,
typename FuncTy,
463 typename FuncReturnTy =
464 decltype(std::declval<FuncTy>()(*std::declval<ItTy>()))>
467 mapped_iter<ItTy, FuncTy>, ItTy,
468 typename std::iterator_traits<ItTy>::iterator_category,
469 typename std::remove_reference<FuncReturnTy>::type>
491template <
class ItTy,
class FuncTy>
507 return E->getDstNode();
539template<
class NodeTy,
class EdgeTy>
547 return E->getSrcNode();
587 typedef std::pair<SVF::NodeID, NodeType*>
PairTy;
virtual bool operator==(const GenericEdge< NodeType > *rhs) const
GEdgeKind getEdgeKindWithoutMask() const
NodeType * getSrcNode() const
struct SVF::GenericEdge::equalGEdge equalGEdge
Add the hash function for std::set (we also can overload operator< to implement this).
virtual ~GenericEdge()
Destructor.
GenericEdge(NodeTy *s, NodeTy *d, GEdgeFlag k)
Constructor.
NodeType * getDstNode() const
static constexpr u64_t EdgeKindMask
GEdgeKind getEdgeKind() const
NodeID getSrcID() const
get methods of the components
static constexpr unsigned char EdgeKindMaskBits
void addGNode(NodeID id, NodeType *node)
Add a Node.
iterator begin()
Iterators.
void removeGNode(NodeType *node)
Delete a node.
u32_t getTotalEdgeNum() const
const_iterator end() const
const_iterator begin() const
virtual ~GenericGraph()
Destructor.
IDToNodeMapTy IDToNodeMap
IDToNodeMapTy::const_iterator const_iterator
bool hasGNode(NodeID id) const
Has a node.
void incNodeNum()
Increase number of node/edge.
u32_t getTotalNodeNum() const
Get total number of node/edge.
GenericGraph()
Constructor.
IDToNodeMapTy::iterator iterator
NodeType * getGNode(NodeID id) const
Get a node.
void destroy()
Release memory.
OrderedMap< NodeID, NodeType * > IDToNodeMapTy
const_iterator InEdgeEnd() const
OrderedSet< EdgeType *, typename EdgeType::equalGEdge > GEdgeSetTy
bool hasIncomingEdge() const
Has incoming/outgoing edge set.
bool hasOutgoingEdge() const
u32_t removeOutgoingEdge(EdgeType *edge)
GenericNode(NodeID i, GNodeK k, const SVFType *svfType=nullptr)
Constructor.
virtual iterator directInEdgeEnd()
EdgeType * hasIncomingEdge(EdgeType *edge) const
Find incoming and outgoing edges.
GEdgeSetTy::iterator iterator
const GEdgeSetTy & getOutEdges() const
virtual ~GenericNode()
Destructor.
virtual iterator directInEdgeBegin()
const_iterator OutEdgeBegin() const
virtual iterator directOutEdgeEnd()
const GEdgeSetTy & getInEdges() const
static bool classof(const SVFValue *)
const_iterator InEdgeBegin() const
virtual const_iterator directOutEdgeEnd() const
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
u32_t removeIncomingEdge(EdgeType *edge)
virtual iterator directOutEdgeBegin()
Iterators used for SCC detection, overwrite it in child class if necessary.
iterator OutEdgeBegin()
iterators
virtual const_iterator directInEdgeEnd() const
static bool classof(const GenericNode< NodeTy, EdgeTy > *)
virtual const_iterator directInEdgeBegin() const
GEdgeSetTy::const_iterator const_iterator
const_iterator OutEdgeEnd() const
virtual const_iterator directOutEdgeBegin() const
EdgeType * hasOutgoingEdge(EdgeType *edge) const
bool addOutgoingEdge(EdgeType *outEdge)
SVFValue(NodeID i, GNodeK k, const SVFType *ty=nullptr)
NodeID getId() const
Get ID.
iter_adaptor_base()=default
mapped_iter(ItTy U, FuncTy F)
FuncReturnTy operator*() const
std::map< Key, Value, Compare, Allocator > OrderedMap
std::set< Key, Compare, Allocator > OrderedSet
mapped_iter< ItTy, FuncTy > map_iter(ItTy I, FuncTy F)
Add the hash function for std::set (we also can overload operator< to implement this).
bool operator()(const GenericEdge< NodeType > *lhs, const GenericEdge< NodeType > *rhs) const
mapped_iter< typename SVF::GenericNode< NodeTy, EdgeTy >::iterator, decltype(&edge_dest)> ChildIteratorType
static NodeType * getEntryNode(Inverse< NodeType * > G)
static ChildIteratorType child_begin(const NodeType *N)
static ChildIteratorType child_end(const NodeType *N)
static NodeType * edge_dest(const EdgeType *E)
static unsigned getNodeID(const NodeType *N)
static unsigned getNodeID(NodeType *N)
static unsigned graphSize(GenericGraphTy *G)
static NodeType * getNode(GenericGraphTy *G, SVF::NodeID id)
mapped_iter< typename GenericGraphTy::iterator, decltype(&deref_val)> nodes_iterator
static NodeType * deref_val(PairTy P)
static NodeType * getEntryNode(GenericGraphTy *pag)
static nodes_iterator nodes_end(GenericGraphTy *G)
std::pair< SVF::NodeID, NodeType * > PairTy
static nodes_iterator nodes_begin(GenericGraphTy *G)
SVF::GenericGraph< NodeTy, EdgeTy > GenericGraphTy
static NodeType * getEntryNode(NodeType *pagN)
static ChildIteratorType direct_child_begin(const NodeType *N)
static ChildIteratorType child_end(const NodeType *N)
static ChildIteratorType direct_child_end(const NodeType *N)
static NodeType * edge_dest(const EdgeType *E)
mapped_iter< typename SVF::GenericNode< NodeTy, EdgeTy >::iterator, decltype(&edge_dest)> ChildIteratorType
static ChildIteratorType child_begin(const NodeType *N)