MessageVector.F90 Source File


This file depends on

sourcefile~~messagevector.f90~~EfferentGraph sourcefile~messagevector.f90 MessageVector.F90 sourcefile~abstractmessage.f90 AbstractMessage.F90 sourcefile~messagevector.f90->sourcefile~abstractmessage.f90 sourcefile~collectivestagedatamessage.f90 CollectiveStageDataMessage.F90 sourcefile~messagevector.f90->sourcefile~collectivestagedatamessage.f90 sourcefile~mapl_exceptionhandling.f90 MAPL_ExceptionHandling.F90 sourcefile~messagevector.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~protocolparser.f90 ProtocolParser.F90 sourcefile~messagevector.f90->sourcefile~protocolparser.f90 sourcefile~abstractmessage.f90->sourcefile~mapl_exceptionhandling.f90 sourcefile~collectivestagedatamessage.f90->sourcefile~abstractmessage.f90 sourcefile~abstractcollectivedatamessage.f90 AbstractCollectiveDataMessage.F90 sourcefile~collectivestagedatamessage.f90->sourcefile~abstractcollectivedatamessage.f90 sourcefile~abstractdatareference.f90 AbstractDataReference.F90 sourcefile~collectivestagedatamessage.f90->sourcefile~abstractdatareference.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~collectivestagedatamessage.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~pfio_utilities.f90 pFIO_Utilities.F90 sourcefile~collectivestagedatamessage.f90->sourcefile~pfio_utilities.f90 sourcefile~mapl_errorhandling.f90 MAPL_ErrorHandling.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_errorhandling.f90 sourcefile~mapl_throw.f90 MAPL_Throw.F90 sourcefile~mapl_exceptionhandling.f90->sourcefile~mapl_throw.f90 sourcefile~protocolparser.f90->sourcefile~abstractmessage.f90 sourcefile~protocolparser.f90->sourcefile~collectivestagedatamessage.f90 sourcefile~addextcollectionmessage.f90 AddExtCollectionMessage.F90 sourcefile~protocolparser.f90->sourcefile~addextcollectionmessage.f90 sourcefile~addhistcollectionmessage.f90 AddHistCollectionMessage.F90 sourcefile~protocolparser.f90->sourcefile~addhistcollectionmessage.f90 sourcefile~collectiveprefetchdatamessage.f90 CollectivePrefetchDataMessage.F90 sourcefile~protocolparser.f90->sourcefile~collectiveprefetchdatamessage.f90 sourcefile~collectiveprefetchdonemessage.f90 CollectivePrefetchDoneMessage.F90 sourcefile~protocolparser.f90->sourcefile~collectiveprefetchdonemessage.f90 sourcefile~collectivestagedonemessage.f90 CollectiveStageDoneMessage.F90 sourcefile~protocolparser.f90->sourcefile~collectivestagedonemessage.f90 sourcefile~donemessage.f90 DoneMessage.F90 sourcefile~protocolparser.f90->sourcefile~donemessage.f90 sourcefile~dummymessage.f90 DummyMessage.F90 sourcefile~protocolparser.f90->sourcefile~dummymessage.f90 sourcefile~filemetadata.f90 FileMetadata.F90 sourcefile~protocolparser.f90->sourcefile~filemetadata.f90 sourcefile~forwarddatamessage.f90 ForwardDataMessage.F90 sourcefile~protocolparser.f90->sourcefile~forwarddatamessage.f90 sourcefile~handshakemessage.f90 HandShakeMessage.F90 sourcefile~protocolparser.f90->sourcefile~handshakemessage.f90 sourcefile~idmessage.f90 IDMessage.F90 sourcefile~protocolparser.f90->sourcefile~idmessage.f90 sourcefile~integermessagemap.f90 IntegerMessageMap.F90 sourcefile~protocolparser.f90->sourcefile~integermessagemap.f90 sourcefile~modifymetadatamessage.f90 ModifyMetadataMessage.F90 sourcefile~protocolparser.f90->sourcefile~modifymetadatamessage.f90 sourcefile~prefetchdatamessage.f90 PrefetchDataMessage.F90 sourcefile~protocolparser.f90->sourcefile~prefetchdatamessage.f90 sourcefile~prefetchdonemessage.f90 PrefetchDoneMessage.F90 sourcefile~protocolparser.f90->sourcefile~prefetchdonemessage.f90 sourcefile~replacemetadatamessage.f90 ReplaceMetadataMessage.F90 sourcefile~protocolparser.f90->sourcefile~replacemetadatamessage.f90 sourcefile~stagedatamessage.f90 StageDataMessage.F90 sourcefile~protocolparser.f90->sourcefile~stagedatamessage.f90 sourcefile~stagedonemessage.f90 StageDoneMessage.F90 sourcefile~protocolparser.f90->sourcefile~stagedonemessage.f90 sourcefile~terminatemessage.f90 TerminateMessage.F90 sourcefile~protocolparser.f90->sourcefile~terminatemessage.f90

