ctrlX Data Layer .NET API  6.0.1
Loading...
Searching...
No Matches
NotifyItem.cs
1
2using comm.datalayer;
3using Google.FlatBuffers;
4using System;
5
6namespace Datalayer
7{
11 public sealed class NotifyItem : INotifyItem
12 {
13 #region Internal Ctors
14
20 internal unsafe NotifyItem(NativeMethods.DLR_NOTIFY_ITEM notifyItem)
21 {
22 // We have to clone the values (original object owned by ANSI-C API)
23 Value = new Variant(notifyItem.data).Clone();
24 Info = new Variant(notifyItem.info).Clone();
25 }
26
27 #endregion
28
29 #region Public Ctors
30
37 public NotifyItem(IVariant value, IVariant info)
38 {
39 if (value == null)
40 {
41 throw new ArgumentNullException(nameof(value));
42 }
43
44 if (info == null)
45 {
46 throw new ArgumentNullException(nameof(info));
47 }
48
49 Value = value;
50 Info = info;
51 }
52
59 public NotifyItem(IVariant value, NotifyInfoT info)
60 {
61 if (value == null)
62 {
63 throw new ArgumentNullException(nameof(value));
64 }
65
66 if (info == null)
67 {
68 throw new ArgumentNullException(nameof(info));
69 }
70
71 Value = value;
72 var builder = new FlatBufferBuilder(Variant.DefaultFlatbuffersInitialSize);
73 NotifyInfo.FinishNotifyInfoBuffer(builder, NotifyInfo.Pack(builder, info));
74 Info = new Variant(builder);
75 }
76
77 #endregion
78
82 public IVariant Value { get; }
83
87 public IVariant Info { get; }
88 }
89}
Provides the implementation for INotifyItem.
Definition: NotifyItem.cs:12
NotifyItem(IVariant value, NotifyInfoT info)
Initializes a new instance of the NotifyItem class.
Definition: NotifyItem.cs:59
IVariant Value
Gets the value.
Definition: NotifyItem.cs:82
IVariant Info
Gets the info.
Definition: NotifyItem.cs:87
NotifyItem(IVariant value, IVariant info)
Initializes a new instance of the NotifyItem class.
Definition: NotifyItem.cs:37
Provides the implementation for IVariant.
Definition: Variant.cs:19
static readonly int DefaultFlatbuffersInitialSize
Gets the default Flatbuffers initial size in bytes.
Definition: Variant.cs:748
Variant Clone()
Clones the instance.
Definition: Variant.cs:1637
The INotifyItem interface.
Definition: INotifyItem.cs:7
The IVariant interface.
Definition: IVariant.cs:10