StrangeIoC  0.6.0
The IoC/Binding Framework for Unity3D and C#
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | Protected Attributes | Properties | List of all members
strange.extensions.context.impl.CrossContextBridge Class Reference

A relay for events mapped across multiple Contexts. More...

Inheritance diagram for strange.extensions.context.impl.CrossContextBridge:
strange.framework.impl.Binder strange.extensions.dispatcher.api.ITriggerable strange.framework.api.IBinder

Public Member Functions

override IBinding Bind (object key)
 Bind a Binding Key to a value.
 
bool Trigger< T > (object data)
 Cause this ITriggerable to access any provided Key in its Binder by the provided generic and data. More...
 
bool Trigger (object key, object data)
 Cause this ITriggerable to access any provided Key in its Binder by the provided key and data. More...
 
- Public Member Functions inherited from strange.framework.impl.Binder
delegate void BindingResolver (IBinding binding)
 A handler for resolving the nature of a binding during chained commands.
 
virtual IBinding Bind< T > ()
 Bind a Binding Key to a class or interface generic.
 
virtual IBinding GetBinding< T > ()
 Retrieve a binding based on the provided Type.
 
virtual IBinding GetBinding (object key)
 Retrieve a binding based on the provided object.
 
virtual IBinding GetBinding< T > (object name)
 Retrieve a binding based on the provided Key (generic)/Name combo.
 
virtual IBinding GetBinding (object key, object name)
 Retrieve a binding based on the provided Key/Name combo.
 
virtual void Unbind< T > ()
 Remove a binding based on the provided Key (generic)
 
virtual void Unbind (object key)
 Remove a binding based on the provided Key.
 
virtual void Unbind< T > (object name)
 Remove a binding based on the provided Key (generic) / Name combo.
 
virtual void Unbind (object key, object name)
 Remove a binding based on the provided Key / Name combo.
 
virtual void Unbind (IBinding binding)
 Remove the provided binding from the Binder.
 
virtual void RemoveValue (IBinding binding, object value)
 Remove a select value from the given binding.
 
virtual void RemoveKey (IBinding binding, object key)
 Remove a select key from the given binding.
 
virtual void RemoveName (IBinding binding, object name)
 Remove a select name from the given binding.
 
virtual IBinding GetRawBinding ()
 Generate an unpopulated IBinding in whatever concrete form the Binder dictates.
 
virtual void ResolveBinding (IBinding binding, object key)
 This method places individual Bindings into the bindings Dictionary as part of the resolving process. More...
 
virtual void OnRemove ()
 The Binder is being removed Override this method to clean up remaining bindings.
 

Protected Attributes

HashSet< object > eventsInProgress = new HashSet<object>()
 Prevents the currently dispatching Event from cycling back on itself.
 
- Protected Attributes inherited from strange.framework.impl.Binder
Dictionary< object, Dictionary
< object, IBinding > > 
bindings
 Dictionary of all bindings Two-layer keys. More...
 
Dictionary< object, Dictionary
< IBinding, object > > 
conflicts
 

Properties

IEventDispatcher crossContextDispatcher [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from strange.framework.impl.Binder
virtual void resolver (IBinding binding)
 The default handler for resolving bindings during chained commands.
 
void registerNameConflict (object key, IBinding newBinding, IBinding existingBinding)
 Take note of bindings that are in conflict. More...
 
bool isConflictCleared (Dictionary< IBinding, object > dict, IBinding binding)
 Returns true if the provided binding and the binding in the dict are no longer conflicting.
 
void clearConflict (object key, object name, Dictionary< IBinding, object > dict)
 
T[] spliceValueAt< T > (int splicePos, object[] objectValue)
 
object[] spliceValueAt (int splicePos, object[] objectValue)
 Remove the item at splicePos from the list objectValue.
 

Detailed Description

A relay for events mapped across multiple Contexts.

This simple class gates events fired by the local Context-wide EventDispatcher. Any event trigger mapped to this Binder will be relayed to the CrossContextDispatcher for consumption by others. This removes the necessity to ever inject the CrossContextDispatcher at an endpoint (e.g., a Command or Mediator).

Because the Bridge itself is mapped cross-context (and therefore shared), it is up to the developer to decide where to make cross-Context the mappings.

This "freedom" is also a potential pitfall; we recommend that you map all Cross-Context events in firstContext to avoid confusion.

Example:

crossContextBridge.Bind(GameEvent.MISSILE_HIT);

By doing this from any Context in your app, any Context Dispatcher that fires GameEvent.MISSILE_HIT will relay that Event to other Contexts.

Member Function Documentation

bool strange.extensions.context.impl.CrossContextBridge.Trigger ( object  key,
object  data 
)
inline

Cause this ITriggerable to access any provided Key in its Binder by the provided key and data.

Returns
false if the originator should abort dispatch

Implements strange.extensions.dispatcher.api.ITriggerable.

Cause this ITriggerable to access any provided Key in its Binder by the provided generic and data.

Returns
false if the originator should abort dispatch

Implements strange.extensions.dispatcher.api.ITriggerable.


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