Static Value-Flow Analysis
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
SVF::List< Data > Class Template Reference

#include <WorkList.h>

Classes

class  ListNode
 

Public Member Functions

 List ()
 
 ~List ()
 
bool empty () const
 
bool find (const Data &data) const
 
void push (const Data &data)
 
Data pop ()
 

Private Types

typedef Set< DataDataSet
 
typedef ListNode Node
 

Private Attributes

DataSet nodeSet
 
Nodehead
 
Nodetail
 

Detailed Description

template<class Data>
class SVF::List< Data >

Worklist with "first come first go" order. New nodes pushed at back and popped from front. Elements in the list are unique as they're recorded by Set.

Definition at line 57 of file WorkList.h.

Member Typedef Documentation

◆ DataSet

template<class Data >
typedef Set<Data> SVF::List< Data >::DataSet
private

Definition at line 74 of file WorkList.h.

◆ Node

template<class Data >
typedef ListNode SVF::List< Data >::Node
private

Definition at line 75 of file WorkList.h.

Constructor & Destructor Documentation

◆ List()

template<class Data >
SVF::List< Data >::List ( )
inline

Definition at line 78 of file WorkList.h.

79 {
80 head = nullptr;
81 tail = nullptr;
82 }
Node * head
Definition WorkList.h:128
Node * tail
Definition WorkList.h:129

◆ ~List()

template<class Data >
SVF::List< Data >::~List ( )
inline

Definition at line 84 of file WorkList.h.

84{}

Member Function Documentation

◆ empty()

template<class Data >
bool SVF::List< Data >::empty ( ) const
inline

Definition at line 86 of file WorkList.h.

87 {
88 return (head == nullptr);
89 }

◆ find()

template<class Data >
bool SVF::List< Data >::find ( const Data data) const
inline

Definition at line 91 of file WorkList.h.

92 {
93 return nodeSet.find(data) != nodeSet.end();
94 }
DataSet nodeSet
Definition WorkList.h:127

◆ pop()

template<class Data >
Data SVF::List< Data >::pop ( )
inline

get node from list head

change list head to the next node

the last node is popped.

Definition at line 109 of file WorkList.h.

110 {
111 assert(head != nullptr && "list is empty");
114
116 head = head->next;
117 if (head == nullptr)
118 tail = nullptr;
119
120 Data data = head_node->data;
121 nodeSet.erase(data);
122 delete head_node;
123 return data;
124 }
ListNode * next
Definition WorkList.h:71
ListNode Node
Definition WorkList.h:75
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ push()

template<class Data >
void SVF::List< Data >::push ( const Data data)
inline

Definition at line 96 of file WorkList.h.

97 {
98 if (nodeSet.find(data) == nodeSet.end())
99 {
100 Node *new_node = new Node(data);
101 if (head == nullptr)
102 head = new_node;// the list is empty
103 else
104 tail->next = new_node;
105 tail = new_node;
106 }
107 }

Member Data Documentation

◆ head

template<class Data >
Node* SVF::List< Data >::head
private

Definition at line 128 of file WorkList.h.

◆ nodeSet

template<class Data >
DataSet SVF::List< Data >::nodeSet
private

Definition at line 127 of file WorkList.h.

◆ tail

template<class Data >
Node* SVF::List< Data >::tail
private

Definition at line 129 of file WorkList.h.


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