Cartesius Library
polymorphic_list_mod Module Reference

Linked lists based on the module link_mod.f90. More...

Data Types

type  list
 

Functions/Subroutines

subroutine printlist (this)
 
subroutine addvalue (this, value, pDeallocator)
 Appends a new value to the end of the linked list. Current value is unaffected. More...
 
logical function list_any_no_params (this, proc)
 
logical function list_any_one_param (this, proc, par1)
 
logical function list_contains (this, value)
 Returns true if the given value points to the same target as some value in the list. More...
 
type(list) function copylist (this)
 
subroutine appendlist (this, newList)
 Appends a new list to the linked list. Current values are unaffected. More...
 
subroutine mergelist (this, addList)
 Appends the second list's values to the first one without repetitions. More...
 
subroutine list_swap_indices (this, index1, index2)
 Swaps the values stored in he links at the given indices. More...
 
subroutine rotate_list_left (this)
 Moves the first element of the given list to the end of the list. More...
 
class(*) function, pointer firstvalue (this)
 Returns a pointer to the first value in the linked list. More...
 
class(*) function, pointer currentvalue (this)
 Returns a pointer to the value in the link to which the list iterator currently points. More...
 
subroutine next (this)
 Moves the list iterator to the next link in the list. More...
 
logical function morevalues (this)
 Returns true if the pointer to a link is associated, and false otherwise. More...
 
subroutine reset (this)
 Resets link iterator to point at the first link in the list. More...
 
integer function list_index (this, value)
 
type(link) function, pointer list_link_at_index (this, index)
 
class(*) function, pointer list_value_at_index (this, index)
 
subroutine removecurrentvalue (this)
 Removes the current value from the list. The pointer is set to the previous element in the list. If the prevoius element does not exit, the pointer is set to the next element. More...
 
subroutine dissolvelist (this)
 Deallocates the list's links without deallocating its values. More...
 
subroutine purgecurrentvalue (this)
 Removes the current value from the list and deallocates its contents. The pointer is set to the previous element in the list. If the prevoius element does not exit, the pointer is set to the next element. More...
 
type(list) function, pointer list_from_polymorphic (x)
 Converts a polymorpihc pointer to a list pointer if possible, else returns a null-pointer. More...
 
subroutine deallocate_list (pList)
 Deallocates all values in the list. More...
 
subroutine deallocate_list_native (this)
 
integer function list_len (this)
 
subroutine sortlistbykey (someList, pKey)
 Sorts values in the list. More...
 
logical function sortkey (x1, x2)
 Dummy key for soriting. Always returns true. More...
 
logical function integerkey (x1, x2)
 Key for sorting integers. Returns true if x1 is less than x2. More...
 
recursive subroutine sortpreparedlistbykey (someList, pKey)
 Helper process for sortListByKey. More...
 
recursive subroutine listcatenationwithsorting (list1, list2, newList, pKey)
 Helper process for sortPreparedListByKey. More...
 

Detailed Description

Linked lists based on the module link_mod.f90.

Author
Mark Leair, PGI Compiler Engineer
Note
I don't understand how the subroutine sortListByKey works. It would be helpful to have a description.

Function/Subroutine Documentation

◆ addvalue()

