libcamgm
Public Member Functions | Private Attributes | List of all members
ca_mgm::path::PathInfo::DevInoCache Class Reference

Simple cache remembering device/inode to detect hard links. More...

#include <PathInfo.hpp>

Public Member Functions

 DevInoCache ()
 Constructor. More...
 
void clear ()
 Clear cache. More...
 
bool insert (const dev_t &dev_r, const ino_t &ino_r)
 Remember dev/ino. More...
 

Private Attributes

std::map< dev_t, std::set< ino_t > > _devino
 

Detailed Description

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
}
}

Constructor & Destructor Documentation

ca_mgm::path::PathInfo::DevInoCache::DevInoCache ( )
inline

Constructor.

Member Function Documentation

void ca_mgm::path::PathInfo::DevInoCache::clear ( )
inline

Clear cache.

bool ca_mgm::path::PathInfo::DevInoCache::insert ( const dev_t &  dev_r,
const ino_t &  ino_r 
)
inline

Remember dev/ino.

Returns
  • true if it's inserted the first time
  • false if already present in cache (a hard link to a previously remembered file.

Member Data Documentation

std::map<dev_t,std::set<ino_t> > ca_mgm::path::PathInfo::DevInoCache::_devino
private

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