BinderShell.h

Go to the documentation of this file.
00001 
01110     void EntryCreated(INode who, SString name, IBinder entry);
01111     
01112     ...
01113 }
01114 @endcode
01115 
01116 Given that, let's write a shell function that handles the same
01117 method signature:
01118 
01119 @verbatim
01120 /# function handleEntryCreated() {
01121     echo "Created: parent=" $1
01122     echo "Created: name=" $2
01123     echo "Created: entry=" $3
01124 }
01125 @endverbatim
01126 
01127 We can now use the @c link shell command to set up a link from the @c /services
01128 directory to our new shell method.
01129 
01130 @verbatim
01131 /# n=$[inspect /services org.openbinder.support.INode]
01132 Result: sptr<IBinder>(0x8091dc4 8BCatalog)
01133 
01134 /# link $n $SELF @{EntryCreated->handleEntryCreated}
01135 @endverbatim
01136 
01137 This says "make a link from the object @c $n to the object @c $SELF, such that
01138 when @c EntryCreated is pushed from @c $n we will have the @c handleEntryCreated
01139 method called on @c $SELF".  And thus, upon adding a new entry to
01140 @c /services, we will see this:
01141 
01142 @verbatim
01143 /# publish /services/test linktest
01144 Publishing: /services/test
01145 /# Created: parent= SValue(sptr<IBinder>(0xb69063f4 8BCatalog))
01146 Created: name= test
01147 Created: entry= SValue(sptr<IBinder>(0x8081254 N18SDatumGeneratorInt12IndexedDatumE))
01148 @endverbatim
01149 
01150 Links are a very powerful mechanism, though not the only way to achieve the
01151 same result.  Depending on your needs, you can just as well write your own
01152 notification mechanism for a specialized purpose, or use IInformant for
01153 a more generalized implementation of broadcasting without using links.
01154 A plain link, however, has significant advantages in being clearly documented
01155 in IDL and a standard mechanism that many other things will be able to use
01156 without being written specifically to receive your event.
01157 
01158 
01159 */
01160 
01164 
01360 
01361 
01362 
01363