AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
SyncPrimitive.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 namespace HoloToolkit.Sharing.SyncModel
5 {
10  public abstract class SyncPrimitive
11  {
12  protected string fieldName;
13  private XString xStringFieldName;
15 
19  public long Guid
20  {
21  get
22  {
23  return internalElement != null ? internalElement.GetGUID() : SharingClient.kInvalidXGuid;
24  }
25  }
26 
30  public virtual Element NetworkElement
31  {
32  get { return internalElement; }
33  protected set { internalElement = value; }
34  }
35 
40  public bool HasNetworkElement
41  {
42  get { return internalElement != null; }
43  }
44 
48  public XString XStringFieldName
49  {
50  get { return xStringFieldName; }
51  }
52 
56  public string FieldName
57  {
58  get { return fieldName; }
59 
60  set
61  {
62  fieldName = value;
63  xStringFieldName = new XString(value);
64  }
65  }
66 
67 #if UNITY_EDITOR
68  public abstract object RawValue
73  {
74  get;
75  }
76 #endif
77 
82  public SyncPrimitive(string field)
83  {
84  FieldName = field;
85  }
86 
91  public abstract void InitializeLocal(ObjectElement parentElement);
92 
97  public abstract void AddFromRemote(Element remoteElement);
98 
103  public virtual void UpdateFromRemote(XString remoteValue) { }
104 
109  public virtual void UpdateFromRemote(float remoteValue) { }
110 
115  public virtual void UpdateFromRemote(double remoteValue) { }
116 
121  public virtual void UpdateFromRemote(int remoteValue) { }
122 
127  public virtual void UpdateFromRemote(long remoteValue) { }
128 
133  public virtual void UpdateFromRemote(bool remoteValue) { }
134  }
135 }
SyncPrimitive(string field)
Base Constructor for Sync Primitives.
virtual void UpdateFromRemote(long remoteValue)
Called when the primitive value has changed from a remote action.
virtual void UpdateFromRemote(double remoteValue)
Called when the primitive value has changed from a remote action.
virtual void UpdateFromRemote(bool remoteValue)
Called when the primitive value has changed from a remote action.
Base primitive used to define an element within the data model. The primitive is defined by a field a...
virtual long GetGUID()
Definition: Element.cs:48
virtual void UpdateFromRemote(XString remoteValue)
Called when the primitive value has changed from a remote action.
virtual void UpdateFromRemote(float remoteValue)
Called when the primitive value has changed from a remote action.
virtual void UpdateFromRemote(int remoteValue)
Called when the primitive value has changed from a remote action.