A dictionary is a special case of a hash table that stores key-value pairs.
It is an
example of what is called an ``associative container''. In the implementation of FTObjectLibrary,
the value can be any subclass of FTObject and the key is a character variable. The library
includes the base dictionary that can store and retrieve any subclass of FTObject. It also includes a
subclass that is designed to store and retrieve FTValue objects.
FTDictionary (Inherits from FTObject)
Initialization
CLASS(FTDictionary), POINTER :: dict
ALLOCATE(dict)
CALL dict % initWithSize(N) ! N = size of dictionary. Should be power of two
Adding entries
CLASS(FTDictionary), POINTER :: dict
CLASS(FTObject) , POINTER :: obj
CHARACTER(LEN=N) :: key
obj => r ! r is subclass of FTObject
CALL dict % addObjectForKey(obj,key)
Accessing entries
obj => dict % objectForKey ( key )
CALL cast ( obj , v ) ! v is the type of object to be extracted
Destruction
CALL releaseFTDictionary ( dict ) [ Pointer ]
Accessing an object
TYPE(FTObject) :: obj
obj => dict % objectForKey(key)
Converting a base class pointer to a dictionary
dict => dictionaryFromObject(obj)
Getting all of the keys
CHARACTER(LEN=FTDICT_KWD_STRING_LENGTH), POINTER :: keys(:)
keys => dict % allKeys()
(The target of the pointer must be deallocated by the caller)
Getting all of the objects
CLASS(FTMutableObjectArray), POINTER :: objectArray
objectArray => dict % allObjects() ! The array is owned by the caller.
(The target of the pointer must be released by the caller)
module~~ftdictionaryclass~~UsesGraph
module~ftdictionaryclass
FTDictionaryClass
module~ftkeyobjectpairclass
FTKeyObjectPairClass
module~ftdictionaryclass->module~ftkeyobjectpairclass
module~ftlinkedlistclass
FTLinkedListClass
module~ftdictionaryclass->module~ftlinkedlistclass
module~ftlinkedlistiteratorclass
FTLinkedListIteratorClass
module~ftdictionaryclass->module~ftlinkedlistiteratorclass
module~ftmutableobjectarrayclass
FTMutableObjectArrayClass
module~ftdictionaryclass->module~ftmutableobjectarrayclass
module~hashmodule
HashModule
module~ftdictionaryclass->module~hashmodule
module~ftobjectclass
FTObjectClass
module~ftkeyobjectpairclass->module~ftobjectclass
module~ftlinkedlistclass->module~ftmutableobjectarrayclass
module~ftlinkedlistrecordclass
FTLinkedListRecordClass
module~ftlinkedlistclass->module~ftlinkedlistrecordclass
module~ftlinkedlistiteratorclass->module~ftlinkedlistclass
module~ftmutableobjectarrayclass->module~ftobjectclass
module~ftlinkedlistrecordclass->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~~ftdictionaryclass~~UsedByGraph
module~ftdictionaryclass
FTDictionaryClass
module~ftexceptionclass
FTExceptionClass
module~ftexceptionclass->module~ftdictionaryclass
module~ftvaluedictionaryclass
FTValueDictionaryClass
module~ftexceptionclass->module~ftvaluedictionaryclass
module~ftobjectlibrary
FTObjectLibrary
module~ftobjectlibrary->module~ftdictionaryclass
module~ftobjectlibrary->module~ftexceptionclass
module~ftobjectlibrary->module~ftvaluedictionaryclass
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.
Interfaces
Arguments
Type
Intent Optional Attributes
Name
class(FTObject ),
POINTER
::
obj
class(FTDictionary ),
POINTER
::
cast
Derived Types
Components
Type
Visibility Attributes
Name
Initial
integer,
public
::
numberOfEntries
logical,
public
::
isCaseSensitive
type(FTLinkedList ),
public,
DIMENSION(:), POINTER
::
entries
=>
NULL()
Finalizations Procedures
final :: destructFTDictionary
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 ::
initWithSize
procedure, public ::
init
procedure, public ::
allKeys => AllKeys
procedure, public ::
allObjects => AllObjects
procedure, public ::
addObjectForKey
procedure, public ::
description => FTDictionaryDescription
procedure, public ::
printDescription => printFTDictionaryDescription
procedure, public ::
objectForKey
procedure, public ::
containsKey
procedure, public ::
className => dictionaryClassName
procedure, public ::
COUNT
Functions
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Return Value
integer
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
character(len=*)
::
key
Return Value
class(FTObject ), POINTER
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
character(len=*)
::
key
Return Value
logical
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Return Value
character(len=description_character_length)
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Return Value
character(len=FTDICT_KWD_STRING_LENGTH), POINTER, (:)
Arguments
Type
Intent Optional Attributes
Name
class(FTObject ),
POINTER
::
obj
Return Value
class(FTDictionary ), POINTER
Class name returns a string with the name of the type of the object
Read more…
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Return Value
character(len=CLASS_NAME_CHARACTER_LENGTH)
Subroutines
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
integer,
intent(in)
::
sze
Arguments
Type
Intent Optional Attributes
Name
type(FTDictionary ),
POINTER
::
self
Arguments
Type
Intent Optional Attributes
Name
type(FTDictionary )
::
self
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
class(FTObject ),
POINTER
::
object
character(len=*)
::
key
Arguments
Type
Intent Optional Attributes
Name
class(FTDictionary )
::
self
integer
::
iUnit
Arguments
Type
Intent Optional Attributes
Name
class(FTObject ),
POINTER
::
obj
class(FTDictionary ),
POINTER
::
cast