IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Num::FieldCollection< TField, TElement > Class Template Reference

Collection of fields of the same type. Fields are identified by their names. In principle, contained fields can be of different dimensions. More...

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

List of all members.

Public Member Functions

 FieldCollection ()
 Constructor.
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).
string[] GetFieldNames ()
 Returns names of all the fields contained in the current field collection.
virtual void AddField (int numElements, string fieldName, string fieldDescription)
 Creates a new field of the specified length and adds it to the current collection.
void AddField (TField field, string name)
 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.
void AddField (TField field)
 Adds the specified field to the urrent field collection.
void RemoveField (string fieldName)
 Removed the field with the specified name from the current field collection.

Public Attributes

const string DefaultFieldNameConst = "default"

Protected Member Functions

void NullifyActiveField ()
 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).

Properties

string DefauletFieldName [get]
 Gets name that is used for automatically created fields.
SortedList< string, TField > Fields [get]
string ActiveFieldName [get, set]
 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 ActiveField [get]
 Gets the currently active field.
TField this [string fieldName] [get]
 Gets the field that has a specified name.
int Count [get]
 Gets the number of fields contained in the collection.

Private Attributes

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

Detailed Description

template<TField, TElement>
class IG::Num::FieldCollection< TField, TElement >

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() 

Member Function Documentation

template<TField , TElement >
IG::Num::FieldCollection< TField, TElement >::FieldCollection ( ) [inline]

Constructor.

template<TField , TElement >
virtual TField IG::Num::FieldCollection< TField, TElement >::CreateField ( int  numElements,
string  name,
string  description 
) [inline, virtual]

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::FieldCollection3d< TField, TElement >, and IG::Num::FieldCollection2d< TField, TElement >.

template<TField , TElement >
void IG::Num::FieldCollection< TField, TElement >::NullifyActiveField ( ) [inline, protected]

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).

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

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

template<TField , TElement >
virtual void IG::Num::FieldCollection< TField, TElement >::AddField ( int  numElements,
string  fieldName,
string  fieldDescription 
) [inline, virtual]

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::FieldCollection3d< TField, TElement >, and IG::Num::FieldCollection2d< TField, TElement >.

template<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.
template<TField , TElement >
void IG::Num::FieldCollection< TField, TElement >::AddField ( TField  field) [inline]

Adds the specified field to the urrent field collection.

Parameters:
fieldField to be added.
template<TField , TElement >
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

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

Property Documentation

template<TField , TElement >
string IG::Num::FieldCollection< TField, TElement >::DefauletFieldName [get]

Gets name that is used for automatically created fields.

template<TField , TElement >
SortedList<string, TField> IG::Num::FieldCollection< TField, TElement >::Fields [get, protected]
template<TField , TElement >
string IG::Num::FieldCollection< TField, TElement >::ActiveFieldName [get, set]

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.

template<TField , TElement >
TField IG::Num::FieldCollection< TField, TElement >::ActiveField [get]

Gets the currently active field.

template<TField , TElement >
TField IG::Num::FieldCollection< TField, TElement >::this[int index] [get]

Gets the field that has a specified name.

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:
fieldNameName of the field to be returned.
Parameters:
indexIndex of the field.
template<TField , TElement >
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:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events