FTLinkedList is a container class that stores objects in a linked list.
Inherits from FTObjectClass
Definition (Subclass of FTObject):
TYPE(FTLinkedList) :: list
Usage:
Initialization
CLASS(FTLinkedList), POINTER :: list
ALLOCATE(list)
CALL list % init
Adding objects
CLASS(FTLinkedList), POINTER :: list, listToAdd
CLASS(FTObject) , POINTER :: objectPtr
objectPtr => r ! r is subclass of FTObject
CALL list % Add(objectPtr) ! Pointer is retained by list
CALL release(r) ! If caller relinquishes ownership
CALL list % addObjectsFromList(listToAdd)
Inserting objects
CLASS(FTLinkedList) , POINTER :: list
CLASS(FTObject) , POINTER :: objectPtr, obj
CLASS(FTLinkedListRecord), POINTER :: record
objectPtr => r ! r is subclass of FTObject
CALL list % insertObjectAfterRecord(objectPtr,record) ! Pointer is retained by list
CALL release(r) ! If caller reliquishes ownership
objectPtr => r ! r is subclass of FTObject
CALL list % insertObjectAfterObject(objectPtr,obj) ! Pointer is retained by list
CALL release(r) ! If caller reliquishes ownership
Removing objects
CLASS(FTLinkedList), POINTER :: list
CLASS(FTObject) , POINTER :: objectPtr
objectPtr => r ! r is subclass of FTObject
CALL list % remove(objectPtr)
Getting all objects as an object array
CLASS(FTLinkedList) , POINTER :: list
CLASS(FTMutableObjectArray), POINTER :: array
array => list % allObjects() ! Array has refCount = 1
Counting the number of objects in the list
Destruction
CALL release(list) [Pointers]
CALL list % destruct() [Non Pointers]
!
Interfaces
-
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTObject),
|
|
|
POINTER
|
:: |
obj |
|
class(FTLinkedList),
|
|
|
POINTER
|
:: |
cast |
|
-
Public, generic name: release(self)
Call release(self) on an object to release control
of an object. If its reference count is zero, then
it is deallocated.
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(FTLinkedList),
|
|
|
POINTER
|
:: |
self |
|
Derived Types
Components
Type |
Visibility | Attributes |
|
Name |
| Initial | |
class(FTLinkedListRecord),
|
public, |
POINTER
|
:: |
head |
=> |
NULL() |
|
class(FTLinkedListRecord),
|
public, |
POINTER
|
:: |
tail |
=> |
NULL() |
|
integer,
|
public |
|
:: |
nRecords |
|
|
|
logical,
|
public |
|
:: |
isCircular_ |
|
|
|
Type-Bound Procedures
procedure, public, non_overridable ::
copy => copyFTObject |
|
procedure, public, non_overridable ::
retain => retainFTObject |
|
procedure, public, non_overridable ::
isUnreferenced |
|
procedure, public, non_overridable ::
refCount |
|
procedure, public ::
init => initFTLinkedList |
|
procedure, public ::
add |
|
procedure, public ::
remove => removeObject |
|
procedure, public ::
reverse => reverseLinkedList |
|
procedure, public ::
removeRecord => removeLinkedListRecord |
|
procedure, public ::
destruct => destructFTLinkedList |
|
procedure, public ::
count => numberOfRecords |
|
procedure, public ::
description => FTLinkedListDescription |
|
procedure, public ::
printDescription => printFTLinkedListDescription |
|
procedure, public ::
className => linkedListClassName |
|
procedure, public ::
allObjects => allLinkedListObjects |
|
procedure, public ::
removeAllObjects => removeAllLinkedListObjects |
|
procedure, public ::
addObjectsFromList |
|
procedure, public ::
makeCircular |
|
procedure, public ::
isCircular |
|
procedure, public ::
insertObjectAfterRecord |
|
procedure, public ::
insertObjectAfterObject |
|
Functions
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Return Value
logical
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Return Value
integer
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Return Value
character(len=DESCRIPTION_CHARACTER_LENGTH)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Class name returns a string with the name of the type of the object
Read more…
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Return Value
character(len=CLASS_NAME_CHARACTER_LENGTH)
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTObject),
|
|
|
POINTER
|
:: |
obj |
|
Return Value
class(FTLinkedList), POINTER
Subroutines
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
logical
|
|
|
|
:: |
circular |
|
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
The destructor must only be called from within the destructors of subclasses
It is automatically called by release().
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Public, generic name: release(self)
Read more…
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
type(FTLinkedList),
|
|
|
POINTER
|
:: |
self |
|
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
integer
|
|
|
|
:: |
iUnit |
|
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTLinkedList)
|
|
|
|
:: |
self |
|
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
class(FTObject),
|
|
|
POINTER
|
:: |
obj |
|
class(FTLinkedList),
|
|
|
POINTER
|
:: |
cast |
|