(git:c5411e0)
Loading...
Searching...
No Matches
cp_linked_list_fm Module Reference

Data Types

interface  cp_create
 
interface  cp_dealloc
 
interface  cp_get_element_at
 
interface  cp_get_first_el
 
interface  cp_get_length
 
interface  cp_get_rest
 
interface  cp_insert
 
interface  cp_next
 
interface  cp_remove_all
 
interface  cp_remove_el
 
interface  cp_remove_first_el
 
interface  cp_set_element_at
 
type  cp_sll_fm_p_type
 pointer to a linked list (to make arrays of pointers) More...
 
type  cp_sll_fm_type
 represent a single linked list that stores pointers to the elements More...
 
interface  cp_to_array
 

Functions/Subroutines

subroutine, public cp_sll_fm_create (sll, first_el, rest)
 allocates and initializes a single linked list
 
subroutine, public cp_sll_fm_dealloc (sll)
 deallocates the singly linked list starting at sll. Does not work if loops are present!
 
type(cp_fm_type) function, pointer, public cp_sll_fm_get_first_el (sll)
 returns the first element stored in the list
 
type(cp_sll_fm_type) function, pointer, public cp_sll_fm_get_rest (sll, iter)
 returns the rest of the list
 
integer function, public cp_sll_fm_get_length (sll)
 returns the length of the list
 
type(cp_fm_type) function, pointer, public cp_sll_fm_get_el_at (sll, index)
 returns the element at the given index
 
subroutine, public cp_sll_fm_set_el_at (sll, index, value)
 sets the element at the given index
 
logical function, public cp_sll_fm_next (iterator, el_att)
 returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next element
 
subroutine, public cp_sll_fm_insert_el (sll, el)
 insert an element at the beginning of the list
 
subroutine, public cp_sll_fm_rm_first_el (sll)
 remove the first element of the linked list
 
subroutine, public cp_sll_fm_insert_el_at (sll, el, index)
 inserts the element at the given index
 
subroutine, public cp_sll_fm_rm_el_at (sll, index)
 removes the element at the given index
 
subroutine, public cp_sll_fm_rm_all_el (sll)
 removes all the elements from the list
 
type(cp_fm_p_type) function, dimension(:), pointer, public cp_sll_fm_to_array (sll)
 returns a newly allocated array with the same contents as the linked list
 

Function/Subroutine Documentation

◆ cp_sll_fm_create()

subroutine, public cp_linked_list_fm::cp_sll_fm_create ( type(cp_sll_fm_type), pointer  sll,
type(cp_fm_type), optional, pointer  first_el,
type(cp_sll_fm_type), optional, pointer  rest 
)

allocates and initializes a single linked list

Parameters
sllthe single linked list to initialize
first_elthe first element of this list
restthe following elements (if not given: empty)
History
none
Author
Fawzi Mohamed

Definition at line 166 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_dealloc()

subroutine, public cp_linked_list_fm::cp_sll_fm_dealloc ( type(cp_sll_fm_type), pointer  sll)

deallocates the singly linked list starting at sll. Does not work if loops are present!

Parameters
sllthe list to be deallocated
History
none
Author
Fawzi Mohamed
Note
does not deallocate the elements that are stored in the list check more?

Definition at line 193 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_get_first_el()

type(cp_fm_type) function, pointer, public cp_linked_list_fm::cp_sll_fm_get_first_el ( type(cp_sll_fm_type), pointer  sll)

returns the first element stored in the list

Parameters
sllthe single linked list to get the element from
Returns
...
History
none
Author
Fawzi Mohamed

Definition at line 224 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_get_rest()

type(cp_sll_fm_type) function, pointer, public cp_linked_list_fm::cp_sll_fm_get_rest ( type(cp_sll_fm_type), pointer  sll,
integer, optional  iter 
)

returns the rest of the list

Parameters
sllthe single linked list to get the rest from
iterhow many times the call to rest should be iterated, defaults to 1; -1 means till end of the list.
Returns
...
History
none
Author
Fawzi Mohamed
Note
split the case iter=1 to make it more optimized?

Definition at line 243 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_get_length()

integer function, public cp_linked_list_fm::cp_sll_fm_get_length ( type(cp_sll_fm_type), pointer  sll)

returns the length of the list

