Type parameters:
| T | The data type that this structure maintains. Must implement IGH_Goo or derive from a class that implements IGH_Goo. where IGH_Goo |
Constructors
GH_Structure
#Copy constructor, duplicate another data structure.
Parameters:
| other (GH_Structure<T>) | Structure to copy, if null, this structure will be empty. |
| shallowCopy (bool) | If True, data item pointers are shared among this and the [other] structure. |
Properties
Branch
#Gets a limited access pointer to the data list associated with a certain path.
Branch
#Gets a limited access pointer to the data list at the specified index
Branches
#Gets a list of all the data-arrays in this structure
DataItem
#Gets a direct pointer to a data item under a specific path and index.
Exceptions:
| NullReferenceException | Thrown if the path doesn't exist. |
| IndexOutOfRangeException | Thrown if the index does not exist within the path list. |
DataItem
#Gets the item at a given offset. The structure is treated as a linear list in this case. If index is out of range, null is returned. For repeated indexed retrieval, consider using a For Each loop since the enumerator is more efficient.
Parameters:
| index (int) | Offset of item to retrieve |
Exceptions:
| IndexOutOfRangeException | Thrown if index is smaller than zero or larger than the size of the collection |
FirstItem
#Gets the first item in the structure. If no such item exists, null is returned.
Parameters:
| filter_nulls (bool) | If True, nulls will be skipped. |
IsEmpty
#Gets the Empty state of the structure. If the structure is Empty it contains no paths and no branches.
Implements: IsEmpty
LastItem
#Gets the last item in the structure. If no such item exists, null is returned.
Parameters:
| filter_nulls (bool) | If True, nulls will be skipped. |
NonNulls
#Get an enumerator for this structure that allow linear iteration over the data hierarchy while skipping all Null entries. This Enumerator has been optimized, do not cache instances of it.
Path
#Gets the data path at the specified index.
Parameters:
| index (int) | Index of path to retrieve. |
Exceptions:
| IndexOutOfRangeException | Thrown if the index does not represent a valid path. |
Implements: Path
StructureProxy
#Gets a proxy list of all the data-arrays in this structure.
Implements: StructureProxy
TopologyDescription
#Gets a description of the topology of the structure. Useful for debugging purposes.
Implements: TopologyDescription
Indexers
DataList
#Gets a direct pointer to the list of data under a specific path.
Parameters:
| path (GH_Path) | Path of the data branch to retrieve. If the path doesn't exist, null is returned. |
DataList
#Gets a direct pointer to the list of data under the specified index.
Parameters:
| index (int) | Index of the data branch to retrieve. |
Exceptions:
| IndexOutOfRangeException | Thrown if the index does not represent a valid branch. |
Methods
Append
#Append a data item to the specified branch in the structure. If the branch doesn't exist yet, it will be created.
Parameters:
| data (T) | Data to append |
| path (GH_Path) | Data path |
Append
#public void Append(T data)
Append a data item to the last branch in the structure. If no branch exist yet, a new one will be created with [path = {0}]
Parameters:
| data (T) | Data to append. |
AppendRange
#Append a list of data items to the specified branch in the structure. If the branch doesn't exist yet, it will be created.
Parameters:
| data (IEnumerable<T>) | Data to append |
| path (GH_Path) | Data path |
AppendRange
#Append a list of data items to the last branch in the structure
Parameters:
| data (IEnumerable<T>) | Data to append |
ClearData
#public void ClearData()
Removes all data from all paths without affecting the structure topology.
Implements: ClearData
DataDescription
#Gets a description of the data contained in this structure.
Parameters:
| includeIndices (bool) | If true, every data item will be prefixed by its index. |
| includePaths (bool) | If true, every branch of data will be preceded by the path. |
Returns: A string describing the data.
Implements: DataDescription
DuplicateCast<Q>
#Create a duplicate of this structure in a different type.
Parameters:
| conversion (GH_Structure<T>.ConversionDelegate<T, Q>) | Conversion delegate. |
Returns: A duplicate of this structure with all valid casts.
EnsureCapacity
#Ensures that all current branches have a certain capacity.
Parameters:
| capacity (int) | Capacity per branch. |
Implements: EnsureCapacity
EnsurePath
#Create a new branch with the specified path if it doesn't already exists.
Parameters:
| path (GH_Path) | Path of the branch to ensure. |
Returns: The list that belongs to the specified path.
EnsurePath
#Create a new branch with the specified path if it doesn't already exists.
Parameters:
| path (params int[]) | Path of the branch to ensure. |
Returns: The list that belongs to the specified path.
ExpandPath
#Expand a path in this structure by appending an element.
Parameters:
| path (GH_Path) | Path to expand, if the path doesn't exist, nothing will happen. |
| element (int) | Element to append to the path. |
| mode (GH_ExpandMode) | Expansion mode. |
Implements: ExpandPath
FlattenData
#Collects all data in the structure under a single list. Does not alter the state of this structure.
Returns: A linear list containing all data items in all branches.
GetEnumerator
#GetEnumerator_Generic
#Graft
#obsoletethis method has been replaced by Graft(GH_GraftMode)
Grafts all paths by reallocating all data into child paths.
Graft
#Grafts a specific path by reallocating all data into child paths. If a grafted path coincides with an existing path, the data item in question will be appended to the existing path.
Parameters:
| mode (GH_GraftMode) | Graft mode. |
| path (GH_Path) | Path to graft |
Implements: Graft
Graft
#Grafts all paths by reallocating all data into child paths.
Parameters:
| mode (GH_GraftMode) | Graft mode. |
Implements: Graft
Graft
#[EditorBrowsable(EditorBrowsableState.Never)]
public void Graft(GH_Path path, bool clearSingleNulls)
obsoletethis method has been replaced by Graft(GH_GraftMode, GH_Path)
Grafts a specific path by reallocating all data into child paths. If a grafted path coincides with an existing path, the data item in question will be appended to the existing path.
Insert
#Insert a data item into the specified branch in the structure. If the branch doesn't exist yet, it will be created.
LongestPathIndex
#Finds the path in this structure with the most dimensions. In case of multiple equally long longest paths, the last one will be returned.
Returns: The index of the longest path or -1 if there are no paths.
Implements: LongestPathIndex
MergeStructure
#Merges two structures together. Data inside similar paths will be merged into single lists and unique paths will be appended. The other structure will not be altered, so beware that data is now shared among both structures.
Parameters:
| other (GH_Structure<T>) | Structure to merge |
PathExists
#Returns True if the specified path is already defined inside the structure.
Parameters:
| path (GH_Path) | The data path to search for |
Implements: PathExists
PathIndex
#Find the indices that surround the given path domain. Indices may be out of bounds.
Read
#Read the entire GH_Structure from an archive. This method relies on the the serialization of the IGH_Goo items it contains. Also, the IGH_Goo T generic must have a public constructor that takes no arguments.
Parameters:
| reader (GH_IReader) | Archive to read from. |
Returns: True on success, false on failure.
Implements: Read
RemoveData
#public void RemoveData(T data)
Removes the first occurence of a data instance in the tree.
Parameters:
| data (T) | Data to remove. |
RemovePath
#Removes a path and all associated data from the structure. If the path doesn't exist, nothing will happen.
Parameters:
| path (GH_Path) | Path to remove. |
Implements: RemovePath
ReplacePath
#Replace an existing path with a different one. If the operation is successfull, then the 'find' path will be deleted. If the 'replace' path is already defined, the items in 'find' will be appended to the existing path.
Implements: ReplacePath
ShallowDuplicate
#Create a structure with a similar topology to this one with pointers to the same data items.
ShortestPathIndex
#Finds the path in this structure with the least dimensions. In case of multiple equally long longest paths, the first one will be returned.
Returns: The index of the shortest path or -1 if there are no paths.
Implements: ShortestPathIndex
Simplify
#Simplify the data structure by collapsing path indices shared by all branches.
Parameters:
| mode (GH_SimplificationMode) | Simplification algorithm to use. |
Implements: Simplify
TrimExcess
#public void TrimExcess()
Trims the excess allocated memory in all branches.
Implements: TrimExcess
Write
#Write the entire GH_Structure to an archive. This method relies on the the serialization of the IGH_Goo items it contains.
Parameters:
| writer (GH_IWriter) | Archive to write to. |
Returns: True on success, false on failure.
Implements: Write