#include <storage/DatumGeneratorInt.h>
Inheritance diagram for SDatumGeneratorInt:
This class provides standard tools for generating IDatum objects on-demand that are bound to an integer-based key. It is used when you have data in an indexed vector or structure which is normally stored in its raw form, and need to generate datum objects for its individual pieces of data for integration with the general data model.
Note that because the cached datums generated by this class do not own their data, when an item is removed from the SDatumGeneratorInt a cached datum will loose its associated data. In this case the datum silently becomes B_UNDEFINED_VALUE and modifications to it are no longer allowed.
Index Management | |
Manage the mapping of indices to datums. | |
sptr< IDatum > | DatumAtLocked (size_t index) |
Retrieve a datum of a given index. | |
void | UpdateDatumIndicesLocked (size_t index, ssize_t delta) |
Adjust all active datums due to items being added/removed from the generator. | |
Stream Virtuals | |
These are like the corresponding virtuals on BStreamDatum. | |
virtual void | FinishReadingAtLocked (size_t index, const void *data) const |
The default implementation does nothing. | |
virtual void | FinishWritingAtLocked (size_t index, void *data) |
The default implementation uses StoreValueAtLocked() to write the data. | |
virtual const void * | StartReadingAtLocked (size_t index, off_t position, ssize_t *inoutSize, uint32_t flags) const |
The default implementation return uses ValueAtLocked() to retrieve the data. | |
virtual void * | StartWritingAtLocked (size_t index, off_t position, ssize_t *inoutSize, uint32_t flags) |
The default implementation uses ValueAtLocked() to create a temporary buffer. | |
Bookkeeping | |
Creation, destruction, locking, etc. | |
virtual lock_status_t | Lock () const |
Lock the datum's state. | |
SDatumGeneratorInt (const SContext &context, uint32_t mode=IDatum::READ_WRITE) | |
Lock the datum's state. | |
SDatumGeneratorInt (uint32_t mode=IDatum::READ_WRITE) | |
Lock the datum's state. | |
virtual void | Unlock () const |
Unlock the datum's state. | |
virtual | ~SDatumGeneratorInt () |
Lock the datum's state. | |
Datum Generation | |
virtual sptr< IndexedDatum > | NewDatumLocked (size_t index, uint32_t mode) |
Called when a new datum object needs to be created. | |
Value-based Structure Access | |
These are like the corresponding virtuals on BStreamDatum. | |
virtual void | ReportChangeAtLocked (size_t index, const sptr< IBinder > &editor, uint32_t changes, off_t start=-1, off_t length=-1) |
Similar to BStreamDatum::ReportChangeLocked(), using same change flags. | |
void | SetValueAtLocked (size_t index, const SValue &value) |
Convenience function for changing a value. | |
virtual off_t | SizeAtLocked (size_t index) const |
The default implementation returns ValueAtLocked().Length(). | |
virtual status_t | StoreSizeAtLocked (size_t index, off_t size) |
The default implementation uses ValueAtLocked() and StoreValueAtLocked() to change the size. | |
virtual status_t | StoreValueAtLocked (size_t index, const SValue &value)=0 |
Must be implemented by subclasses change the current value at an index. | |
virtual status_t | StoreValueTypeAtLocked (size_t index, uint32_t type) |
The default implementation uses ValueAtLocked() and StoreValueAtLocked() to change the type. | |
virtual SValue | ValueAtLocked (size_t index) const =0 |
Must be implemented by subclasses to return the current value at an index. | |
virtual uint32_t | ValueTypeAtLocked (size_t index) const |
The default implementation returns ValueAtLocked().Type(). | |
Friends | |
class | IndexedDatum |
Classes | |
class | IndexedDatum |
Datum object generated for an item in SDatumGeneratorInt. More... |
|
Lock the datum's state. To keep itself consistent, this class provides a public lock that is used when doing read/write operations on the class state as well as the actual data. The default implemention of this method acquires an internal lock. You can override it to cause all internal implementation to acquire some other lock. Be sure to also override Unlock() if doing so. |
|
Lock the datum's state. To keep itself consistent, this class provides a public lock that is used when doing read/write operations on the class state as well as the actual data. The default implemention of this method acquires an internal lock. You can override it to cause all internal implementation to acquire some other lock. Be sure to also override Unlock() if doing so. |
|
Lock the datum's state. To keep itself consistent, this class provides a public lock that is used when doing read/write operations on the class state as well as the actual data. The default implemention of this method acquires an internal lock. You can override it to cause all internal implementation to acquire some other lock. Be sure to also override Unlock() if doing so. |
|
Retrieve a datum of a given index. Returns an existing datum if one is currently active for the index. Otherwise, calls NewDatumLocked() to create a new datum and associates it with this index. |
|
The default implementation does nothing.
Reimplemented in BIndexedTableNode::RowNode. |
|
The default implementation uses StoreValueAtLocked() to write the data.
Reimplemented in BIndexedTableNode::RowNode. |
|
Lock the datum's state. To keep itself consistent, this class provides a public lock that is used when doing read/write operations on the class state as well as the actual data. The default implemention of this method acquires an internal lock. You can override it to cause all internal implementation to acquire some other lock. Be sure to also override Unlock() if doing so. Reimplemented in BSchemaTableNode::RowNode, BIndexedDataNode, BIndexedTableNode::RowNode, and BCatalog. |
|
Called when a new datum object needs to be created. The default implementation instantiates and returns a new IndexedDatum object. |
|
Similar to BStreamDatum::ReportChangeLocked(), using same change flags.
Reimplemented in BSchemaTableNode::RowNode, BIndexedDataNode, and BIndexedTableNode::RowNode. |
|
Convenience function for changing a value. The implementation takes care of calling ReportChangeAtLocked() for you if the value has changed. This is semantically the same as BStreamDatum::SetValue(). |
|
The default implementation returns ValueAtLocked().Length().
Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
The default implementation return uses ValueAtLocked() to retrieve the data.
Reimplemented in BIndexedTableNode::RowNode. |
|
The default implementation uses ValueAtLocked() to create a temporary buffer.
Reimplemented in BIndexedTableNode::RowNode. |
|
The default implementation uses ValueAtLocked() and StoreValueAtLocked() to change the size.
Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
Must be implemented by subclasses change the current value at an index.
Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedDataNode, BIndexedTableNode::RowNode, BStructuredNode, and BCatalog. |
|
The default implementation uses ValueAtLocked() and StoreValueAtLocked() to change the type.
Reimplemented in BSchemaTableNode::RowNode, and BIndexedTableNode::RowNode. |
|
Unlock the datum's state.
Reimplemented in BSchemaTableNode::RowNode, BIndexedDataNode, BIndexedTableNode::RowNode, and BCatalog. |
|
Adjust all active datums due to items being added/removed from the generator. Your subclass must call this when it changes its set of datum items. |
|
Must be implemented by subclasses to return the current value at an index.
Implemented in BSchemaDatabaseNode, BSchemaTableNode::RowNode, BIndexedDataNode, BIndexedTableNode::RowNode, BStructuredNode, and BCatalog. |
|
The default implementation returns ValueAtLocked().Type().
Reimplemented in BIndexedTableNode::RowNode. |
|
|