Class TShapeList
Unit
Declaration
type TShapeList = class(specialize TCastleFastList<TShape>)
Description
This item has no description. Showing description inherited from TCastleFastList.
Simple fast list. Exposes most common operations, like addition and reading.
Can be specialized with any type (simple types like integers, or records, class instances...) that does not need automatic memory management. So don't use with e.g. AnsiStrings or COM interfaces or records with them (we would not initialize/release such memory properly).
Does not have any "ownership" (like in TObjectList that can "own" children) or notification mechanism (that would call a method / callback every time something is added / removed). This avoids operations that would force things like "clear" to perform one-by-one iteration over items (like notification of removals or dropping reference counts).
Manages memory to optimize speed, not conserve memory: operations only allocate memory, until you do ReleaseMemory (or free this instance, of course). Aside from this, we only grow, even when you call Clear.
Source: scene/castleshapes.pas (line 1139).
Hierarchy
- TObject
- TCastleFastList
- TShapeList
Overview
Nested Types
| Public | PtrT = ˆT; |
Methods
| Public | destructor Destroy; override; |
| Public | procedure Add(const Item: T); |
| Public | procedure Clear; |
| Public | procedure ReleaseMemory; |
| Public | procedure AllocateAtLeast(const MinimumCapacity: Integer); |
| Public | procedure Assign(const Source: TCastleFastList ); |
| Public | procedure AddRange(const Source: TCastleFastList ); |
| Public | constructor Create; overload; |
| Public | constructor Create(const Tree: TShapeTree; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); overload; deprecated 'use Tree.TraverseList(...)'; |
Properties
| Public | property Count: Integer read FCount; |
| Public | property Items[const Index: Integer]: T read GetItems write SetItems; default; |
| Public | property L: PtrT read FItems; |
Description
Nested Types
| Public | PtrT = ˆT; |
|
This item is declared in ancestor TCastleFastList. Pointer to the list contents. | |
Methods
| Public | destructor Destroy; override; |
|
This item is declared in ancestor TCastleFastList. This item has no description. | |
| Public | procedure Add(const Item: T); |
|
This item is declared in ancestor TCastleFastList. Add new item. | |
| Public | procedure Clear; |
|
This item is declared in ancestor TCastleFastList. Clearing is equivalent to setting Count := 0. Does not deallocate memory (to keep it for future reuse), call ReleaseMemory if you want to do that. | |
| Public | procedure ReleaseMemory; |
|
This item is declared in ancestor TCastleFastList. This item has no description. | |
| Public | procedure AllocateAtLeast(const MinimumCapacity: Integer); |
|
This item is declared in ancestor TCastleFastList. This item has no description. | |
| Public | procedure Assign(const Source: TCastleFastList ); |
|
This item is declared in ancestor TCastleFastList. This item has no description. | |
| Public | procedure AddRange(const Source: TCastleFastList ); |
|
This item is declared in ancestor TCastleFastList. This item has no description. | |
| Public | constructor Create; overload; |
|
This item has no description. | |
| Public | constructor Create(const Tree: TShapeTree; const OnlyActive: boolean; const OnlyVisible: boolean = false; const OnlyCollidable: boolean = false); overload; deprecated 'use Tree.TraverseList(...)'; |
|
Warning: this symbol is deprecated: use Tree.TraverseList(...) Constructor that initializes list contents by traversing given tree. | |
Properties
| Public | property Count: Integer read FCount; |
|
This item is declared in ancestor TCastleFastList. How many items are in the list. | |
| Public | property Items[const Index: Integer]: T read GetItems write SetItems; default; |
|
This item is declared in ancestor TCastleFastList. Get or set items in the list. | |
| Public | property L: PtrT read FItems; |
|
This item is declared in ancestor TCastleFastList. Access the list contents through a pointer, to get or set them efficiently. Use this to directly access a list value, like this: MyIntList.L[I] := 123; // Equivalent but less efficient to syntax without L: // MyIntList[I] := 123; MyRecordList.L[I].MyField := 123; // Never use syntax without L (could modify temporary value): // MyRecordList[I].MyField := 123; //< never do this!
The above examples of L work only in FPC ObjFpc mode or in Delphi with pointermath "on" (see https://docwiki.embarcadero.com/RADStudio/Sydney/en/Pointer_Math_(Delphi) ). These are CGE default settings when being compiled with FPC or Delphi, so you can depend on them at least in CGE implementation. Note that Delphi code using this doesn't need to be compiled with pointermath "on", it is enough that this unit is compiled with pointermath "on" and then one can use math on PtrT. This is in particular useful if you have a list of records and you would like to set their fields. | |
Generated by PasDoc 0.17.0.snapshot.