Project

General

Profile

vector_ref Derived Type

type, public, extends(object) :: vector_ref

type~~vector_ref~~InheritsGraph type~vector_ref vector_ref type~vector_item vector_item type~vector_item->type~vector_ref items object object object->type~vector_ref


Array-based, self-extending vector containing references to arbitrary data.

Vectors may be initialized by passing an array to the constructor, or by creating an empty vector and subsequently adding items. In any case, only references to these elements are stored, i.e. the original data must have the 'target' attribute. Changing the base data will also change the vector items.

Inherited By

type~~vector_ref~~InheritedByGraph type~vector_ref vector_ref type~vector_iterator vector_iterator type~vector_ref->type~vector_iterator my_vector

Components

TypeVisibility AttributesNameInitial
integer, private :: current_size =0
integer, private :: maximum_size =0
logical, private :: verbose =.false.
type(vector_item), private, allocatable:: items(:)

Constructor

private interface vector_ref

  • private function new_empty(verbose, initial_size) result(this)

    Arguments

    Type IntentOptional AttributesName
    logical, intent(in), optional :: verbose
    integer, intent(in), optional :: initial_size

    Return Value type(vector_ref)

  • private function new_from_array(items, verbose, initial_size) result(this)

    Arguments

    Type IntentOptional AttributesName
    class(*), intent(in), target:: items(:)
    logical, intent(in), optional :: verbose
    integer, intent(in), optional :: initial_size

    Return Value type(vector_ref)

    Description

    Create a vector from a pre-existing array


Finalization Procedures

final :: destroy

private recursive subroutine destroy(this)

Arguments

Type IntentOptional AttributesName
type(vector_ref), intent(inout) :: this

Type-Bound Procedures

procedure, public :: clone

  • private subroutine clone(this, copy)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this
    class(vector_ref), intent(inout) :: copy

procedure, public :: clear

  • private subroutine clear(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this

procedure, public :: extend

  • private subroutine extend(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this

procedure, public :: at

  • private function at(this, idx)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this
    integer, intent(in) :: idx

    Return Value class(*), pointer

procedure, public :: find

  • private function find(this, my_stuff, offset)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this
    class(*), intent(in) :: my_stuff
    integer, intent(in), optional :: offset

    Return Value integer

procedure, public :: add_item

  • private recursive subroutine add_item(this, new_stuff)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(*), intent(in), target:: new_stuff

generic, public :: add => add_item

  • private recursive subroutine add_item(this, new_stuff)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(*), intent(in), target:: new_stuff

procedure, public :: add_array

  • private subroutine add_array(this, items)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(*), intent(in), target:: items(:)

procedure, public :: add_vector

  • private subroutine add_vector(this, that)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(vector_ref), intent(in) :: that

procedure, public :: add_iter

generic, public :: add_list => add_array

  • private subroutine add_array(this, items)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(*), intent(in), target:: items(:)

generic, public :: add_list => add_vector

  • private subroutine add_vector(this, that)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    class(vector_ref), intent(in) :: that

generic, public :: add_list => add_iter

procedure, public :: set_verbose

  • private subroutine set_verbose(this, value)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(inout) :: this
    logical , optional :: value

procedure, public :: get_verbose

  • private function get_verbose(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this

    Return Value logical

procedure, public :: length

  • private function length(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this

    Return Value integer

procedure, public :: capacity

  • private function capacity(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this

    Return Value integer

procedure, public :: includes

  • private function includes(this, my_stuff)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this
    class(*), intent(in) :: my_stuff

    Return Value logical

procedure, public :: iter

  • private function iter(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this

    Return Value type(vector_iterator)

procedure, public :: is_equal

  • private recursive function is_equal(this, that) result(equal)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this
    class(*), intent(in) :: that

    Return Value logical

procedure, public :: to_string

  • private recursive function to_string(this)

    Arguments

    Type IntentOptional AttributesName
    class(vector_ref), intent(in) :: this

    Return Value character(len=:), allocatable

Source Code

    type, extends(object), public :: vector_ref
        private
        integer :: current_size = 0
        integer :: maximum_size = 0
        logical :: verbose = .false.
        type(vector_item), allocatable :: items(:)
    contains
        procedure :: clone
        final :: destroy
        procedure :: clear
        procedure :: extend
        procedure :: at
        procedure :: find
        procedure :: add_item
        generic :: add => add_item
        procedure :: add_array
        procedure :: add_vector
        procedure :: add_iter
        generic :: add_list => add_array
        generic :: add_list => add_vector
        generic :: add_list => add_iter
        procedure :: set_verbose
        procedure :: get_verbose
        procedure :: length
        procedure :: capacity
        procedure :: includes
        procedure :: iter
        procedure :: is_equal
        procedure :: to_string
        ! first, last, pop, push, shift, unshift, uniq
    end type vector_ref

© 2016
self was developed by
Documentation generated by FORD