Parameters
sllthe list you want to know the length of
Returns
...
History
none
Author
Fawzi Mohamed
Note
slow (O(n))

Definition at line 285 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_get_el_at()

type(cp_fm_type) function, pointer, public cp_linked_list_fm::cp_sll_fm_get_el_at ( type(cp_sll_fm_type), pointer  sll,
integer, intent(in)  index 
)

returns the element at the given index

Parameters
sllthe list you get the element from
indexthe position of the element (stating at 1)
Returns
...
History
none
Author
Fawzi Mohamed
Note
slow (O(index))

Definition at line 314 of file cp_linked_list_fm.F.

◆ cp_sll_fm_set_el_at()

subroutine, public cp_linked_list_fm::cp_sll_fm_set_el_at ( type(cp_sll_fm_type), pointer  sll,
integer, intent(in)  index,
type(cp_fm_type), pointer  value 
)

sets the element at the given index

Parameters
sllthe list you get the element from
indexthe position of the element (stating at 1) -1 means at the end
valuethe new element
History
none
Author
Fawzi Mohamed
Note
slow (O(index))

Definition at line 343 of file cp_linked_list_fm.F.

◆ cp_sll_fm_next()

logical function, public cp_linked_list_fm::cp_sll_fm_next ( type(cp_sll_fm_type), pointer  iterator,
type(cp_fm_type), optional, pointer  el_att 
)

returns true if the actual element is valid (i.e. iterator ont at end) moves the iterator to the next element

Parameters
iteratoriterator that moves along the list
el_attthe actual element (valid only if the function returns true)
Returns
...
History
none
Author
Fawzi Mohamed

Definition at line 372 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_insert_el()

subroutine, public cp_linked_list_fm::cp_sll_fm_insert_el ( type(cp_sll_fm_type), pointer  sll,
type(cp_fm_type), pointer  el 
)

insert an element at the beginning of the list

Parameters
sllthe single linked list point at the beginning of which you want to add the element
elthe element to add
History
none
Author
Fawzi Mohamed
Note
fast (O(1))

Definition at line 399 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_rm_first_el()

subroutine, public cp_linked_list_fm::cp_sll_fm_rm_first_el ( type(cp_sll_fm_type), pointer  sll)

remove the first element of the linked list

Parameters
sllthe list whose first element has to be removed
History
none
Author
Fawzi Mohamed
Note
fast (O(1))

Definition at line 421 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_insert_el_at()

subroutine, public cp_linked_list_fm::cp_sll_fm_insert_el_at ( type(cp_sll_fm_type), pointer  sll,
type(cp_fm_type), pointer  el,
integer, intent(in)  index 
)

inserts the element at the given index

Parameters
sllthe list you get the element from
elthe new element
indexthe position of the element (stating at 1). If it is -1, it means at end
History
none
Author
Fawzi Mohamed
Note
slow (O(index))

Definition at line 447 of file cp_linked_list_fm.F.

Here is the call graph for this function:

◆ cp_sll_fm_rm_el_at()

subroutine, public cp_linked_list_fm::cp_sll_fm_rm_el_at ( type(cp_sll_fm_type), pointer  sll,
integer, intent(in)  index 
)

removes the element at the given index

Parameters
sllthe list you get the element from
indexthe position of the element (stating at 1)
History
none
Author
Fawzi Mohamed
Note
slow (O(index))

Definition at line 477 of file cp_linked_list_fm.F.

◆ cp_sll_fm_rm_all_el()

subroutine, public cp_linked_list_fm::cp_sll_fm_rm_all_el ( type(cp_sll_fm_type), pointer  sll)

removes all the elements from the list

Parameters
sllthe list that should be removed
History
none
Author
Fawzi Mohamed
Note
check more?

Definition at line 505 of file cp_linked_list_fm.F.

Here is the caller graph for this function:

◆ cp_sll_fm_to_array()

type(cp_fm_p_type) function, dimension(:), pointer, public cp_linked_list_fm::cp_sll_fm_to_array ( type(cp_sll_fm_type), pointer  sll)

returns a newly allocated array with the same contents as the linked list

Parameters
sllthe list to transform in array
Returns
...
History
07.2002 created [fawzi]
Author
Fawzi Mohamed

Definition at line 529 of file cp_linked_list_fm.F.