The Pedigree Project  0.1
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
DeviceHashTree Class Reference

#include <DeviceHashTree.h>

+ Collaboration diagram for DeviceHashTree:

Public Member Functions

bool initialised ()
 
void fill (Device *root=0)
 
void add (Device *p)
 
DevicegetDevice (uint32_t hash)
 
DevicegetDevice (const String &hash)
 
size_t getHash (Device *p)
 

Static Public Member Functions

static DeviceHashTreeinstance ()
 

Private Attributes

bool m_bInitialised
 
Tree< size_t, Device * > m_DeviceTree
 

Static Private Attributes

static DeviceHashTree m_Instance
 

Detailed Description

DeviceHashTree: Name-based device access

This class provides access to devices via a SHA1 hash generated from several unique identifers of the device. These hashes are deterministic across boots and are therefore ideal for use in addressing devices in userspace scripts or in configuration files.

Definition at line 38 of file DeviceHashTree.h.

Member Function Documentation

void DeviceHashTree::add ( Device p)

Adds a device, if it doesn't already exist

Definition at line 52 of file DeviceHashTree.cc.

References Device::dump(), and NOTICE.

void DeviceHashTree::fill ( Device root = 0)

Fills the hash tree, starting at the given Device and recursively traversing each device with children.

Definition at line 45 of file DeviceHashTree.cc.

References Device::foreach().

Device * DeviceHashTree::getDevice ( uint32_t  hash)

Gets a device from an integer hash

Definition at line 65 of file DeviceHashTree.cc.

Device * DeviceHashTree::getDevice ( const String hash)

Gets a device from a string hash

Definition at line 73 of file DeviceHashTree.cc.

size_t DeviceHashTree::getHash ( Device p)
bool DeviceHashTree::initialised ( )
inline

Whether or not the hash tree is ready for use.

Definition at line 50 of file DeviceHashTree.h.


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