FTLinkedListClass Module

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

     n = list % count()

Destruction

     CALL releaseFTLinkedList(list) [Pointers]

!


Uses

  • module~~ftlinkedlistclass~~UsesGraph module~ftlinkedlistclass FTLinkedListClass module~ftlinkedlistrecordclass FTLinkedListRecordClass module~ftlinkedlistclass->module~ftlinkedlistrecordclass module~ftmutableobjectarrayclass FTMutableObjectArrayClass module~ftlinkedlistclass->module~ftmutableobjectarrayclass module~ftobjectclass FTObjectClass module~ftlinkedlistrecordclass->module~ftobjectclass module~ftmutableobjectarrayclass->module~ftobjectclass

Used by

  • module~~ftlinkedlistclass~~UsedByGraph module~ftlinkedlistclass FTLinkedListClass module~ftdictionaryclass FTDictionaryClass module~ftdictionaryclass->module~ftlinkedlistclass module~ftlinkedlistiteratorclass FTLinkedListIteratorClass module~ftdictionaryclass->module~ftlinkedlistiteratorclass module~ftlinkedlistiteratorclass->module~ftlinkedlistclass module~ftmultiindextableclass FTMultiIndexTableClass module~ftmultiindextableclass->module~ftlinkedlistclass module~ftobjectlibrary FTObjectLibrary module~ftobjectlibrary->module~ftlinkedlistclass module~ftobjectlibrary->module~ftdictionaryclass module~ftobjectlibrary->module~ftlinkedlistiteratorclass module~ftsparsematrixclass FTSparseMatrixClass module~ftobjectlibrary->module~ftsparsematrixclass module~ftstackclass FTStackClass module~ftobjectlibrary->module~ftstackclass module~ftexceptionclass FTExceptionClass module~ftobjectlibrary->module~ftexceptionclass module~ftvaluedictionaryclass FTValueDictionaryClass module~ftobjectlibrary->module~ftvaluedictionaryclass module~ftsparsematrixclass->module~ftlinkedlistclass module~ftsparsematrixclass->module~ftlinkedlistiteratorclass module~ftstackclass->module~ftlinkedlistclass module~ftexceptionclass->module~ftdictionaryclass module~ftexceptionclass->module~ftlinkedlistiteratorclass module~ftexceptionclass->module~ftstackclass module~ftexceptionclass->module~ftvaluedictionaryclass module~ftstringsetclass FTStringSetClass module~ftstringsetclass->module~ftdictionaryclass module~ftvaluedictionaryclass->module~ftdictionaryclass module~sharedexceptionmanagermodule SharedExceptionManagerModule module~sharedexceptionmanagermodule->module~ftexceptionclass

Interfaces

public interface cast


Derived Types

type, public, extends(FTObject) ::  FTLinkedList

Components

Type Visibility Attributes Name Initial
class(FTLinkedListRecord), public, POINTER :: head => NULL()
class(FTLinkedListRecord), public, POINTER :: tail => NULL()
integer, public :: nRecords
logical, public :: isCircular_

Finalizations Procedures

final :: destructFTLinkedList

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 :: 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

public function isCircular(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

Return Value logical

public function numberOfRecords(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

Return Value integer

public function FTLinkedListDescription(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

Return Value character(len=DESCRIPTION_CHARACTER_LENGTH)

public function allLinkedListObjects(self) result(array)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

Return Value class(FTMutableObjectArray), POINTER

public function linkedListClassName(self) result(s)

Class name returns a string with the name of the type of the object

Read more…

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

Return Value character(len=CLASS_NAME_CHARACTER_LENGTH)

public function linkedListFromObject(obj) result(cast)

Arguments

Type IntentOptional Attributes Name
class(FTObject), POINTER :: obj

Return Value class(FTLinkedList), POINTER


Subroutines

public subroutine initFTLinkedList(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

public subroutine add(self, obj)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTObject), POINTER :: obj

public subroutine addObjectsFromList(self, list)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTLinkedList), POINTER :: list

public subroutine insertObjectAfterRecord(self, obj, after)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTObject), POINTER :: obj
class(FTLinkedListRecord), POINTER :: after

public subroutine insertObjectAfterObject(self, obj, after)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTObject), POINTER :: obj
class(FTObject), POINTER :: after

public subroutine makeCircular(self, circular)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
logical :: circular

public subroutine removeObject(self, obj)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTObject), POINTER :: obj

public subroutine removeLinkedListRecord(self, listRecord)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
class(FTLinkedListRecord), POINTER :: listRecord

public subroutine removeAllLinkedListObjects(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

public subroutine releaseFTLinkedList(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList), POINTER :: self

public subroutine destructFTLinkedList(self)

It is automatically called by release().

Arguments

Type IntentOptional Attributes Name
type(FTLinkedList) :: self

public recursive subroutine printFTLinkedListDescription(self, iUnit)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self
integer :: iUnit

public subroutine reverseLinkedList(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedList) :: self

public subroutine castObjectToLinkedList(obj, cast)

Arguments

Type IntentOptional Attributes Name
class(FTObject), POINTER :: obj
class(FTLinkedList), POINTER :: cast