1 /* 2 Generic device list for use in drivers. 3 Copyright (C) 2008 Michael Lotz <mmlr@mlotz.ch> 4 Distributed under the terms of the MIT license. 5 */ 6 #ifndef _DEVICE_LIST_H_ 7 #define _DEVICE_LIST_H_ 8 9 #include <OS.h> 10 11 struct device_list_entry; 12 13 class DeviceList { 14 public: 15 DeviceList(); 16 ~DeviceList(); 17 18 status_t AddDevice(const char *name, void *device); 19 status_t RemoveDevice(const char *name, void *device = NULL); 20 void * FindDevice(const char *name, void *device = NULL); 21 22 int32 CountDevices(const char *baseName = NULL); 23 void * DeviceAt(int32 index); 24 25 const char ** PublishDevices(); 26 27 private: 28 void _FreePublishList(); 29 30 device_list_entry * fDeviceList; 31 int32 fDeviceCount; 32 char ** fPublishList; 33 }; 34 35 #endif // _DEVICE_LIST_H_ 36