subroutine UnlimitedEntity_deserialize( buffer,this, rc)
integer, intent(in) :: buffer(:)
type (UnlimitedEntity),intent(inout) :: this
integer, optional, intent(out) :: rc
integer :: status
this = UnlimitedEntity()
call deserialize(this, buffer, rc=status)
_VERIFY(status)
_RETURN(_SUCCESS)
contains
subroutine deserialize( this, buffer, rc)
class (UnlimitedEntity), target,intent(inout) :: this
integer, intent(in) :: buffer(:)
integer, optional, intent(out) :: rc
integer :: n,type_kind,length
integer(KIND=INT32) :: value_int32
integer(KIND=INT64) :: value_int64
real(KIND=REAL32) :: value_real32
real(KIND=REAL64) :: value_real64
logical :: value_logical
integer(KIND=INT32), allocatable :: values_int32(:)
integer(KIND=INT64), allocatable :: values_int64(:)
real(KIND=REAL32), allocatable :: values_real32(:)
real(KIND=REAL64), allocatable :: values_real64(:)
logical, allocatable :: values_logical(:)
character(len=:), allocatable :: value_char
integer :: rank
n = 1
call deserialize_intrinsic(buffer(n:),length)
_ASSERT(length == size(buffer),'length does not match')
n = n + serialize_buffer_length(length)
call deserialize_intrinsic(buffer(n:),this%shape)
n = n + serialize_buffer_length(this%shape)
call deserialize_intrinsic(buffer(n:),type_kind)
n = n + serialize_buffer_length(type_kind)
rank = this%get_rank()
select case (rank)
case (0)
select case (type_kind)
case (pFIO_INT32)
call deserialize_intrinsic(buffer(n:),value_int32)
call this%set(value_int32)
case (pFIO_INT64)
call deserialize_intrinsic(buffer(n:),value_int64)
call this%set(value_int64)
case (pFIO_REAL32)
call deserialize_intrinsic(buffer(n:),value_real32)
call this%set(value_real32)
case (pFIO_REAL64)
call deserialize_intrinsic(buffer(n:),value_real64)
call this%set(value_real64)
case (pFIO_LOGICAL)
call deserialize_intrinsic(buffer(n:),value_logical)
call this%set(value_logical)
case (pFIO_STRING)
call deserialize_intrinsic(buffer(n:),value_char)
call this%set(value_char)
case (pFIO_UNSUPPORTED_TYPE)
! this is uninitialized case, make sure shape is not allocated even it is empty
if (allocated(this%shape))deallocate(this%shape)
case default
_FAIL( "UnlimitedEntity deserialize not support")
end select
case (1:)
select case (type_kind)
case (pFIO_INT32)
call deserialize_intrinsic(buffer(n:),values_int32)
allocate(this%values, source =values_int32)
case (pFIO_INT64)
call deserialize_intrinsic(buffer(n:),values_int64)
allocate(this%values, source =values_int64)
case (pFIO_REAL32)
call deserialize_intrinsic(buffer(n:),values_real32)
allocate(this%values, source =values_real32)
case (pFIO_REAL64)
call deserialize_intrinsic(buffer(n:),values_real64)
allocate(this%values, source =values_real64)
case (pFIO_LOGICAL)
call deserialize_intrinsic(buffer(n:),values_logical)
allocate(this%values, source =values_logical)
case default
_FAIL( "UnlimitedEntity deserialize not support")
end select
end select
_RETURN(_SUCCESS)
end subroutine deserialize
end subroutine UnlimitedEntity_deserialize