BBinder Class Reference

#include <support/Binder.h>

Inheritance diagram for BBinder:

IBinder SAtom BnCatalog BnCatalogPermissions BnCommand BnDatum BnInformant BnInformed BnInstallHandler BnInterface BnInterface< IByteInput > BnInterface< IByteOutput > BnInterface< IByteSeekable > BnInterface< IMemory > BnInterface< IMemoryDealer > BnInterface< IMemoryHeap > BnInterface< IStorage > BnInterface< IXMLOStr > BnIterable BnIterator BnNib BnNode BnNodeObserver BnProcess BnProcessManager BnProgress BnRandomIterator BnReferable BnSelector BnTable BnTerminalView BnUuid BnVirtualMachine BObserver List of all members.

Detailed Description

Standard implementation of IBinder for a Binder object.


Public Member Functions

virtual status_t AutobinderGet (const BAutobinderDef *def, void *result)
virtual status_t AutobinderInvoke (const BAutobinderDef *def, void **params, void *result)
virtual status_t AutobinderPut (const BAutobinderDef *def, const void *value)
const SContextContext () const
virtual status_t Effect (const SValue &in, const SValue &inBindings, const SValue &outBindings, SValue *out)
 Perform an action on the binder.
virtual SValue Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags=0)
 Probe binder for interface information.
virtual sptr< IInterfaceInterfaceFor (const SValue &descriptor, uint32_t flags=0)
 Retrieve direct interface for this binder.
virtual bool IsBinderAlive () const
 Return true if this binder still existed as of the last executed operation.
bool IsLinked () const
virtual status_t Link (const sptr< IBinder > &target, const SValue &bindings, uint32_t flags=0)
 Link registers the IBinder "target" for notification of events.
virtual status_t LinkToDeath (const sptr< BBinder > &target, const SValue &method, uint32_t flags=0)
 Register the IBinder "target" for a notification if this binder goes away.
virtual BBinderLocalBinder ()
 Use this function instead of a dynamic_cast<> to up-cast to a BBinder.
virtual status_t PingBinder ()
 Send a ping to the remote binder, and return status.
status_t Push (const SValue &out)
virtual BpBinderRemoteBinder ()
virtual status_t Transact (uint32_t code, SParcel &data, SParcel *reply=NULL, uint32_t flags=0)
 Low-level data transfer.
virtual status_t Unlink (const wptr< IBinder > &target, const SValue &bindings, uint32_t flags=0)
 Remove a mapping previously added by Link().
virtual status_t UnlinkToDeath (const wptr< BBinder > &target, const SValue &method, uint32_t flags=0)
 Remove a previously registered death notification.

Protected Member Functions

virtual status_t Asked (const SValue &what, SValue *out)
 BBinder (const BBinder &other)
 BBinder (const SContext &context)
 BBinder ()
virtual status_t Called (const SValue &func, const SValue &args, SValue *out)
virtual status_t HandleEffect (const SValue &in, const SValue &inBindings, const SValue &outBindings, SValue *out)
virtual bool HoldRefForLink (const SValue &binding, uint32_t flags)
 Control when links from this object will also hold references on the object.
virtual status_t Pull (SValue *inMaskAndDefaultsOutData)
virtual status_t Told (const SValue &what, const SValue &in)
virtual ~BBinder ()


Constructor & Destructor Documentation

BBinder  )  [protected]
 

BBinder const SContext context  )  [protected]
 

BBinder const BBinder other  )  [protected]
 

~BBinder  )  [protected, virtual]
 


Member Function Documentation

status_t Asked const SValue what,
SValue out
[protected, virtual]
 

status_t AutobinderGet const BAutobinderDef def,
void *  result
[virtual]
 

Implements IBinder.

status_t AutobinderInvoke const BAutobinderDef def,
void **  params,
void *  result
[virtual]
 

Implements IBinder.

status_t AutobinderPut const BAutobinderDef def,
const void *  value
[virtual]
 

Implements IBinder.

status_t Called const SValue func,
const SValue args,
SValue out
[protected, virtual]
 

const SContext & Context  )  const [inline]
 

Reimplemented in BGenericCatalog, BIndexedCatalog, and BTokenSource.

status_t Effect const SValue in,
const SValue inBindings,
const SValue outBindings,
SValue out
[virtual]
 

Perform an action on the binder.

Either a get, put, or invocation, depending on the supplied and requested bindings.

Implements IBinder.

Reimplemented in BnByteInput, BnByteOutput, and BnByteSeekable.

status_t HandleEffect const SValue in,
const SValue inBindings,
const SValue outBindings,
SValue out
[protected, virtual]
 

Reimplemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BnByteInput, BnByteOutput, BnByteSeekable, BnMemoryHeap, BnMemory, BnMemoryDealer, BnStorage, and BObserver.

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

Control when links from this object will also hold references on the object.

The default implementation always returns false, meaning references are never held. You can override this to return true when you would like a new linking being adding to this BBinder to also cause a reference to be added to it. This is useful, for example, when dynamically creating objects on demand -- in that case, you usually want the object to stay around as long as others have references on them or there are active links from it. If you allow the object to be destroyed while links exist, the next time someone accesses the object a new one will be created and any changes to it will not push the links on the old object.

Reimplemented in BSchemaRowIDJoin::RowNode, BSchemaTableNode::RowNode, SDatumGeneratorInt::IndexedDatum, and BIndexedTableNode::RowNode.

SValue Inspect const sptr< IBinder > &  caller,
const SValue which,
uint32_t  flags = 0
[virtual]
 

Probe binder for interface information.

Return interfaces implemented by this binder object that are requested by which. This is a composition of all interfaces, expressed as { descriptor -> binder } mappings, which are selected through which.

Much more information on Inspect() can be found at Binder Inspect() Details.

Implements IBinder.

Reimplemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BSchemaDatabaseNode, BSchemaRowIDJoin, BSchemaRowIDJoin::RowNode, BSchemaRowIDJoin::JoinIterator, BSchemaTableNode, BSchemaTableNode::RowNode, BSchemaTableNode::QueryIterator, BCatalogDelegate, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, BIndexedDataNode, BIndexedIterable::IndexedIterator, BIndexedTableNode, BStreamDatum::Stream, BnInterface, BByteStream, BReadOnlyStream, BWriteOnlyStream, BGenericCatalog, BIndexedCatalog, BCatalogMirror, BIOSStream, BMemoryStore, BNullStream, BPipe, BTokenSource, BnInterface< IStorage >, BnInterface< IMemoryDealer >, BnInterface< IXMLOStr >, BnInterface< IMemory >, BnInterface< IByteOutput >, BnInterface< IByteInput >, BnInterface< IMemoryHeap >, and BnInterface< IByteSeekable >.

sptr< IInterface > InterfaceFor const SValue descriptor,
uint32_t  flags = 0
[virtual]
 

Retrieve direct interface for this binder.

Given a SValue interface descriptor, return an IInterface implementing it. The default implementation of this function returns NULL, meaning it does not implement a direct interface to it. If the return is non-NULL, you are guaranteed to be able to static_cast<> the returned interface into the requested subclass and have it work.

Note that this is NOT the same as calling Inspect(), which performs conversion between different IBinder objects. This method converts to an IInterface only for this binder object.

Implements IBinder.

Reimplemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BnInterface, BnInterface< IStorage >, BnInterface< IMemoryDealer >, BnInterface< IXMLOStr >, BnInterface< IMemory >, BnInterface< IByteOutput >, BnInterface< IByteInput >, BnInterface< IMemoryHeap >, and BnInterface< IByteSeekable >.

bool IsBinderAlive  )  const [virtual]
 

Return true if this binder still existed as of the last executed operation.

Implements IBinder.

bool IsLinked  )  const
 

status_t Link const sptr< IBinder > &  target,
const SValue bindings,
uint32_t  flags = 0
[virtual]
 

Link registers the IBinder "target" for notification of events.

The bindings is a mapping of keys that will get pushed on this IBinder, to keys that will get pushed on the "target" IBinder. e.g.

  • If you call link thus: binder1->Link(binder2, SValue("A", "B"));
  • When "A" is pushed on binder1: binder1->Push(SValue("A", "C"));
  • The following will get called on binder2: binder2->Effect(SValue("B", "C"), SValue::wild, SValue::undefined, NULL);

Implements IBinder.

Reimplemented in BNodeDelegate, BnByteInput, BnByteOutput, BnByteSeekable, and BCatalogMirror.

status_t LinkToDeath const sptr< BBinder > &  target,
const SValue method,
uint32_t  flags = 0
[virtual]
 

Register the IBinder "target" for a notification if this binder goes away.

The method is the name of a method to call if this binder unexpectedly goes away. This is accomplished by performing an Effect() on target with the given method. Prior to doing so, a mapping { 0 -> this } is added to the method name, so that the first parameter of the function is the dying binder. I.e., your method should look like:

SomethingDied(const wptr<IBinder>& who)

Note:
You will only receive death notifications for remote binders, as local binders by definition can't die without you dying as well.

This link always holds a weak reference to its target.

You will only receive a weak reference to the dead binder. You should not try to promote this to a strong reference. (Nor should you need to, as there is nothing useful you can directly do with it now that it has passed on.)

Implements IBinder.

BBinder * LocalBinder  )  [virtual]
 

Use this function instead of a dynamic_cast<> to up-cast to a BBinder.

Since multiple BBinder instances can appear in a single object, a regular dynamic_cast<> is ambiguous. Note that there is a default implementation of this (which returns NULL) so that we can call the method even if the object has been destroyed. (That is, if we only have a weak reference on it.)

Reimplemented from IBinder.

status_t PingBinder  )  [virtual]
 

Send a ping to the remote binder, and return status.

If this is a local binder, ping always returns B_OK. If this is a remote binder, it performs a Transact() to the local binder and returns that status. This should be either B_OK or B_BINDER_DEAD.

Implements IBinder.

status_t Pull SValue inMaskAndDefaultsOutData  )  [protected, virtual]
 

status_t Push const SValue out  ) 
 

virtual BpBinder* RemoteBinder  )  [virtual]
 

status_t Told const SValue what,
const SValue in
[protected, virtual]
 

status_t Transact uint32_t  code,
SParcel data,
SParcel reply = NULL,
uint32_t  flags = 0
[virtual]
 

Low-level data transfer.

This is the Binder's IPC primitive. It allows you to send a parcel of data to another Binder (possibly in another process or language) and get a parcel of data back. The parcel can contain IBinder objects to transfer references between environments. The code can be any arbitrary value, though some standard codes are defined for parts of the higher-level IBinder protocol (B_EFFECT_TRANSACTION, B_INSPECT_TRANSACTION, etc). The flags are used for internal IPC implementation and must always be set to 0 when calling. If your implementation of Transact() returns an error code (instead of B_OK), that code will be propagated back to the caller WITHOUT any reply data.

Implements IBinder.

Reimplemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BnByteInput, BnByteOutput, BnByteSeekable, BnMemoryHeap, BnMemory, BnMemoryDealer, and BnStorage.

status_t Unlink const wptr< IBinder > &  target,
const SValue bindings,
uint32_t  flags = 0
[virtual]
 

Remove a mapping previously added by Link().

Implements IBinder.

Reimplemented in BNodeDelegate, BnByteInput, BnByteOutput, BnByteSeekable, and BCatalogMirror.

status_t UnlinkToDeath const wptr< BBinder > &  target,
const SValue method,
uint32_t  flags = 0
[virtual]
 

Remove a previously registered death notification.

The target and method must exactly match the values passed in to LinkToDeath().

Implements IBinder.


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