BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / devices / Device.h
blob32b2e03a9d207d00f98199c02b22ae0c74e0ad8a
1 /*
2 * Copyright 2008-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Pieter Panman
7 */
8 #ifndef DEVICE_H
9 #define DEVICE_H
12 #include <map>
13 #include <vector>
15 #include <String.h>
16 #include <StringItem.h>
18 extern "C" {
19 #include "dm_wrapper.h"
23 typedef enum {
24 BUS_ISA = 1,
25 BUS_PCI,
26 BUS_SCSI,
27 BUS_ACPI,
28 BUS_NONE
29 } BusType;
32 struct Attribute {
33 Attribute(BString name, BString value)
34 { fName = name; fValue = value; }
35 BString fName;
36 BString fValue;
40 typedef std::map<BString, BString>::const_iterator AttributeMapIterator;
41 typedef std::map<BString, BString> AttributeMap;
42 typedef std::pair<BString, BString> AttributePair;
43 typedef std::vector<Attribute> Attributes;
46 typedef enum {
47 CAT_NONE, // 0x00
48 CAT_MASS, // 0x01
49 CAT_NETWORK, // 0x02
50 CAT_DISPLAY, // 0x03
51 CAT_MULTIMEDIA, // 0x04
52 CAT_MEMORY, // 0x05
53 CAT_BUS, // 0x06
54 CAT_COMM, // 0x07
55 CAT_GENERIC, // 0x08
56 CAT_INPUT, // 0x09
57 CAT_DOCK, // 0x0A
58 CAT_CPU, // 0x0B
59 CAT_SERIAL, // 0x0C
60 CAT_WIRELESS, // 0x0D
61 CAT_INTEL, // 0x0E
62 CAT_SATELLITE, // 0x0F
63 CAT_CRYPTO, // 0x10
64 CAT_SIGNAL, // 0x11
65 CAT_COMPUTER, // 0x12
66 CAT_ACPI // 0x13
67 } Category;
70 extern const char* kCategoryString[];
71 extern const int kCategoryStringLength;
74 class Device : public BStringItem {
75 public:
76 Device(Device* physicalParent,
77 BusType busType = BUS_NONE,
78 Category category = CAT_NONE,
79 const BString& name = "unknown",
80 const BString& manufacturer = "unknown",
81 const BString& driverUsed = "unknown",
82 const BString& devPathsPublished = "unknown");
83 virtual ~Device();
85 virtual BString GetName();
86 virtual BString GetManufacturer();
87 virtual BString GetDriverUsed();
88 virtual BString GetDevPathsPublished();
89 virtual Category GetCategory() const
90 { return fCategory; }
91 virtual Device* GetPhysicalParent() const
92 { return fPhysicalParent; }
93 virtual BusType GetBusType() const
94 { return fBusType; }
96 virtual Attributes GetBasicAttributes();
97 virtual Attributes GetBusAttributes();
98 virtual Attributes GetAllAttributes();
100 virtual BString GetBasicStrings();
101 virtual BString GetBusStrings();
102 virtual BString GetAllStrings();
104 virtual BString GetBusTabName();
106 virtual Attribute GetAttribute(const BString& name)
107 { return Attribute(name.String(),
108 fAttributeMap[name]); }
110 virtual void SetAttribute(const BString& name,
111 const BString& value);
113 virtual void InitFromAttributes() { return; }
115 protected:
116 AttributeMap fAttributeMap;
117 BusType fBusType;
118 Category fCategory;
119 Device* fPhysicalParent;
122 #endif /* DEVICE_H */