Files dependent on this one

sourcefile~~messagevector.f90~~AfferentGraph sourcefile~messagevector.f90 MessageVector.F90 sourcefile~abstractserver.f90 AbstractServer.F90 sourcefile~abstractserver.f90->sourcefile~messagevector.f90 sourcefile~baseserver.f90 BaseServer.F90 sourcefile~baseserver.f90->sourcefile~messagevector.f90 sourcefile~baseserver.f90->sourcefile~abstractserver.f90 sourcefile~serverthread.f90 ServerThread.F90 sourcefile~baseserver.f90->sourcefile~serverthread.f90 sourcefile~forwarddataandmessage.f90 ForwardDataAndMessage.F90 sourcefile~forwarddataandmessage.f90->sourcefile~messagevector.f90 sourcefile~mocksocket.f90 MockSocket.F90 sourcefile~mocksocket.f90->sourcefile~messagevector.f90 sourcefile~multicommserver.f90 MultiCommServer.F90 sourcefile~multicommserver.f90->sourcefile~messagevector.f90 sourcefile~multicommserver.f90->sourcefile~abstractserver.f90 sourcefile~multicommserver.f90->sourcefile~baseserver.f90 sourcefile~multicommserver.f90->sourcefile~serverthread.f90 sourcefile~multigroupserver.f90 MultiGroupServer.F90 sourcefile~multigroupserver.f90->sourcefile~messagevector.f90 sourcefile~multigroupserver.f90->sourcefile~abstractserver.f90 sourcefile~multigroupserver.f90->sourcefile~baseserver.f90 sourcefile~multigroupserver.f90->sourcefile~forwarddataandmessage.f90 sourcefile~multigroupserver.f90->sourcefile~serverthread.f90 sourcefile~multilayerserver.f90 MultiLayerServer.F90 sourcefile~multilayerserver.f90->sourcefile~messagevector.f90 sourcefile~multilayerserver.f90->sourcefile~abstractserver.f90 sourcefile~multilayerserver.f90->sourcefile~baseserver.f90 sourcefile~multilayerserver.f90->sourcefile~serverthread.f90 sourcefile~pfio_writer.f90 pfio_writer.F90 sourcefile~pfio_writer.f90->sourcefile~messagevector.f90 sourcefile~serverthread.f90->sourcefile~messagevector.f90 sourcefile~serverthread.f90->sourcefile~abstractserver.f90 sourcefile~abstractdirectoryservice.f90 AbstractDirectoryService.F90 sourcefile~abstractdirectoryservice.f90->sourcefile~baseserver.f90 sourcefile~directoryservice.f90 DirectoryService.F90 sourcefile~directoryservice.f90->sourcefile~abstractserver.f90 sourcefile~directoryservice.f90->sourcefile~baseserver.f90 sourcefile~directoryservice.f90->sourcefile~serverthread.f90 sourcefile~mockserver.f90 MockServer.F90 sourcefile~mockserver.f90->sourcefile~baseserver.f90 sourcefile~mockserverthread.f90 MockServerThread.F90 sourcefile~mockserverthread.f90->sourcefile~serverthread.f90 sourcefile~mpiserver.f90 MpiServer.F90 sourcefile~mpiserver.f90->sourcefile~abstractserver.f90 sourcefile~mpiserver.f90->sourcefile~baseserver.f90 sourcefile~mpiserver.f90->sourcefile~serverthread.f90 sourcefile~openmpserver.f90 OpenMPServer.F90 sourcefile~openmpserver.f90->sourcefile~abstractserver.f90 sourcefile~openmpserver.f90->sourcefile~baseserver.f90 sourcefile~openmpserver.f90->sourcefile~serverthread.f90 sourcefile~pfio.f90 pFIO.F90 sourcefile~pfio.f90->sourcefile~abstractserver.f90 sourcefile~pfio.f90->sourcefile~baseserver.f90 sourcefile~pfio.f90->sourcefile~multicommserver.f90 sourcefile~pfio.f90->sourcefile~multigroupserver.f90 sourcefile~pfio.f90->sourcefile~multilayerserver.f90 sourcefile~pfio.f90->sourcefile~serverthread.f90 sourcefile~serverthreadvector.f90 ServerThreadVector.F90 sourcefile~serverthreadvector.f90->sourcefile~serverthread.f90 sourcefile~test_client.pf Test_Client.pf sourcefile~test_client.pf->sourcefile~mocksocket.f90 sourcefile~test_serverthread.pf Test_ServerThread.pf sourcefile~test_serverthread.pf->sourcefile~mocksocket.f90 sourcefile~test_serverthread.pf->sourcefile~serverthread.f90 sourcefile~test_simplesocket.pf Test_SimpleSocket.pf sourcefile~test_simplesocket.pf->sourcefile~serverthread.f90