subroutine polymorphic_list_mod::addvalue ( class(list this,
class(*), pointer  value,
procedure(deallocatorprocedure), intent(in), optional, pointer  pDeallocator 
)

Appends a new value to the end of the linked list. Current value is unaffected.

Here is the call graph for this function:

◆ appendlist()

subroutine polymorphic_list_mod::appendlist ( class(list this,
type(list newList 
)

Appends a new list to the linked list. Current values are unaffected.

◆ copylist()

type(list) function polymorphic_list_mod::copylist ( class(list this)
Here is the call graph for this function:

◆ currentvalue()

class(*) function, pointer polymorphic_list_mod::currentvalue ( class(list this)

Returns a pointer to the value in the link to which the list iterator currently points.

Here is the call graph for this function:

◆ deallocate_list()

subroutine polymorphic_list_mod::deallocate_list ( class(*), intent(inout), pointer  pList)

Deallocates all values in the list.

◆ deallocate_list_native()

subroutine polymorphic_list_mod::deallocate_list_native ( type(list), intent(inout)  this)

◆ dissolvelist()

subroutine polymorphic_list_mod::dissolvelist ( class(list this)

Deallocates the list's links without deallocating its values.

◆ firstvalue()

class(*) function, pointer polymorphic_list_mod::firstvalue ( class(list this)

Returns a pointer to the first value in the linked list.

Here is the call graph for this function:

◆ integerkey()

logical function polymorphic_list_mod::integerkey ( class(*), pointer  x1,
class(*), pointer  x2 
)

Key for sorting integers. Returns true if x1 is less than x2.

Here is the call graph for this function:

◆ list_any_no_params()

logical function polymorphic_list_mod::list_any_no_params ( class(list this,
procedure(logical_fn_no_params), intent(in), pointer  proc 
)
Here is the call graph for this function:

◆ list_any_one_param()

logical function polymorphic_list_mod::list_any_one_param ( class(list this,
procedure(logical_fn_one_param), intent(in), pointer  proc,
class(*), intent(in), pointer  par1 
)
Here is the call graph for this function:

◆ list_contains()

logical function polymorphic_list_mod::list_contains ( class(list this,
class(*), intent(in), pointer  value 
)

Returns true if the given value points to the same target as some value in the list.

◆ list_from_polymorphic()

type(list) function, pointer polymorphic_list_mod::list_from_polymorphic ( class(*), intent(in), pointer  x)

Converts a polymorpihc pointer to a list pointer if possible, else returns a null-pointer.

◆ list_index()

integer function polymorphic_list_mod::list_index ( class(list this,
class(*), pointer  value 
)

◆ list_len()

integer function polymorphic_list_mod::list_len ( class(list this)
Here is the call graph for this function:

◆ list_link_at_index()

type(link) function, pointer polymorphic_list_mod::list_link_at_index ( class(list this,
integer, intent(in)  index 
)
Here is the call graph for this function:

◆ list_swap_indices()

subroutine polymorphic_list_mod::list_swap_indices ( class(list this,
integer, intent(in)  index1,
integer, intent(in)  index2 
)

Swaps the values stored in he links at the given indices.

◆ list_value_at_index()

class(*) function, pointer polymorphic_list_mod::list_value_at_index ( class(list this,
  index 
)
Here is the call graph for this function:

◆ listcatenationwithsorting()

recursive subroutine polymorphic_list_mod::listcatenationwithsorting ( type(list), intent(in)  list1,
type(list), intent(in)  list2,
type(list), intent(inout)  newList,
procedure(sortkey), pointer  pKey 
)

Helper process for sortPreparedListByKey.

Here is the call graph for this function:

◆ mergelist()

subroutine polymorphic_list_mod::mergelist ( class(list this,
type(list addList 
)

Appends the second list's values to the first one without repetitions.

◆ morevalues()

logical function polymorphic_list_mod::morevalues ( class(list this)

Returns true if the pointer to a link is associated, and false otherwise.

Todo:
Rename moreValues to isEndOfList.
Here is the call graph for this function:

◆ next()

subroutine polymorphic_list_mod::next ( class(list this)

Moves the list iterator to the next link in the list.

◆ printlist()

subroutine polymorphic_list_mod::printlist ( class(list this)

◆ purgecurrentvalue()

subroutine polymorphic_list_mod::purgecurrentvalue ( class(list this)

Removes the current value from the list and deallocates its contents. The pointer is set to the previous element in the list. If the prevoius element does not exit, the pointer is set to the next element.

◆ removecurrentvalue()

subroutine polymorphic_list_mod::removecurrentvalue ( class(list this)

Removes the current value from the list. The pointer is set to the previous element in the list. If the prevoius element does not exit, the pointer is set to the next element.

Attention
The removed element is not deallocated, so it continues to take up space in the RAM.

◆ reset()

subroutine polymorphic_list_mod::reset ( class(list this)

Resets link iterator to point at the first link in the list.

◆ rotate_list_left()

subroutine polymorphic_list_mod::rotate_list_left ( class(list this)

Moves the first element of the given list to the end of the list.

◆ sortkey()

logical function polymorphic_list_mod::sortkey ( class(*), pointer  x1,
class(*), pointer  x2 
)

Dummy key for soriting. Always returns true.

Here is the call graph for this function:

◆ sortlistbykey()

subroutine polymorphic_list_mod::sortlistbykey ( type(list), intent(inout)  someList,
procedure(sortkey), pointer  pKey 
)

Sorts values in the list.

Parameters
pKeypoints to a logical function. When the funtions returns true, the links stay in the same order, and exchange otherwise.
Here is the call graph for this function:

◆ sortpreparedlistbykey()

recursive subroutine polymorphic_list_mod::sortpreparedlistbykey ( type(list), intent(inout)  someList,
procedure(sortkey), pointer  pKey 
)

Helper process for sortListByKey.

Here is the call graph for this function: