tsc_ArcList

This class is a list of arc objects.  It is generally a snapshot of the arcs at the time it was constructed from the job, empty arc lists can be created however.  An ArcList can be filtered in various ways to reduce it to some desired subset of all arcs in the job.

The list can be indexed by using the zero-based [] operator on the class to obtain a tsc_Arc object.

Construction

tsc_ArcList (const tsc_ArcList& copy);
Generally an ArcList is constructed by calling a function on tsc_JobArcs that returns a list of arcs in the job.  The copy constructor simply makes a reference to the same list, so that changes made to either copy will be reflected in the other.

tsc_ArcList ();
Creates an empty list.

tsc_ArcList Clone();
Clone makes a shallow copy of the list.  The list itself is copied but all references are to the same line objects.  Changes made to the copy list will not affect the original list.

Other methods

tsc_Arc operator[] (int item);
The [] operator will access any arc in the list by index, with item values that start at zero and end at Count()-1.
Arc objects in an unmodified list obtained from tsc_Database are always in database (time) sequence.

tsc_StringList ToStringList();
Returns a string list containing the names of all the arcs in the tsc_ArcList.

int Count () const;
The number of arcs in the list is returned.

bool IsEmpty() const;
Returns true if the list is empty.

void Append (const tsc_Arc& arc);
Adds an arc object to the end of the list.  This action affects only the list, not the job.

void Remove (const tsc_Arc& arc);
Removes an arc from the list.  If the same arc exists more than once in the list, only the first is removed.  Note: The list is searched sequentially for the object, and then compacted; avoid using this repetitively on potentially large lists or consider using SelectBy instead.

void Remove (int index);
Removes the arc from the list at the given index counted from zero.  Note: The list is compacted after the item is removed; avoid use on large lists or consider using SelectBy instead.

void Clear();
Removes all items.

void Find (tsc_IEntityFilter match, int startIndex = 0);
To find an arc in a list, this function may be used; it is significantly faster than looping through the list yourself.  Construct a subclass of tsc_IEntityFilter and implement your search function there.

Filtering the list

These functions remove all but the selected items from an existing list.  They are significantly faster than iterating through the list to access and remove individual arc objects.  It is also more efficient to first select for uncommon conditions.  For instance, to find all 3D gridable arcs with names between A1 and A20, select the name range first and the gridable 3D second, since many if not all arcs will be gridable and testing for being gridable may involve a coordinate transformation.

void SelectGridable (int dimensions);
Use this to select arcs that are convertible to grid coordinates with the given number of dimensions - 1, 2, or 3.  A dimension of 1 selects all lines with a height, 2 selects lines with both horizontal dimensions, and 3 selects only lines with all three.

void SelectCollatingNameRange (const char* from, const char* to);
This function selects all arcs within a name range.  The names are sorted such that numeric segments within the name are collated in a more intuitive sequence.  For instance, a normally sorted list of arcs might contain the sequence of names [A1,A10,A2,A20,A3], whereas this function sorts them as [A1,A2,A3,A10,A20].  The resulting line list will be sorted by name in this manner.

void RemoveDeleted();
Deleted items are normally included in line lists.  Use this function to remove them.

void SelectBy (tsc_IEntityFilter* keep);
This function allows any line to be tested by a callback function and kept or removed as determined by the callback. See the documentation for tsc_IEntityFilter for details and an example.  Using this function is very much faster than individually testing and removing lines in a list.

A NULL filter will result in no filtering and all objects will be retained.