Click or drag to resize

GH_StructureT Class

Represents a data tree where each branch has a unique path
Inheritance Hierarchy
SystemObject
  Grasshopper.Kernel.DataGH_StructureT

Namespace:  Grasshopper.Kernel.Data
Assembly:  Grasshopper (in Grasshopper.dll)
Syntax
public class GH_Structure<T> : IGH_Structure, 
	IEnumerable<T>, GH_ISerializable
where T : IGH_Goo

Type Parameters

T
The data type that this structure maintains. Must implement IGH_Goo or derive from a class that implements IGH_Goo.

The GH_StructureT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyBranchGH_Path
Gets a limited access pointer to the data list associated with a certain path.
Public propertyBranchInt32
Gets a limited access pointer to the data list at the specified index
Public propertyBranches
Gets a list of all the data-arrays in this structure
Public propertyDataCount
Gets the total number of data items stored in all paths.
Public propertyDataItemInt32
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.
Public propertyDataItemGH_Path, Int32
Gets a direct pointer to a data item under a specific path and index.
Public propertyDataListGH_Path
Gets a direct pointer to the list of data under a specific path.
Public propertyDataListInt32
Gets a direct pointer to the list of data under the specified index.
Public propertyFirstItem
Gets the first item in the structure. If no such item exists, null is returned.
Public propertyIsEmpty
Gets the Empty state of the structure. If the structure is Empty it contains no paths and no branches.
Public propertyLastItem
Gets the last item in the structure. If no such item exists, null is returned.
Public propertyNonNulls
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.
Public propertyPath
Gets the data path at the specified index.
Public propertyPathCount
Gets the number of paths defined in this structure.
Public propertyPaths
Gets a list of all the paths in this structure.
Public propertyStructureProxy
Gets a proxy list of all the data-arrays in this structure.
Public propertyTopologyDescription
Gets a description of the topology of the structure. Useful for debugging purposes.
Top
Methods
  NameDescription
Public methodAllData
Gets an enumerator for all the data items in this structure.
Public methodAppend(T)
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}]
Public methodAppend(T, GH_Path)
Append a data item to the specified branch in the structure. If the branch doesn't exist yet, it will be created.
Public methodAppendRange(IEnumerableT)
Append a list of data items to the last branch in the structure
Public methodAppendRange(IEnumerableT, GH_Path)
Append a list of data items to the specified branch in the structure. If the branch doesn't exist yet, it will be created.
Public methodClear
Clears the entire structure.
Public methodClearData
Removes all data from all paths without affecting the structure topology.
Public methodDataDescription
Gets a description of the data contained in this structure.
Public methodDuplicate
Create an exact duplicate of this structure. All data items are copied as well.
Public methodDuplicateCastQ
Create a duplicate of this structure in a different type.
Public methodEnsureCapacity
Ensures that all current branches have a certain capacity.
Public methodEnsurePath(GH_Path)
Create a new branch with the specified path if it doesn't already exists.
Public methodEnsurePath(Int32)
Create a new branch with the specified path if it doesn't already exists.
Public methodExpandPath
Expand a path in this structure by appending an element.
Public methodFlatten
Flattens the entire structure into a single path.
Public methodFlattenData
Collects all data in the structure under a single list. Does not alter the state of this structure.
Public methodGetEnumerator
Public methodGetEnumerator_Generic
Public methodGraft(GH_GraftMode)
Grafts all paths by reallocating all data into child paths.
Public methodGraft(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.
Public methodInsert
Insert a data item into the specified branch in the structure. If the branch doesn't exist yet, it will be created.
Public methodLongestPathIndex
Finds the path in this structure with the most dimensions. In case of multiple equally long longest paths, the last one will be returned.
Public methodMergeStructure
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.
Public methodPathExists
Returns True if the specified path is already defined inside the structure.
Public methodPathIndex
Find the indices that surround the given path domain. Indices may be out of bounds.
Public methodRead
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.
Public methodRemoveData
Removes the first occurence of a data instance in the tree.
Public methodRemovePath
Removes a path and all associated data from the structure. If the path doesn't exist, nothing will happen.
Public methodReplacePath
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.
Public methodReverse
Reverse the order of items in all branches.
Public methodShallowDuplicate
Create a structure with a similar topology to this one with pointers to the same data items.
Public methodShortestPathIndex
Finds the path in this structure with the least dimensions. In case of multiple equally long longest paths, the first one will be returned.
Public methodSimplify
Simplify the data structure by collapsing path indices shared by all branches.
Public methodToString (Overrides ObjectToString.)
Public methodTrimExcess
Trims the excess allocated memory in all branches.
Public methodWrite
Write the entire GH_Structure to an archive. This method relies on the the serialization of the IGH_Goo items it contains.
Top
See Also