Class AnonymousRenderer<T>
A renderer that invokes its callbacks.
This class is useful when you want an one-use ad-hoc implementation (i.e., Java-style anonymous class) of IRenderer<T> interface.
Implements
IRenderer<T>
Namespace: Libplanet.Blockchain.Renderers
Assembly: Libplanet.dll
Syntax
public class AnonymousRenderer<T> : object, IRenderer<T> where T : IAction, new()
Type Parameters
Name | Description |
---|---|
T | An IAction type. It should match to BlockChain<T>'s type parameter. |
Examples
With object initializers, you can easily make an one-use renderer:
var renderer = new AnonymousRenderer<ExampleAction>
{
BlockRenderer = (oldTip, newTip) =>
{
// Implement RenderBlock() here.
};
};
Properties
| Improve this Doc View SourceBlockRenderer
A callback function to be invoked together with RenderBlock(Block<T>, Block<T>).
Declaration
public Action<Block<T>, Block<T>>? BlockRenderer { get; set; }
Property Value
Type | Description |
---|---|
Nullable<Libplanet.Action<Block<T>, Block<T>>> |
ReorgEndRenderer
A callback function to be invoked together with RenderReorgEnd(Block<T>, Block<T>, Block<T>).
Declaration
public Action<Block<T>, Block<T>, Block<T>>? ReorgEndRenderer { get; set; }
Property Value
Type | Description |
---|---|
Nullable<Libplanet.Action<Block<T>, Block<T>, Block<T>>> |
ReorgRenderer
A callback function to be invoked together with RenderReorg(Block<T>, Block<T>, Block<T>).
Declaration
public Action<Block<T>, Block<T>, Block<T>>? ReorgRenderer { get; set; }
Property Value
Type | Description |
---|---|
Nullable<Libplanet.Action<Block<T>, Block<T>, Block<T>>> |
Methods
| Improve this Doc View SourceRenderBlock(Block<T>, Block<T>)
Declaration
public void RenderBlock(Block<T> oldTip, Block<T> newTip)
Parameters
Type | Name | Description |
---|---|---|
Block<T> | oldTip | |
Block<T> | newTip |
RenderReorg(Block<T>, Block<T>, Block<T>)
Declaration
public void RenderReorg(Block<T> oldTip, Block<T> newTip, Block<T> branchpoint)
Parameters
Type | Name | Description |
---|---|---|
Block<T> | oldTip | |
Block<T> | newTip | |
Block<T> | branchpoint |
RenderReorgEnd(Block<T>, Block<T>, Block<T>)
Declaration
public void RenderReorgEnd(Block<T> oldTip, Block<T> newTip, Block<T> branchpoint)
Parameters
Type | Name | Description |
---|---|---|
Block<T> | oldTip | |
Block<T> | newTip | |
Block<T> | branchpoint |