Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Attributes | Friends | List of all members
SVF::GenericGraph< NodeTy, EdgeTy > Class Template Reference

#include <GenericGraph.h>

Inheritance diagram for SVF::GenericGraph< NodeTy, EdgeTy >:
SVF::CDG SVF::CFLGraph SVF::CHGraph SVF::CallGraph SVF::ICFG SVF::PTACallGraph SVF::TCT SVF::VFG

Public Types

typedef NodeTy NodeType
 
typedef EdgeTy EdgeType
 
typedef OrderedMap< NodeID, NodeType * > IDToNodeMapTy
 NodeID to GenericNode map.
 
typedef IDToNodeMapTy::iterator iterator
 Node Iterators.
 
typedef IDToNodeMapTy::const_iterator const_iterator
 

Public Member Functions

 GenericGraph ()
 Constructor.
 
virtual ~GenericGraph ()
 Destructor.
 
void destroy ()
 Release memory.
 
iterator begin ()
 Iterators.
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
void addGNode (NodeID id, NodeType *node)
 Add a Node.
 
NodeTypegetGNode (NodeID id) const
 Get a node.
 
bool hasGNode (NodeID id) const
 Has a node.
 
void removeGNode (NodeType *node)
 Delete a node.
 
u32_t getTotalNodeNum () const
 Get total number of node/edge.
 
u32_t getTotalEdgeNum () const
 
void incNodeNum ()
 Increase number of node/edge.
 
void incEdgeNum ()
 

Public Attributes

u32_t edgeNum
 total num of node
 
u32_t nodeNum
 total num of edge
 

Protected Attributes

IDToNodeMapTy IDToNodeMap
 node map
 

Friends

class SVFIRWriter
 
class SVFIRReader
 
class GenericGraphWriter< NodeTy, EdgeTy >
 
class GenericGraphReader< NodeTy, EdgeTy >
 

Detailed Description

template<class NodeTy, class EdgeTy>
class SVF::GenericGraph< NodeTy, EdgeTy >

Definition at line 564 of file GenericGraph.h.

Member Typedef Documentation

◆ const_iterator

template<class NodeTy , class EdgeTy >
typedef IDToNodeMapTy::const_iterator SVF::GenericGraph< NodeTy, EdgeTy >::const_iterator

Definition at line 580 of file GenericGraph.h.

◆ EdgeType

Definition at line 573 of file GenericGraph.h.

◆ IDToNodeMapTy

NodeID to GenericNode map.

Definition at line 575 of file GenericGraph.h.

◆ iterator

template<class NodeTy , class EdgeTy >
typedef IDToNodeMapTy::iterator SVF::GenericGraph< NodeTy, EdgeTy >::iterator

Node Iterators.

Definition at line 579 of file GenericGraph.h.

◆ NodeType

Definition at line 572 of file GenericGraph.h.

Constructor & Destructor Documentation

◆ GenericGraph()

template<class NodeTy , class EdgeTy >
SVF::GenericGraph< NodeTy, EdgeTy >::GenericGraph ( )
inline

Constructor.

Definition at line 584 of file GenericGraph.h.

584: edgeNum(0), nodeNum(0) {}
u32_t edgeNum
total num of node
u32_t nodeNum
total num of edge

◆ ~GenericGraph()

template<class NodeTy , class EdgeTy >
virtual SVF::GenericGraph< NodeTy, EdgeTy >::~GenericGraph ( )
inlinevirtual

Destructor.

Definition at line 587 of file GenericGraph.h.

588 {
589 destroy();
590 }
void destroy()
Release memory.

Member Function Documentation

◆ addGNode()

template<class NodeTy , class EdgeTy >
void SVF::GenericGraph< NodeTy, EdgeTy >::addGNode ( NodeID  id,
NodeType node 
)
inline

Add a Node.

Definition at line 619 of file GenericGraph.h.

620 {
621 IDToNodeMap[id] = node;
622 nodeNum++;
623 }
IDToNodeMapTy IDToNodeMap
node map

◆ begin() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericGraph< NodeTy, EdgeTy >::begin ( )
inline

Iterators.

Definition at line 600 of file GenericGraph.h.

601 {
602 return IDToNodeMap.begin();
603 }

◆ begin() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericGraph< NodeTy, EdgeTy >::begin ( ) const
inline

Definition at line 608 of file GenericGraph.h.

609 {
610 return IDToNodeMap.begin();
611 }

◆ destroy()