Source Code

#include "MAPL_ErrLog.h"
#include "unused_dummy.H"

module pFIO_MessageVectorMod
   use pFIO_AbstractMessageMod

#define _type class(AbstractMessage)
#define _allocatable
#define _vector MessageVector
#define _iterator MessageVectorIterator
#define _niterator MessageVectorRIterator
#include "templates/vector.inc"

end module pFIO_MessageVectorMod

module pFIO_MessageVectorUtilMod
   use MAPL_ExceptionHandling
   use pFIO_AbstractMessageMod
   use pFIO_MessageVectorMod
   use pFIO_ProtocolParserMod
   use pFIO_CollectiveStageDataMessageMod
   use, intrinsic :: iso_fortran_env, only: INT64
   implicit none
   private 

   public:: serialize_message_vector
   public:: deserialize_message_vector

contains

  subroutine serialize_message_vector(msgVec,buffer, rc)
     type (MessageVector),intent(in) :: msgVec
     integer, allocatable,intent(inout) :: buffer(:)
     integer, optional, intent(out) :: rc
     integer, allocatable :: tmp(:)
     class (AbstractMessage),pointer :: msg
     integer :: n, i
     type (ProtocolParser) :: parser

     n = msgVec%size()
     parser = ProtocolParser()
     allocate(tmp(0))
     do i = 1, n
        msg=>msgVec%at(i)
        tmp =[tmp, parser%encode(msg)]
     enddo

     if(size(tmp, kind=INT64) > huge(0)) then
       _FAIL("need to increase oserver's nfront")
     endif

     i = size(tmp)+1

     if (allocated(buffer)) deallocate(buffer)
     buffer =[i,tmp]

  end subroutine

  subroutine deserialize_message_vector(buffer, msgVec, rc)
     type (MessageVector),intent(inout) :: msgVec
     integer, intent(in) :: buffer(:)
     integer, optional, intent(out) :: rc

     class (AbstractMessage),allocatable:: msg

     integer :: n, length
     type (ProtocolParser) :: parser
    ! integer, allocatable :: buffer_test(:)

     parser = ProtocolParser()
     length = buffer(1)
     n=2
     msgVec = MessageVector()
     do while (n < length)
       allocate(msg, source = parser%decode(buffer(n:))) 
       call msgVec%push_back(msg)
       n = n + msg%get_length()+1 
       deallocate(msg)
     enddo
     _ASSERT(n-1 == length, "wrong length of message vector")

    ! lazy UNIT test! W.J notes: ifor passes, gfortran fails
    ! call serialize_message_vector(msgVec,buffer_test)
    ! _ASSERT(all(buffer(1:length) == buffer_test), "serialize-deserialize error")
    
     _RETURN(_SUCCESS)
  end subroutine

end module pFIO_MessageVectorUtilMod