Class Observer<T>
Base class for observers that can be visited as part of a subscription tree.
Inherited Members
Namespace: Reaqtive
Assembly: Reaqtive.Core.dll
Syntax
public abstract class Observer<T> : ObserverBase<T>, IObserver<T>, IOperator, ISubscription, IDisposable
Type Parameters
Name | Description |
---|---|
T | Type of the elements received by the observer. |
Constructors
Observer()
Creates a new observer instance.
Declaration
protected Observer()
Properties
Inputs
Gets the inputs of the observer.
Declaration
public IEnumerable<ISubscription> Inputs { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISubscription> |
IsDisposed
Gets a flag indicating whether observer is disposed.
Declaration
protected bool IsDisposed { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Accept(ISubscriptionVisitor)
Accepts a visitor that will be dispatched through the subscription.
Declaration
public void Accept(ISubscriptionVisitor visitor)
Parameters
Type | Name | Description |
---|---|---|
ISubscriptionVisitor | visitor | Visitor to accept. |
Dispose()
Disposes the current observer instance.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes the object.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true if called from System.IDisposable.Dispose; otherwise, false. |
OnDispose()
Performs custom operations upon disposing the observer.
Declaration
protected virtual void OnDispose()
OnStart()
Performs custom operations upon starting the observer.
Declaration
protected virtual void OnStart()
OnSubscribe()
Defines behavior immediately after the observer is used in a subscription.
Declaration
protected virtual IEnumerable<ISubscription> OnSubscribe()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ISubscription> | Enumerable containing the subscriptions. |
SetContext(IOperatorContext)
Sets the operator context on the observer.
Declaration
public virtual void SetContext(IOperatorContext context)
Parameters
Type | Name | Description |
---|---|---|
IOperatorContext | context | Operator context to set on the observer. |
Start()
Starts the observer.
Declaration
public void Start()
Subscribe()
Initializes Inputs by calling OnSubscribe().
Declaration
public virtual void Subscribe()