template<class NodeTy , class EdgeTy >
void SVF::GenericGraph< NodeTy, EdgeTy >::destroy ( )
inline

Release memory.

Definition at line 593 of file GenericGraph.h.

594 {
595 for (auto &entry : IDToNodeMap)
596 delete entry.second;
597 }
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ end() [1/2]

template<class NodeTy , class EdgeTy >
iterator SVF::GenericGraph< NodeTy, EdgeTy >::end ( )
inline

Definition at line 604 of file GenericGraph.h.

605 {
606 return IDToNodeMap.end();
607 }

◆ end() [2/2]

template<class NodeTy , class EdgeTy >
const_iterator SVF::GenericGraph< NodeTy, EdgeTy >::end ( ) const
inline

Definition at line 612 of file GenericGraph.h.

613 {
614 return IDToNodeMap.end();
615 }

◆ getGNode()

template<class NodeTy , class EdgeTy >
NodeType * SVF::GenericGraph< NodeTy, EdgeTy >::getGNode ( NodeID  id) const
inline

Get a node.

Definition at line 626 of file GenericGraph.h.

627 {
628 const_iterator it = IDToNodeMap.find(id);
629 assert(it != IDToNodeMap.end() && "Node not found!");
630 return it->second;
631 }
IDToNodeMapTy::const_iterator const_iterator

◆ getTotalEdgeNum()

template<class NodeTy , class EdgeTy >
u32_t SVF::GenericGraph< NodeTy, EdgeTy >::getTotalEdgeNum ( ) const
inline

Definition at line 657 of file GenericGraph.h.

658 {
659 return edgeNum;
660 }

◆ getTotalNodeNum()

template<class NodeTy , class EdgeTy >
u32_t SVF::GenericGraph< NodeTy, EdgeTy >::getTotalNodeNum ( ) const
inline

Get total number of node/edge.

Definition at line 653 of file GenericGraph.h.

654 {
655 return nodeNum;
656 }

◆ hasGNode()

template<class NodeTy , class EdgeTy >
bool SVF::GenericGraph< NodeTy, EdgeTy >::hasGNode ( NodeID  id) const
inline

Has a node.

Definition at line 634 of file GenericGraph.h.

635 {
636 const_iterator it = IDToNodeMap.find(id);
637 return it != IDToNodeMap.end();
638 }

◆ incEdgeNum()

template<class NodeTy , class EdgeTy >
void SVF::GenericGraph< NodeTy, EdgeTy >::incEdgeNum ( )
inline

Definition at line 666 of file GenericGraph.h.

667 {
668 edgeNum++;
669 }

◆ incNodeNum()

template<class NodeTy , class EdgeTy >
void SVF::GenericGraph< NodeTy, EdgeTy >::incNodeNum ( )
inline

Increase number of node/edge.

Definition at line 662 of file GenericGraph.h.

663 {
664 nodeNum++;
665 }

◆ removeGNode()

template<class NodeTy , class EdgeTy >
void SVF::GenericGraph< NodeTy, EdgeTy >::removeGNode ( NodeType node)
inline

Delete a node.

Definition at line 641 of file GenericGraph.h.

642 {
643 assert(node->hasIncomingEdge() == false
644 && node->hasOutgoingEdge() == false
645 && "node which have edges can't be deleted");
646 iterator it = IDToNodeMap.find(node->getId());
647 assert(it != IDToNodeMap.end() && "can not find the node");
648 IDToNodeMap.erase(it);
649 delete node;
650 }
IDToNodeMapTy::iterator iterator
Node Iterators.

Friends And Related Symbol Documentation

◆ GenericGraphReader< NodeTy, EdgeTy >

Definition at line 567 of file GenericGraph.h.

◆ GenericGraphWriter< NodeTy, EdgeTy >

Definition at line 567 of file GenericGraph.h.

◆ SVFIRReader

Definition at line 567 of file GenericGraph.h.

◆ SVFIRWriter

Definition at line 566 of file GenericGraph.h.

Member Data Documentation

◆ edgeNum

total num of node

Definition at line 675 of file GenericGraph.h.

◆ IDToNodeMap

template<class NodeTy , class EdgeTy >
IDToNodeMapTy SVF::GenericGraph< NodeTy, EdgeTy >::IDToNodeMap
protected

node map

Definition at line 672 of file GenericGraph.h.

◆ nodeNum

total num of edge

Definition at line 676 of file GenericGraph.h.


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