#include <storage/IndexedDataNode.h>
Inheritance diagram for BIndexedDataNode:
The class derives from BMetaDataNode, providing a more concrete implementation for nodes that hold an indexed array of simple data. It implements BMetaDataNode::LookupEntry() for you. It takes care of pushing the INode::NodeChanged and INode::EntryModified events, through use of SDatumGeneratorInt::ReportChangeAtLocked().
The class derives from BIndexedIterable, providing index-based iterators over the node data. It implements BIndexedIterable::EntryAtLocked() for you. It calls BGenericIterable::PushIteratorChangedLocked() as needed when its data changes, through use of SDatumGeneratorInt::ReportChangeAtLocked().
The class derives from SDatumGeneratorInt to assist in the implementation of BMetaDataNode and BIndexedIterable.
You must still implement the methods BIndexedIterable::CountEntriesLocked(), SDatumGeneratorInt::ValueAtLocked(), SDatumGeneratorInt::StoreValueAtLocked(), and the new virtuals EntryIndexOfLocked() and EntryNameAtLocked().
Implementation | |
Provide default implementation based on new capabilities. | |
virtual bool | AllowDataAtLocked (size_t index) const |
Control whether a client will receive data for INode::REQUEST_DATA. | |
virtual status_t | EntryAtLocked (const sptr< IndexedIterator > &it, size_t index, uint32_t flags, SValue *key, SValue *entry) |
Implement using EntryNameAtLocked() and FetchEntryAtLocked(). | |
status_t | FetchEntryAtLocked (size_t index, uint32_t flags, SValue *entry) |
Use ValueAtLocked() to retrieve the entry and DatumAtLocked() if INode::REQUEST_DATA is set. | |
virtual status_t | LookupEntry (const SString &entry, uint32_t flags, SValue *node) |
Implement using EntryIndexOfLocked() and FetchEntryAtLocked(). | |
virtual void | ReportChangeAtLocked (size_t index, const sptr< IBinder > &editor, uint32_t changes, off_t start=-1, off_t length=-1) |
Also push INode::NodeChanged, INode::EntryModified, and IIterator::IteratorChanged events. | |
Bookkeeping | |
Creation, destruction, locking, etc. | |
BIndexedDataNode (const SContext &context, uint32_t mode=IDatum::READ_WRITE) | |
BIndexedDataNode (uint32_t mode=IDatum::READ_WRITE) | |
SContext | Context () |
Disambiguate. | |
virtual SValue | Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags) |
Make both INode and IIterable accessible. | |
virtual lock_status_t | Lock () const |
Disambiguate. | |
virtual void | Unlock () const |
Disambiguate. | |
virtual | ~BIndexedDataNode () |
Other Pure Virtuals | |
Purely informative definition of remaining pure virtuals from the base classes. | |
virtual size_t | CountEntriesLocked () const =0 |
From BIndexedIterable::CountEntriesLocked(). | |
virtual status_t | StoreValueAtLocked (size_t index, const SValue &value)=0 |
From SDatumGeneratorInt::StoreValueAtLocked(). | |
virtual SValue | ValueAtLocked (size_t index) const =0 |
From SDatumGeneratorInt::ValueAtLocked(). | |
New Pure Virtuals | |
New virtuals that must be implemented by derived classes, to associated entry names with indices. | |
virtual ssize_t | EntryIndexOfLocked (const SString &entry) const =0 |
Return the index for an entry name in the node. | |
virtual SString | EntryNameAtLocked (size_t index) const =0 |
Return the name of an entry at a given index. |
|
|
|
|
|
|
|
Control whether a client will receive data for INode::REQUEST_DATA. The default implementation calls SizeAtLocked() to disable data copying if the data size > 2048.
|
|
Disambiguate.
Reimplemented in BSchemaDatabaseNode, and BSchemaTableNode::RowNode. |
|
From BIndexedIterable::CountEntriesLocked().
Implements BIndexedIterable. Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedTableNode::RowNode, and BStructuredNode. |
|
Implement using EntryNameAtLocked() and FetchEntryAtLocked().
Implements BIndexedIterable. |
|
Return the index for an entry name in the node. Return an error code if the lookup failed, usually B_ENTRY_NOT_FOUND. Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedTableNode::RowNode, and BStructuredNode. |
|
Return the name of an entry at a given index. This class guarantees it will not call this function with an invalid index. Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedTableNode::RowNode, and BStructuredNode. |
|
Use ValueAtLocked() to retrieve the entry and DatumAtLocked() if INode::REQUEST_DATA is set. Before retrieving the value, calls AllowDataAtLocked(), to check if it is allowed to return a copy of the data (instead of an IDatum) for this entry. |
|
Make both INode and IIterable accessible.
Reimplemented from BnIterable. Reimplemented in BSchemaDatabaseNode, and BSchemaTableNode::RowNode. |
|
Disambiguate.
Reimplemented from SDatumGeneratorInt. Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
Implement using EntryIndexOfLocked() and FetchEntryAtLocked().
Implements BGenericNode. |
|
Also push INode::NodeChanged, INode::EntryModified, and IIterator::IteratorChanged events.
Reimplemented from SDatumGeneratorInt. Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
From SDatumGeneratorInt::StoreValueAtLocked().
Implements SDatumGeneratorInt. Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedTableNode::RowNode, and BStructuredNode. |
|
Disambiguate.
Reimplemented from SDatumGeneratorInt. Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
From SDatumGeneratorInt::ValueAtLocked().
Implements SDatumGeneratorInt. Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedTableNode::RowNode, and BStructuredNode. |