FTLinkedListIteratorClass Module

An object for stepping through a linked list.

Definition (Subclass of FTObject):

TYPE(FTLinkedListIterator) :: list

Initialization

     CLASS(FTLinkedList)        , POINTER :: list
     CLASS(FTLinkedListIterator), POINTER :: iterator
     ALLOCATE(iterator)
     CALL iterator % initWithFTLinkedList(list)

Accessors

     ptr => iterator % list()
     ptr => iterator % object()
     ptr => iterator % currentRecord()

Iterating

     CLASS(FTObject), POINTER :: objectPtr
     CALL iterator % setToStart
     DO WHILE (.NOT.iterator % isAtEnd())
        objectPtr => iterator % object()        ! if the object is wanted
        recordPtr => iterator % currentRecord() ! if the record is wanted

         Do something with object or record

        CALL iterator % moveToNext() ! DON'T FORGET THIS!!
     END DO

Destruction

     CALL iterator % destruct() [Non Pointers]
     CALL release(iterator) [Pointers]


Interfaces

public interface release

  • public subroutine releaseFTLinkedListIterator(self)

    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 IntentOptional Attributes Name
    class(FTLinkedListIterator), POINTER :: self

Derived Types

type, public, extends(FTObject) ::  FTLinkedListIterator

Components

Type Visibility Attributes Name Initial
class(FTLinkedList), public, POINTER :: list => NULL()
class(FTLinkedListRecord), public, POINTER :: current => NULL()

Type-Bound Procedures

procedure, public :: description => FTObjectDescription
procedure, public :: printDescription => printFTObjectDescription
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 => initEmpty
procedure, public :: initWithFTLinkedList
procedure, public :: destruct => destructIterator
procedure, public :: isAtEnd => FTLinkedListIsAtEnd
procedure, public :: object => FTLinkedListObject
procedure, public :: currentRecord => FTLinkedListCurrentRecord
procedure, public :: linkedList => returnLinkedList
procedure, public :: className => linkedListIteratorClassName
procedure, public :: setLinkedList
procedure, public :: setToStart
procedure, public :: moveToNext
procedure, public :: removeCurrentRecord

Functions

public function FTLinkedListIsAtEnd(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

Return Value logical

public function returnLinkedList(self) result(o)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

Return Value class(FTLinkedList), POINTER

public function FTLinkedListObject(self) result(o)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

Return Value class(FTObject), POINTER

public function FTLinkedListCurrentRecord(self) result(o)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

Return Value class(FTLinkedListRecord), POINTER

public function linkedListIteratorClassName(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(FTLinkedListIterator) :: self

Return Value character(len=CLASS_NAME_CHARACTER_LENGTH)


Subroutines

public subroutine initEmpty(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

public subroutine initWithFTLinkedList(self, list)

Arguments

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

public subroutine destructIterator(self)

The destructor must not be called except at the end of destructors of subclasses.

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

public subroutine releaseMemberList(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

public subroutine releaseFTLinkedListIterator(self)

Public, generic name: release(self)

Read more…

Arguments

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

public subroutine setToStart(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

public subroutine moveToNext(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self

public subroutine setLinkedList(self, list)

Arguments

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

public subroutine removeCurrentRecord(self)

Arguments

Type IntentOptional Attributes Name
class(FTLinkedListIterator) :: self