Commit 3abc8ed1 authored by Martin Beseda's avatar Martin Beseda
Browse files

FIX: Fixed container_t.

parent a2796e64
......@@ -26,5 +26,5 @@ add_library(interconnection_m SHARED net_m.f90)
target_link_libraries(interconnection_m data_kinds_4neuro_m time_measurement_m abstract_base_m)
add_library(net_m SHARED net_m.f90)
target_link_libraries(net_m interconnection_m data_kinds_4neuro_m time_measurement_m neuron_m connection_m abstract_base_m)
target_link_libraries(net_m interconnection_m data_kinds_4neuro_m time_measurement_m neuron_m connection_m abstract_base_m container_m)
......@@ -14,18 +14,12 @@ module container_m
!> Represents a container for a single container_t pointer
type :: container_t
private
class(abstract_base_t), pointer :: content
! Variable content is public to make usage of this class with one
! specific purpose as simple as possible.
contains
!> Getter for the private 'content' component
!! @return Pointer to the contained container (type container_t, pointer)
procedure :: get_content => get_content_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the container (type container_t, pointer)
procedure :: set_content => set_content_container_impl
class(abstract_base_t), pointer, public :: content
contains
!> Scalar desctructor for single instances of the class container_t
final :: destroy_container
......@@ -53,11 +47,12 @@ contains
!> Constructor of container_t class
!! @return Instance of the class container_t with nullified content
function new_container_empty() result(new_obj)
type(container_t) :: new_obj
type(container_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
allocate(new_obj)
new_obj%content => null()
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'new_container_empty')
......@@ -68,12 +63,13 @@ contains
!! @param[in] content_in connection to be contained (pointer)
!! @return Pointer to the instance of the class connection_t with assigned content
function new_container_assigned(content_in) result(new_obj)
class(abstract_base_t), pointer, intent(in) :: content_in
type(container_t) :: new_obj
class(abstract_base_t), pointer, intent(in) :: content_in
class(container_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
allocate(new_obj)
new_obj%content => content_in
#ifdef TIME_PROFILING
call time_profiling_stop(start_time, 'new_container_assigned')
......@@ -87,7 +83,7 @@ contains
subroutine destroy_container(this)
type(container_t), intent(inout) :: this
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
nullify(this%content)
......@@ -98,8 +94,8 @@ contains
!> Array desctructor for arrays of instances of the class container_t
subroutine destroy_container_array(this)
type(container_t), intent(inout) :: this(:)
integer :: i
type(container_t), intent(inout) :: this(:)
integer(kind=integer_4neuro) :: i
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -112,38 +108,4 @@ contains
#endif
end subroutine destroy_container_array
!-------------------!------------------------------------------------------------------
! Getters & Setters !
!-------------------!
!> Getter for the private 'content' component
!! @return Pointer to the contained connection (type connection_t, pointer)
function get_content_container_impl(this) result(content)
class(container_t), intent(in) :: this
class(abstract_base_t), pointer :: content
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
content => this%content
#ifdef TIME_PROFILING
call time_profiling_stop(start_time,'get_content_container_impl')
#endif
end function get_content_container_impl
!> Setter for the private 'content' component
!! @param[in] content Pointer to the connection (type connection_t, pointer)
subroutine set_content_container_impl(this, content)
class(container_t), intent(inout) :: this
class(abstract_base_t), pointer, intent(in) :: content
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
#endif
this%content => content
#ifdef TIME_PROFILING
call time_profiling_stop(start_time,'set_content_container_impl')
#endif
end subroutine set_content_container_impl
end module container_m
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment