#include <support/TokenSource.h>
Inheritance diagram for BTokenSource:
When you create one of these, and access the "token" ICatalog property, or the GetToken method, it returns you an SValue containing an IBinder. If someone else already has a reference to this IBinder, it gives you the same one. If nobody else has it, it gives you a new one. When the IBinder is created, a binder method you specify is called on an object you specify. When the last reference on the IBinder is released, another binder method is called.
To specify which objects and binder calls are made, pass the following into the args parameter of the constructor:
args=@{ acquired->{ object->$target, call->$bindercall }, released->{ object->$target, call->$bindercall } }
bindercall=@{ FunctionName } bindercall=@{ FunctionName->0->arg0 } bindercall=@{ FunctionName->{ 0->arg0, 1->arg1 }
Public Member Functions | |
BTokenSource (const SContext &context, const SValue &args) | |
SValue | GetToken () |
virtual status_t | HandleMessage (const SMessage &msg) |
Subclasses override this to receive messages. | |
virtual void | InitAtom () |
Called the first time a strong reference is acquired. All significant object initialization should go here. | |
virtual SValue | Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags=0) |
Probe binder for interface information. | |
virtual | ~BTokenSource () |
INode Interface | |
virtual sptr< INode > | Attributes () const |
Retrieve the meta-data catalog associated with this node, or NULL if it doesn't exist. | |
virtual nsecs_t | CreationDate () const |
Retrieve the "creationDate" meta-data entry, or 0 of it doesn't exist. | |
virtual SString | MimeType () const |
Retrieve the "mimeType" meta-data entry, or "" if it doesn't exist. | |
virtual nsecs_t | ModifiedDate () const |
Retrieve the "modifiedDate" meta-data entry, or 0 of it doesn't exist. | |
virtual void | SetCreationDate (nsecs_t value) |
Retrieve the "creationDate" meta-data entry, or 0 of it doesn't exist. | |
virtual void | SetMimeType (const SString &value) |
Retrieve the "mimeType" meta-data entry, or "" if it doesn't exist. | |
virtual void | SetModifiedDate (nsecs_t value) |
Retrieve the "modifiedDate" meta-data entry, or 0 of it doesn't exist. | |
virtual status_t | Walk (SString *path, uint32_t flags, SValue *node) |
Walk through the namespace based on the given path. | |
IIterable Interface | |
virtual sptr< IIterator > | NewIterator (const SValue &args, status_t *error) |
Walk through the namespace based on the given path. | |
Protected Member Functions | |
const SContext & | Context () const |
Friends | |
class | Token |
Classes | |
class | Token |
|
|
|
|
|
Retrieve the meta-data catalog associated with this node, or NULL if it doesn't exist. The INode interface also supplies access to meta-data associated with the object. The "attributes" read-only property provides direct access to the meta-data node, which is a pointer to another separate INode holding the meta-data. A node may not support meta-data, in which case the attributes property will return NULL. You will not usually use this property directly, instead using the mimeType, creationDate, and modifiedDate properties to read/write the standard attributes. Also see Walk() for how you can retrieve these and other attributes through the normal path traversal mechanism. Implements INode. |
|
Reimplemented from BBinder. |
|
Retrieve the "creationDate" meta-data entry, or 0 of it doesn't exist.
Implements INode. |
|
|
|
Subclasses override this to receive messages.
Reimplemented from SHandler. |
|
Called the first time a strong reference is acquired. All significant object initialization should go here. You can override it and do any setup you need. Note that you do not need to call the SAtom implementation. (So you can derive from two different SAtom implementations and safely call down to both of their IncStrong() methods.)
Reimplemented from SAtom. |
|
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. Reimplemented from BnIterable. |
|
Retrieve the "mimeType" meta-data entry, or "" if it doesn't exist.
Implements INode. |
|
Retrieve the "modifiedDate" meta-data entry, or 0 of it doesn't exist.
Implements INode. |
|
Walk through the namespace based on the given path.
Clients should usually use SIterator instead of calling NewIterator() directly. The options parameter is used to control what data is returned by the iterator. The available options are fairly implementation-dependent, but some common ones are described here. Because you can not know what any given IIterable object will be able to do, the IIterator interface you get back has a read-only options property with which you can find out how it is configured. Any of the options supplied to IIterate() that it understands will be propagated to the options property in the form it understood them.
See Binder Data Model for more detail on these options.
Implements IIterable. |
|
Retrieve the "creationDate" meta-data entry, or 0 of it doesn't exist.
Implements INode. |
|
Retrieve the "mimeType" meta-data entry, or "" if it doesn't exist.
Implements INode. |
|
Retrieve the "modifiedDate" meta-data entry, or 0 of it doesn't exist.
Implements INode. |
|
Walk through the namespace based on the given path.
If the node supports attributes then the Walk() method will allow you to traverse directly to them. This is accomplished by reserving path names whose first character is ":" to indicate that the name is part of the attribute namespace. Thus a Walk() of just the path ":" will return the attributes catalog (and continue walking into it if needed); for a name with ':' as a prefix and additional text the node strips off the ':' and then calls Walk() on the attributes catalog with the remaining text. Clients will generally not call Walk() directly, instead relying on SNode::Walk(). The latter hides a lot of the complexity of INode::Walk() that we will discuss later. The flags parameter allows you to control how the namespace walks your supplied path. These allow you to request optimizations to how INode returns its result (REQUEST_DATA, COLLAPSE_NODE), and what it should do if segments of the path don't exist (CREATE_DATUM, CREATE_NODE). The REQUEST_DATA and COLLAPSE_NODE flags are optimization hints that allow you to bypass the "everything is an object" property of the namespace in certain situations. An INode is not required to honor these requests (and indeed may be entirely unable to do so), so when using them it is the client's responsibility to deal with such a failure.
You can combine REQUEST_DATA and COLLAPSE_NODE to ask for the final node to return an SValue mapping, where each value is actually data. If you use COLLAPSE_NODE without REQUEST_DATA, you will receive SValue mappings where the values are IDatum objects.
Implements INode. |
|
|