FTMutableObjectArray is a mutable array class to which objects
can be added, removed, replaced and accessed according to their
index in the array.
Fortran has pointers to arrays, but not arrays of pointers. To do the latter, one creates
a wrapper derived type and creates an array of that wrapper type. Fortran arrays are great, but
they are of fixed length, and they don't easily implement reference counting to keep track of
memory. For that, we have the FTMutableObjectArray. Performance reasons dictate that you
will use regular arrays for numeric types and the like, but for generic objects we would use
an Object Array.
You initialize a FTMutableObjectArray with the number of objects that you expect it to hold.
However, it can re-size itself if necessary. To be efficient, it adds more than one entry at a time
given by the ``chunkSize'', which you can choose for yourself. (The default is 10.)
Definition
TYPE(FTMutableObjectArray) :: array
Usage
Initialization
CLASS(FTMutableObjectArray) :: array
INTEGER :: N = 11
CALL array % initWithSize(N)
Destruction
CALL array % destuct () [ Non Pointers ]
call releaseFTMutableObjectArray ( array ) [ Pointers ]
Adding an Object
TYPE(FTObject) :: obj
obj => r1
CALL array % addObject(obj)
Removing an Object
TYPE(FTObject) :: obj
CALL array % removeObjectAtIndex(i)
Accessing an Object
TYPE(FTObject) :: obj
obj => array % objectAtIndex(i)
Replacing an Object
TYPE(FTObject) :: obj
obj => r1
CALL array % replaceObjectAtIndexWithObject(i,obj)
Setting the Chunk Size
CALL array % setChunkSize(size)
Finding The Number Of Items In The Array
Finding The Actual Allocated Size Of The Array
n = array % allocatedSize()
module~~ftmutableobjectarrayclass~~UsesGraph
module~ftmutableobjectarrayclass
FTMutableObjectArrayClass
module~ftobjectclass
FTObjectClass
module~ftmutableobjectarrayclass->module~ftobjectclass
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
module~~ftmutableobjectarrayclass~~UsedByGraph
module~ftmutableobjectarrayclass
FTMutableObjectArrayClass
module~ftdictionaryclass
FTDictionaryClass
module~ftdictionaryclass->module~ftmutableobjectarrayclass
module~ftlinkedlistclass
FTLinkedListClass
module~ftdictionaryclass->module~ftlinkedlistclass
module~ftlinkedlistiteratorclass
FTLinkedListIteratorClass
module~ftdictionaryclass->module~ftlinkedlistiteratorclass
module~ftlinkedlistclass->module~ftmutableobjectarrayclass
module~ftobjectlibrary
FTObjectLibrary
module~ftobjectlibrary->module~ftmutableobjectarrayclass
module~ftobjectlibrary->module~ftdictionaryclass
module~ftobjectlibrary->module~ftlinkedlistclass
module~ftexceptionclass
FTExceptionClass
module~ftobjectlibrary->module~ftexceptionclass
module~ftobjectlibrary->module~ftlinkedlistiteratorclass
module~ftsparsematrixclass
FTSparseMatrixClass
module~ftobjectlibrary->module~ftsparsematrixclass
module~ftstackclass
FTStackClass
module~ftobjectlibrary->module~ftstackclass
module~ftvaluedictionaryclass
FTValueDictionaryClass
module~ftobjectlibrary->module~ftvaluedictionaryclass
module~ftexceptionclass->module~ftdictionaryclass
module~ftexceptionclass->module~ftlinkedlistiteratorclass
module~ftexceptionclass->module~ftstackclass
module~ftexceptionclass->module~ftvaluedictionaryclass
module~ftlinkedlistiteratorclass->module~ftlinkedlistclass
module~ftmultiindextableclass
FTMultiIndexTableClass
module~ftmultiindextableclass->module~ftlinkedlistclass
module~ftsparsematrixclass->module~ftlinkedlistclass
module~ftsparsematrixclass->module~ftlinkedlistiteratorclass
module~ftstackclass->module~ftlinkedlistclass
module~ftstringsetclass
FTStringSetClass
module~ftstringsetclass->module~ftdictionaryclass
module~ftvaluedictionaryclass->module~ftdictionaryclass
module~sharedexceptionmanagermodule
SharedExceptionManagerModule
module~sharedexceptionmanagermodule->module~ftexceptionclass
Nodes of different colours represent the following:
Graph Key
Module
Module
Submodule
Submodule
Subroutine
Subroutine
Function
Function
Program
Program
This Page's Entity
This Page's Entity
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Derived Types
Finalizations Procedures
final :: destructObjectArray
Type-Bound Procedures
procedure, public ::
init => initFTObject
procedure, public ::
description => FTObjectDescription
procedure, public, non_overridable ::
copy => copyFTObject
procedure, public, non_overridable ::
retain => retainFTObject
procedure, public, non_overridable ::
isUnreferenced
procedure, public, non_overridable ::
refCount
procedure, public ::
initWithSize => initObjectArrayWithSize
procedure, public ::
addObject => addObjectToArray
procedure, public ::
replaceObjectAtIndexWithObject
procedure, public ::
removeObjectAtIndex
procedure, public ::
objectAtIndex
procedure, public ::
printDescription => printArray
procedure, public ::
className => arrayClassName
procedure, public ::
setChunkSize
procedure, public ::
chunkSize
procedure, public ::
COUNT => numberOfItems
procedure, public ::
allocatedSize
Functions
Access the object at the index indx
Read more…
Arguments
Return Value
class(FTObject ), POINTER
Returns the number of items to be added when the array needs to be re-sized
Read more…
Arguments
Return Value
integer
Generic name: count
Read more…
Arguments
Return Value
integer
Arguments
Return Value
integer
Generic Name: cast
Read more…
Arguments
Type
Intent Optional Attributes
Name
class(FTObject ),
POINTER
::
obj
Class name returns a string with the name of the type of the object
Read more…
Arguments
Return Value
character(len=CLASS_NAME_CHARACTER_LENGTH)
Subroutines
Designated initializer. Initializes the amount of storage, but
the array remains empty.
Read more…
Arguments
Destructor for the class. This is called automatically when the
reference count reaches zero. Do not call this yourself.
Arguments
Add an object to the end of the array
Read more…
Arguments
Remove an object at the index indx
Read more…
Arguments
Replace an object at the index indx
Read more…
Arguments
Set the number of items to be added when the array needs to be re-sized
Read more…
Arguments