IGLib  1.5
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
IG.Num.FieldCollection< TField, TElement > Class Template Reference

Collection of fields of the same type. Fields are identified by their names. More...

+ Inheritance diagram for IG.Num.FieldCollection< TField, TElement >:

Public Member Functions

 FieldCollection ()
 Constructor. More...
 
virtual TField CreateField (int numElements, string name, string description)
 Creates a new field of specified length and with specified name and description (the latter two can be null). More...
 
string[] GetFieldNames ()
 Returns names of all the fields contained in the current field collection. More...
 
virtual void AddField (int numElements, string fieldName, string fieldDescription)
 Creates a new field of the specified length and adds it to the current collection. More...
 
void AddField (TField field, string name)
 Adds the specified to the collection under a specified name. More...
 
void AddField (TField field)
 Adds the specified field to the urrent field collection. More...
 
void RemoveField (string fieldName)
 Removed the field with the specified name from the current field collection. More...
 

Public Attributes

const string DefaultFieldNameConst = "default"
 

Protected Member Functions

void NullifyActiveField ()
 Sets the variable holding currently active field to null. More...
 

Properties

string DefauletFieldName [get]
 Gets name that is used for automatically created fields. More...
 
SortedList< string, TField > Fields [get]
 
string ActiveFieldName [get, set]
 Gets or sets name of the active field. More...
 
TField ActiveField [get]
 Gets the currently active field. More...
 
TField this[string fieldName] [get]
 Gets the field that has a specified name. More...
 
TField this[int index] [get]
 Get the field that corresponds to the specified index. More...
 
int Count [get]
 Gets the number of fields contained in the collection. More...
 

Private Attributes

SortedList< string, TField > _fields = new SortedList<string, TField>()
 
string _activeFieldName
 
TField _activeField
 

Detailed Description

Collection of fields of the same type. Fields are identified by their names.

In principle, contained fields can be of different dimensions.

Template Parameters
TFieldType of fields contained in the collection.
TElementType of elements of the fields that can be contained in the collection.

Completely generic definition was introduced in 2009. Before that, several types were used for specific field collections.

$A Igor Apr09;

Type Constraints
TField :Field<TElement> 
TField :new() 

Constructor & Destructor Documentation

IG.Num.FieldCollection< TField, TElement >.FieldCollection ( )
inline

Constructor.

Member Function Documentation

virtual TField IG.Num.FieldCollection< TField, TElement >.CreateField ( int  numElements,
string  name,
string  description 
)
inlinevirtual

Creates a new field of specified length and with specified name and description (the latter two can be null).

Parameters
numElementsField length (number of elements).
nameField name (can be null).
descriptionDescription of the field (can be null).

Reimplemented in IG.Num.FieldCollection2d< TField, TElement >, and IG.Num.FieldCollection3d< TField, TElement >.

void IG.Num.FieldCollection< TField, TElement >.NullifyActiveField ( )
inlineprotected

Sets the variable holding currently active field to null.

If active field name is specified then active field will still be correctly obtained (lazy evaluation).

string [] IG.Num.FieldCollection< TField, TElement >.GetFieldNames ( )
inline

Returns names of all the fields contained in the current field collection.

virtual void IG.Num.FieldCollection< TField, TElement >.AddField ( int  numElements,
string  fieldName,
string  fieldDescription 
)
inlinevirtual

Creates a new field of the specified length and adds it to the current collection.

Parameters
numElementsLength of the field that is created and added (number of elements).
fieldNameName of the field. In principle, it should be different tan null.
fieldDescriptionOptional description of the field. It can be null.

Reimplemented in IG.Num.FieldCollection2d< TField, TElement >, and IG.Num.FieldCollection3d< TField, TElement >.

void IG.Num.FieldCollection< TField, TElement >.AddField ( TField  field,
string  name 
)
inline

Adds the specified to the collection under a specified name.

If the field already has a name then its name is replaced by the specified name, unlsee the specified name is null.

Parameters
fieldField to be added to the collection.
nameName under which the field is added to the current collection.
void IG.Num.FieldCollection< TField, TElement >.AddField ( TField  field)
inline

Adds the specified field to the urrent field collection.

Parameters
fieldField to be added.
void IG.Num.FieldCollection< TField, TElement >.RemoveField ( string  fieldName)
inline

Removed the field with the specified name from the current field collection.

Parameters
fieldNameName of the field to be removed.

Member Data Documentation

const string IG.Num.FieldCollection< TField, TElement >.DefaultFieldNameConst = "default"
SortedList<string, TField> IG.Num.FieldCollection< TField, TElement >._fields = new SortedList<string, TField>()
private
string IG.Num.FieldCollection< TField, TElement >._activeFieldName
private
TField IG.Num.FieldCollection< TField, TElement >._activeField
private

Property Documentation

string IG.Num.FieldCollection< TField, TElement >.DefauletFieldName
get

Gets name that is used for automatically created fields.

SortedList<string, TField> IG.Num.FieldCollection< TField, TElement >.Fields
getprotected
string IG.Num.FieldCollection< TField, TElement >.ActiveFieldName
getset

Gets or sets name of the active field.

Active field will be accessed throughthe ActiveField property. When setting name of the active field, that property is not assigned, but it gets assigned on the first get access.

TField IG.Num.FieldCollection< TField, TElement >.ActiveField
get

Gets the currently active field.

TField IG.Num.FieldCollection< TField, TElement >.this[string fieldName]
get

Gets the field that has a specified name.

Parameters
fieldNameName of the field to be returned.
TField IG.Num.FieldCollection< TField, TElement >.this[int index]
get

Get the field that corresponds to the specified index.

This is seldom used, usually fields will be accessed through field names.

Warning: when adding fields, index of a field may change, therefore this kind of access should only be used wen there is no adding or removing of fields.

Parameters
indexIndex of the field.
int IG.Num.FieldCollection< TField, TElement >.Count
get

Gets the number of fields contained in the collection.


The documentation for this class was generated from the following file: