SDatumGeneratorInt::IndexedDatum Class Reference
[Data Model]

#include <storage/DatumGeneratorInt.h>

Inheritance diagram for SDatumGeneratorInt::IndexedDatum:

BStreamDatum BGenericDatum BnDatum IDatum BBinder IInterface IBinder SAtom SAtom List of all members.

Detailed Description

Datum object generated for an item in SDatumGeneratorInt.


BStreamDatum Implementation

Redirect high-level datum operations back up to BIndexedDatumGenerator.

virtual void FinishReadingLocked (const sptr< Stream > &stream, const void *data) const
 The default implementation does nothing.
virtual void FinishWritingLocked (const sptr< Stream > &stream, void *data)
 The default implementation does nothing.
virtual void ReportChangeLocked (const sptr< IBinder > &editor, uint32_t changes, off_t start=-1, off_t length=-1)
 Called when any part of the datum (data, type, size) changes.
virtual off_t SizeLocked () const
 Derived classes must implement to return the total amount of data available.
virtual const void * StartReadingLocked (const sptr< Stream > &stream, off_t position, ssize_t *inoutSize, uint32_t flags) const
 The default implementation returns NULL.
virtual void * StartWritingLocked (const sptr< Stream > &stream, off_t position, ssize_t *inoutSize, uint32_t flags)
 The default implementation returns NULL.
virtual status_t StoreSizeLocked (off_t size)
 Derived classes must implement to set the total amount of data.
virtual status_t StoreValueLocked (const SValue &value)
 The default implementation changes the contents of the datum to the value.
virtual status_t StoreValueTypeLocked (uint32_t type)
 The default implementation does nothing, returning B_UNSUPPORTED.
virtual SValue ValueLocked () const
 The default implementation generates a new SValue from the datum.
virtual uint32_t ValueTypeLocked () const
 The default implementation returns B_RAW_TYPE.
ssize_t m_index
const sptr< SDatumGeneratorIntm_owner

Bookkeeping

Creation, destruction, locking, etc.

 IndexedDatum (const SContext &context, const sptr< SDatumGeneratorInt > &owner, size_t index, uint32_t mode)
virtual lock_status_t Lock () const
 Reimplemented to use the BIndexedDatumGenerator lock.
virtual void Unlock () const
 Reimplemented to use the BIndexedDatumGenerator lock.
virtual status_t FinishAtom (const void *id)
 The destructor must call Lock(), so return FINISH_ATOM_ASYNC to avoid deadlocks.
virtual bool HoldRefForLink (const SValue &binding, uint32_t flags)
 Make this object stay around while there are links on it.
virtual ~IndexedDatum ()


Constructor & Destructor Documentation

IndexedDatum const SContext context,
const sptr< SDatumGeneratorInt > &  owner,
size_t  index,
uint32_t  mode
 

~IndexedDatum  )  [protected, virtual]
 


Member Function Documentation

status_t FinishAtom const void *  id  )  [protected, virtual]
 

The destructor must call Lock(), so return FINISH_ATOM_ASYNC to avoid deadlocks.

Reimplemented from SAtom.

void FinishReadingLocked const sptr< Stream > &  stream,
const void *  data
const [virtual]
 

The default implementation does nothing.

Reimplemented from BStreamDatum.

void FinishWritingLocked const sptr< Stream > &  stream,
void *  data
[virtual]
 

The default implementation does nothing.

Reimplemented from BStreamDatum.

bool HoldRefForLink const SValue binding,
uint32_t  flags
[protected, virtual]
 

Make this object stay around while there are links on it.

Reimplemented from BBinder.

lock_status_t Lock  )  const [virtual]
 

Reimplemented to use the BIndexedDatumGenerator lock.

Reimplemented from BStreamDatum.

void ReportChangeLocked const sptr< IBinder > &  editor,
uint32_t  changes,
off_t  start = -1,
off_t  length = -1
[virtual]
 

Called when any part of the datum (data, type, size) changes.

The default implementation pushes the appropriate properties and events based on the changes flags, which may be any of TYPE_CHANGED, SIZE_CHANGED, or DATA_CHANGED. The value property is always pushed. For DATA_CHANGED, start and length must be supplied with the range of data that changed; for all other changes, ValueLocked(), ValueTypeLocked(), and SizeLocked() are called as needed to retrieve the current values.

You can override this method in your own subclass to easily discover when changes happen. If you do so, be sure to also call through to this implementation.

Reimplemented from BStreamDatum.

off_t SizeLocked  )  const [virtual]
 

Derived classes must implement to return the total amount of data available.

Implements BStreamDatum.

const void * StartReadingLocked const sptr< Stream > &  stream,
off_t  position,
ssize_t *  inoutSize,
uint32_t  flags
const [virtual]
 

The default implementation returns NULL.

Reimplemented from BStreamDatum.

void * StartWritingLocked const sptr< Stream > &  stream,
off_t  position,
ssize_t *  inoutSize,
uint32_t  flags
[virtual]
 

The default implementation returns NULL.

Reimplemented from BStreamDatum.

status_t StoreSizeLocked off_t  size  )  [virtual]
 

Derived classes must implement to set the total amount of data.

Implements BStreamDatum.

status_t StoreValueLocked const SValue value  )  [virtual]
 

The default implementation changes the contents of the datum to the value.

The datum is changed by calling StoreValueTypeLocked(), StoreSizeLocked(), and StoreLocked(). This is fairly inefficient, so you will want to provide your own implementation if possible.

Reimplemented from BStreamDatum.

status_t StoreValueTypeLocked uint32_t  type  )  [virtual]
 

The default implementation does nothing, returning B_UNSUPPORTED.

Reimplemented from BStreamDatum.

void Unlock  )  const [virtual]
 

Reimplemented to use the BIndexedDatumGenerator lock.

Reimplemented from BStreamDatum.

SValue ValueLocked  )  const [virtual]
 

The default implementation generates a new SValue from the datum.

The SValue is created by calling ValueTypeLocked(), SizeLocked(), and ReadLocked(). This is fairly inefficient, so you will want to provide your own implementation if possible. It will not attempt to return the datum as an SValue if the datum is larger than a reasonable size (a couple kilobytes).

Reimplemented from BStreamDatum.

uint32_t ValueTypeLocked  )  const [virtual]
 

The default implementation returns B_RAW_TYPE.

Reimplemented from BStreamDatum.


Member Data Documentation

ssize_t m_index
 

const sptr<SDatumGeneratorInt> m_owner
 


The documentation for this class was generated from the following files: