Simple cache remembering device/inode to detect hard links. More...
#include <PathInfo.hpp>
Public Member Functions | |
DevInoCache () | |
Constructor. | |
void | clear () |
Clear cache. | |
bool | insert (const dev_t &dev_r, const ino_t &ino_r) |
Remember dev/ino. | |
Private Attributes | |
BLOCXX_NAMESPACE::Map< dev_t, std::set< ino_t > > | _devino |
Simple cache remembering device/inode to detect hard links.
PathInfo::DevInoCache trace; for ( all files ) { if ( trace.insert( file.device, file.inode ) ) { // 1st occurrence of file } else{ // else: hard link; already counted this device/inode } }
limal::path::PathInfo::DevInoCache::DevInoCache | ( | ) | [inline] |
Constructor.
void limal::path::PathInfo::DevInoCache::clear | ( | ) | [inline] |
Clear cache.
bool limal::path::PathInfo::DevInoCache::insert | ( | const dev_t & | dev_r, | |
const ino_t & | ino_r | |||
) | [inline] |
Remember dev/ino.
true
if it's inserted the first timefalse
if already present in cache (a hard link to a previously remembered file. BLOCXX_NAMESPACE ::Map<dev_t,std::set<ino_t> > limal::path::PathInfo::DevInoCache::_devino [private] |