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

Bookkeeping class to keep track of the IDs of objects that doesn't have any ID. E.g., SVFValue, XXXEdge. More...

#include <SVFFileSystem.h>

Public Member Functions

size_t getID (const T *ptr)
 
void saveID (const T *ptr)
 
const TgetPtr (size_t id) const
 
const std::vector< const T * > & getPool () const
 
size_t size () const
 
void reserve (size_t size)
 
auto begin () const
 
auto end () const
 

Private Attributes

Map< const T *, size_tptrToId
 
std::vector< const T * > ptrPool
 

Detailed Description

template<typename T>
class SVF::WriterPtrPool< T >

Bookkeeping class to keep track of the IDs of objects that doesn't have any ID. E.g., SVFValue, XXXEdge.

Template Parameters
T

Definition at line 231 of file SVFFileSystem.h.

Member Function Documentation

◆ begin()

template<typename T >
auto SVF::WriterPtrPool< T >::begin ( ) const
inline

Definition at line 277 of file SVFFileSystem.h.

278 {
279 return ptrPool.cbegin();
280 }
std::vector< const T * > ptrPool

◆ end()

template<typename T >
auto SVF::WriterPtrPool< T >::end ( ) const
inline

Definition at line 282 of file SVFFileSystem.h.

283 {
284 return ptrPool.cend();
285 }

◆ getID()

template<typename T >
size_t SVF::WriterPtrPool< T >::getID ( const T ptr)
inline

Definition at line 238 of file SVFFileSystem.h.

239 {
240 if (!ptr)
241 return 0;
242
243 typename decltype(ptrToId)::iterator it;
244 bool inserted;
245 std::tie(it, inserted) = ptrToId.emplace(ptr, 1 + ptrPool.size());
246 if (inserted)
247 ptrPool.push_back(ptr);
248 return it->second;
249 }
Map< const T *, size_t > ptrToId
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ getPool()

template<typename T >
const std::vector< const T * > & SVF::WriterPtrPool< T >::getPool ( ) const
inline

Definition at line 262 of file SVFFileSystem.h.

263 {
264 return ptrPool;
265 }

◆ getPtr()

template<typename T >
const T * SVF::WriterPtrPool< T >::getPtr ( size_t  id) const
inline

Definition at line 256 of file SVFFileSystem.h.

257 {
258 assert(id <= ptrPool.size() && "Invalid ID");
259 return id ? ptrPool[id - 1] : nullptr;
260 }

◆ reserve()

template<typename T >
void SVF::WriterPtrPool< T >::reserve ( size_t  size)
inline

Definition at line 272 of file SVFFileSystem.h.

273 {
274 ptrPool.reserve(size);
275 }
size_t size() const

◆ saveID()

template<typename T >
void SVF::WriterPtrPool< T >::saveID ( const T ptr)
inline

Definition at line 251 of file SVFFileSystem.h.

252 {
253 getID(ptr);
254 }
size_t getID(const T *ptr)

◆ size()

template<typename T >
size_t SVF::WriterPtrPool< T >::size ( ) const
inline

Definition at line 267 of file SVFFileSystem.h.

268 {
269 return ptrPool.size();
270 }

Member Data Documentation

◆ ptrPool

template<typename T >
std::vector<const T*> SVF::WriterPtrPool< T >::ptrPool
private

Definition at line 235 of file SVFFileSystem.h.

◆ ptrToId

template<typename T >
Map<const T*, size_t> SVF::WriterPtrPool< T >::ptrToId
private

Definition at line 234 of file SVFFileSystem.h.


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