A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and use of a set of nested sources references.
More...
|
virtual void | AfterMembersCloned (APIType originalResource) |
| Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
|
|
A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and use of a set of nested sources references.
Definition at line 65 of file Nested.cs.
◆ Sources() [1/5]
AnalyzeRe.Layers.Nested.Sources.Sources |
( |
| ) |
|
|
inline |
Construct a new empty sources list.
Definition at line 73 of file Nested.cs.
◆ Sources() [2/5]
Construct a new sources list and bind its internal list of references to the supplied source list.
- Parameters
-
sources | The list of IReference<ILayerSource> to use as the new sources internal list. |
This constructor will use the supplied list (by assigning it to the References property) rather than copy its elements, therefore any changes to the supplied sources list will be reflected in this sources list and vice-versa.
Definition at line 86 of file Nested.cs.
◆ Sources() [3/5]
Construct a new sources list by copying the enumerable of references with the expected compile-time type into this sources list.
- Parameters
-
sources | The source reference Layers or LayerViews to be added to the list. |
The elements in this enumerable will be copied into this sources list, so any changes to the source enumerable after construction will not be reflected.
Definition at line 97 of file Nested.cs.
◆ Sources() [4/5]
AnalyzeRe.Layers.Nested.Sources.Sources |
( |
params IReference[] |
sources | ) |
|
|
inline |
Construct a new sources list from any number of references arguments.
- Parameters
-
sources | The source references to be added to the list. |
References that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). To control this behaviour, use the Sources(IEnumerable<IReference>,Boolean) constructor.
Definition at line 108 of file Nested.cs.
◆ Sources() [5/5]
AnalyzeRe.Layers.Nested.Sources.Sources |
( |
IEnumerable< IReference > |
sources, |
|
|
bool |
automaticTyping = true |
|
) |
| |
|
inline |
Construct a new sources list from any enumerable of references.
- Parameters
-
sources | The source references to be added to the list. |
automaticTyping | By default, references that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). Set this to false if you would rather raise an InvalidCastException when the reference type is unknown. |
References will be validated at runtime,
Definition at line 118 of file Nested.cs.
◆ Add() [1/4]
void AnalyzeRe.Layers.Nested.Sources.Add |
( |
ILayer |
layer | ) |
|
Add an inlined IReference<Layer> to this nested layer's sources.
- Parameters
-
layer | A layer instance to include in the source list. |
Currently, it is only valid to inline a layer definition if this Nested layer will be included as part of a LayerView definition. Nested layers saved to the "/layers" collection endpoint can only reference other saved layers.
If this layer has an "id" property, the server will treat it as a normal reference rather than an inlined layer definition. You must remove the id of this layer before adding it as a source if you wish to force it to be inlined.
◆ Add() [2/4]
void AnalyzeRe.Layers.Nested.Sources.Add |
( |
IReference |
reference, |
|
|
bool |
automaticTyping = true |
|
) |
| |
Allows a weakly-typed reference to be added to this collection, with the possibility of runtime checking.
- Parameters
-
reference | The reference to add to the list of sources. |
automaticTyping | By default, references that don't have a strong runtime type, such as Reference<IAPIResource>, will automatically get converted to a layer reference (which is the default reference type used by the server when no IReference.reference_type is specified). Set this to false if you would rather raise an InvalidCastException when the reference type is unknown. |
◆ Add() [3/4]
Add a IReference<ILayer> (saved Layer reference) to this nested layer's sources.
- Parameters
-
layerReference | An existing saved layer referenced by its id. |
This can also take an inlined layer reference, but for convenience and clarity, you may wish to use the Add(ILayer) overload instead.
◆ Add() [4/4]
Add a IReference<ILayerView> (LayerView reference) to this nested layer's sources.
- Parameters
-
layerViewReference | An existing layer_view referenced by its id. |
Currently, it is only valid to reference a layer_view if this Nested layer will be included as part of a LayerView definition. Nested layers saved to the "/layers" collection endpoint can only reference other saved layers.
The server does not support inlined layer_view references (e.g. a LayerView definition that has not been posted)
The server will require the referenced layer_view's analysis profile to match that of the layer_view containing this nested layer.
◆ AfterMembersCloned()
virtual void AnalyzeRe.APIType.AfterMembersCloned |
( |
APIType |
originalResource | ) |
|
|
inlineprotectedvirtualinherited |
Invoked following construction if the current instance has been created using a member-wise clone of some other instance. Override if your derived APIType class contains some members that should not be cloned.
Overriding implementations should be sure to invoke base.AfterMembersCloned().
A sane question for a code reviewer to ask might be: "Why not avoid copying those members in the first place?" The answer is that there is no framework-supported method of excluding members from a MemberwiseClone. The only officially supported solution is to not use the object.MemberwiseClone method at all and instead have each class implement it's own Copy method. In our case, most objects have no need to specialize their copy implementation (even though they could - the ShallowCopy<T> method is marked virtual). It's simpler to simply "correct" any special-case members after the fact, and requires less error-prone code than if the code were responsible for ensuring no members were missed in a copy. It's also faster than any reflection-based approach, even though such an approach could benefit from custom attributes meant to exclude certain members from copying.
Reimplemented in AnalyzeRe.APITypes.APIResource_WithDataEndpoint, AnalyzeRe.APIResourceView.BaseAPIResourceView, AnalyzeRe.Distributions.CustomDistribution, AnalyzeRe.LossSets.LossSet_WithData, AnalyzeRe.Optimization.Candidate, AnalyzeRe.Optimization.OptimizationView, and AnalyzeRe.StaticSimulation.
Definition at line 37 of file APIType.cs.
◆ Clear()
void AnalyzeRe.Layers.Nested.Sources.Clear |
( |
| ) |
|
◆ Contains()
◆ CopyTo()
◆ GetEnumerator()
◆ IndexOf()
◆ Insert()
◆ operator List< IReference< ILayerSource > >()
Automatically casts a Sources instance to a List by returning its internal list.
Exists to aid with backwards compatibility, as the sources property used to be this type.
◆ operator Sources() [1/2]
Automatically copies a list of ILayer references into a newly constructed SourcesList instance.
Exists to aid with backwards compatibility, as the sources property used to be this type.
◆ operator Sources() [2/2]
Automatically casts a list of ILayerSource references to a SourcesList instance that wraps and is bound to the original list.
Exists to aid with backwards compatibility, as the sources property used to be this type.
◆ Remove()
◆ RemoveAt()
void AnalyzeRe.Layers.Nested.Sources.RemoveAt |
( |
int |
index | ) |
|
◆ ShallowCopy< T >()
virtual T AnalyzeRe.APIType.ShallowCopy< T > |
( |
| ) |
|
|
inlinevirtualinherited |
Create a shallow copy of this object.
- See also
- ExtensionMethods.DeepCopy<T>
for a serializer-based copy method.
- Returns
- A shallow copy of this object.
If this object contains any members that reference the current object (this), the class should override this method to avoid cloning a reference to the old class.
Implements AnalyzeRe.IAPIType.
Definition at line 14 of file APIType.cs.
◆ Count
int AnalyzeRe.Layers.Nested.Sources.Count |
|
get |
◆ IsReadOnly
bool AnalyzeRe.Layers.Nested.Sources.IsReadOnly |
|
get |
◆ References
The underlying list of IReference<ILayerSource> references.
Definition at line 69 of file Nested.cs.
◆ this[int index]
The documentation for this class was generated from the following file: