Class Reference
- Namespace
- EzrSquared.Runtime
- Assembly
- ezrSquared-lib.dll
A reference to an IEzrObject, with its scope, usable name and more metadata.
public class Reference : IMutable<Reference>
- Inheritance
-
objectReference
- Implements
Remarks
It is recommended to get references from the ReferencePool instead of creating them manually.
Constructors
Reference(IEzrObject?, AccessMod, string)
A reference to an IEzrObject, with its scope, usable name and more metadata.
public Reference(IEzrObject? @object = null, AccessMod accessibilityModifiers = AccessMod.None, string name = "")
Parameters
object
IEzrObjectThe IEzrObject being referenced.
accessibilityModifiers
AccessModThe accessibility modifiers of the reference.
name
stringThe name of the reference.
Remarks
It is recommended to get references from the ReferencePool instead of creating them manually.
Fields
AccessibilityModifiers
The accessibility modifiers of the reference. See AccessMod.
public AccessMod AccessibilityModifiers
Field Value
Empty
Static readonly empty reference.
public static readonly Reference Empty
Field Value
Properties
IsEmpty
Does this reference actually reference anything?
public bool IsEmpty { get; private set; }
Property Value
- bool
IsRegistered
Is this reference registered anywhere, except RuntimeResults?
public bool IsRegistered { get; }
Property Value
- bool
IsRegisteredIncludingResult
Is this reference registered anywhere, including RuntimeResults?
public bool IsRegisteredIncludingResult { get; }
Property Value
- bool
Name
The name of the reference, may be string.Empty.
public string Name { get; private set; }
Property Value
- string
Object
The IEzrObject this references.
public IEzrObject Object { get; private set; }
Property Value
RegisteredContext
public Context? RegisteredContext { get; private set; }
Property Value
RegisteredIn
The number of other objects that have this reference registered.
public int RegisteredIn { get; private set; }
Property Value
- int
RegisteredInResult
Is this reference registered in a RuntimeResult?
public bool RegisteredInResult { get; private set; }
Property Value
- bool
Methods
DeepCopy(RuntimeResult)
Creates a copy of the reference AND the referenced object, if it is mutable.
public IMutable<Reference>? DeepCopy(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result to return errors in.
Returns
Remarks
This copy only includes the original's Object, AccessibilityModifiers and Name.
Reset(IEzrObject?, AccessMod, string)
Resets the reference.
public Reference Reset(IEzrObject? @object, AccessMod accessibilityModifiers, string name)
Parameters
object
IEzrObjectThe IEzrObject being referenced.
accessibilityModifiers
AccessModThe accessibility modifiers of the reference.
name
stringThe name of the reference.
Returns
ShallowCopy()
Creates a very shallow copy of the reference.
public Reference ShallowCopy()
Returns
- Reference
The copy.
Remarks
This copy only includes the original's Object and AccessibilityModifiers.
UpdateName(string)
Updates the reference with a new Name value.
public void UpdateName(string name)
Parameters
name
stringThe new name.
UpdateObject(IEzrObject, AccessMod)
Updates the reference with new Object and AccessibilityModifiers values.
public void UpdateObject(IEzrObject @object, AccessMod accessibilityModifiers = AccessMod.None)
Parameters
object
IEzrObjectThe new object to reference.
accessibilityModifiers
AccessModThe new accessibility modifiers.
UpdateRegister(bool)
Updates the reference with a new RegisteredIn value.
public void UpdateRegister(bool isRegistered)
Parameters
isRegistered
boolIs it an unregister or register operation?
UpdateRegisteredContext(Context?, Context?)
Updates the reference with a new RegisteredContext value.
public void UpdateRegisteredContext(Context? context, Context? releasingContext = null)
Parameters
context
ContextThe new context.
releasingContext
ContextThe context that may be deleted after this is called. If the referenced object's creation context matches this, it is updated.
Remarks
This does not actually change the Context this reference is defined in,
but it changes the reference to the Context this is defined in.
UpdateResultRegister(bool)
Updates the reference with a new RegisteredInResult value.
public void UpdateResultRegister(bool isRegistered)
Parameters
isRegistered
boolThe new value.