DS2482-RK
|
Holds an array of DS2482Device objects of a given size. More...
#include <DS2482-RK.h>
Public Member Functions | |
DS2482DeviceListStatic () | |
Constructs a static list of devices. | |
Public Member Functions inherited from DS2482DeviceList | |
DS2482DeviceList (DS2482Device *devices, size_t deviceMax) | |
Constructs a DS2482DeviceList object with an array of DS2482Device objects. | |
virtual | ~DS2482DeviceList () |
Destructor for DS2482DeviceList. | |
bool | addAddress (const DS24821WireAddress &addr) |
Adds a DS24821WireAddress to the device list. More... | |
void | clear () |
Clears add of the objects in the array. | |
void | clearValid () |
Clears all of the valid values in the array. More... | |
DS24821WireAddress | getAddressByIndex (size_t ii) |
Gets the 1-wire address of a device in list by index. More... | |
DS2482Device & | getDeviceByIndex (size_t ii) |
Gets the DS2482Device of a device in list by index. More... | |
const DS2482Device & | getDeviceByIndex (size_t ii) const |
Gets the DS2482Device of a device in list by index. More... | |
size_t | getDeviceCount () |
Returns the number of devices in the list (devices that have been added) More... | |
size_t | getDeviceMax () |
Returns the maximum number of devices that can be added, based on the size of the array. More... | |
Additional Inherited Members | |
Protected Attributes inherited from DS2482DeviceList | |
DS2482Device * | devices |
The array of device objects. | |
size_t | deviceCount |
The number of devices currently in the list (0 = none, 1 = one, ...) | |
size_t | deviceMax |
The maximum number of objects in the array. | |
Holds an array of DS2482Device objects of a given size.
You normally use this class to allocate the array on the heap, stack, or as a class member. You need to know the maximum size in order to use this; the actual number of devices can be less than the maximum size.
The overhead is 16 bytes for each device. Note that size is in number of devices, not bytes.
It's typically used like this:
DS2482DeviceListStatic<10> deviceList;
This allocates a variable deviceList that can hold up to 10 devices. You can include a device list as a global variable, local variable (stack-allocated), a class member variable, or on the heap.