Overview   API Reference  

device_container< DeviceT > Struct Template Reference

Generic container for devices. More...

#include <device_container.hpp>

Inheritance diagram for device_container< DeviceT >:

Inheritance graph
[legend]
Collaboration diagram for device_container< DeviceT >:

Collaboration graph
[legend]

List of all members.

Public Types

typedef DeviceT device_type
typedef vector< DeviceT * > collection_type
typedef
collection_type::const_iterator 
const_iterator

Public Member Functions

 device_container (int max_devices=0, bool dense=true)
virtual const_iterator begin (void) const
 Returns the begin iterator (const variant).
virtual const_iterator end (void) const
 Returns the end iterator (const variant).
virtual int register_device (DeviceT *device)
 Registers the device at this container, which becomes the new owner.
virtual int unregister_device (const DeviceT *device)
 Unregisters the device, transferring ownership back to the caller.
virtual int reset_devices (void)
 Resets all registered devices as when powering up the machine.

Protected Attributes

const int max_devices
 Maximum number of devices that can be handled.
const bool dense
 If true, keep the registered devices dense.
collection_type devices
 Vector storing (pointers to) the registered devices.
int num_devices
 Number of currently registered devices.


Detailed Description

template<typename DeviceT>
struct device_container< DeviceT >

Generic container for devices.

Frees all registered devices during destruction.


Member Data Documentation

template<typename DeviceT>
const int device_container< DeviceT >::max_devices [protected]

Maximum number of devices that can be handled.

A value of 0 denotes no limit.

Referenced by device_container< DeviceT >::register_device().

template<typename DeviceT>
const bool device_container< DeviceT >::dense [protected]

If true, keep the registered devices dense.

That is use erase to unregister a device, causing the following devices to move down. Otherwise overwrite with NULL. Thus the following devices keep their position.

Referenced by device_container< DeviceT >::unregister_device().


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

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008