MONC
Private Member Functions | List of all members
collections_mod::c_add_string Interface Reference

Adds a string to the end of the list. More...

Private Member Functions

subroutine list_add_string (specificlist, str_data)
 Adds an element to the end of the list. More...
 
subroutine hashset_add (specificset, key)
 Adds a string to the hashset which stores unique strings, therefore if the string already exists then this is ignored. More...
 

Detailed Description

Adds a string to the end of the list.

This has a time complexity of O(1)

Parameters
collectionThe specific list involved
dataString data to add

Definition at line 222 of file collections.F90.

Member Function/Subroutine Documentation

◆ hashset_add()

subroutine collections_mod::c_add_string::hashset_add ( type(hashset_type), intent(inout)  specificset,
character(len=*), intent(in)  key 
)
private

Adds a string to the hashset which stores unique strings, therefore if the string already exists then this is ignored.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificsetThe specific set involved
keyThe string key to add to the set

Definition at line 1958 of file collections.F90.

1959  type(hashset_type), intent(inout) :: specificset
1960  character(len=*), intent(in) :: key
1961 
1962  class(*), pointer :: generic
1963  type(setnode_type), pointer :: newsetnode
1964  integer :: hash, location
1965 
1966  if (.not. associated(specificset%set_ds)) allocate(specificset%set_ds(hash_size))
1967 
1968  call hashset_getlocation(specificset, key, hash, location)
1969 
1970  if (hash .gt. 0 .and. location .eq. 0) then
1971  allocate(newsetnode)
1972  newsetnode%key=key
1973  ! Clone and deallocate the newmapnode - this keeps GNU happy with passing the correct pointer and Cray
1974  ! doesn't link the generic pointer just pointing to the data structure hence we clone it
1975  allocate(generic, source=newsetnode)
1976  deallocate(newsetnode)
1977  call list_add_generic(specificset%set_ds(hash), generic, .true.)
1978  specificset%size=specificset%size+1
1979  end if

◆ list_add_string()

subroutine collections_mod::c_add_string::list_add_string ( type(list_type), intent(inout)  specificlist,
character(len=string_length), intent(in)  str_data 
)
private

Adds an element to the end of the list.

Do not call directly from external module, this is called via the appropriate interface

Parameters
specificlistThe specific list involved
dataString data to add

Definition at line 2917 of file collections.F90.

2918  type(list_type), intent(inout) :: specificlist
2919  character(len=STRING_LENGTH), intent(in) :: str_data
2920 
2921  class(*), pointer :: generic
2922 
2923  generic=>conv_to_generic(str_data, .true.)
2924  call list_add_generic(specificlist, generic, .true.)

The documentation for this interface was generated from the following file: