1 // Attribute.h 2 3 #ifndef ATTRIBUTE_H 4 #define ATTRIBUTE_H 5 6 #include "AttributeIndex.h" 7 #include "AttributeIterator.h" 8 #include "DataContainer.h" 9 #include "DLList.h" 10 #include "String.h" 11 12 class AllocationInfo; 13 class Node; 14 class Volume; 15 16 class Attribute : public DataContainer, public DLListLinkImpl<Attribute> { 17 public: 18 Attribute(Volume *volume, Node *node, const char *name, uint32 type = 0); 19 ~Attribute(); 20 21 status_t InitCheck() const; 22 23 void SetNode(Node *node) { fNode = node; } 24 Node *GetNode() const { return fNode; } 25 26 const char *GetName() { return fName.GetString(); } 27 28 void SetType(uint32 type); 29 uint32 GetType() const { return fType; } 30 31 status_t SetSize(off_t newSize); 32 off_t GetSize() const { return DataContainer::GetSize(); } 33 34 virtual status_t WriteAt(off_t offset, const void *buffer, size_t size, 35 size_t *bytesWritten); 36 37 // index support 38 void SetIndex(AttributeIndex *index, bool inIndex); 39 AttributeIndex *GetIndex() const { return fIndex; } 40 bool IsInIndex() const { return fInIndex; } 41 void GetKey(const uint8 **key, size_t *length); 42 void GetKey(uint8 *key, size_t *length); 43 44 // iterator management 45 void AttachAttributeIterator(AttributeIterator *iterator); 46 void DetachAttributeIterator(AttributeIterator *iterator); 47 inline DLList<AttributeIterator> *GetAttributeIteratorList() 48 { return &fIterators; } 49 50 // debugging 51 void GetAllocationInfo(AllocationInfo &info); 52 53 private: 54 Node *fNode; 55 String fName; 56 uint32 fType; 57 AttributeIndex *fIndex; 58 bool fInIndex; 59 60 // iterator management 61 DLList<AttributeIterator> fIterators; 62 }; 63 64 #endif // ATTRIBUTE_H 65