PhoenixSocket  4.0.1
Library which integrates socket unix use in Phoenix
Loading...
Searching...
No Matches
PEmptyBackend_impl.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __PEMPTY_BACKEND_IMPL_H__
8#define __PEMPTY_BACKEND_IMPL_H__
9
10#include "phoenix_data_stream.h"
11#include "PEmptyBackend.h"
12
14
18template<typename T>
20 size_t dataSize(data_size<T>(data));
22 Message msg;
23 msg.resize(dataSize);
24 DataStreamIter iter = (DataStreamIter)msg.data();
25 if(data_message_save<T>(iter, data)){ //Save the message
26 sendStatus = sendMsg(msg, flag);
27 }else{
29 }
30 return sendStatus;
31}
32
34
38template<typename T>
41 Message msg;
42 recvStatus = recvMsg(msg, flag);
43 //If the message is empty we cannot initialise the given data, so, this is an error
44 if(msg.size() != 0lu){
45 DataStreamIter iter = (DataStreamIter)msg.data();
46 if(!data_message_load<T>(iter, data)){
48 }
49 }else{
51 }
52 return recvStatus;
53}
54
55
56#endif
57
PRecvStatus::PRecvStatus recvData(T &data, PRecvFlag::PRecvFlag flag)
Recieved data with the socket.
PRecvStatus::PRecvStatus recvMsg(Message &msg, PRecvFlag::PRecvFlag flag)
Recieved data with the socket.
DataStreamMsg Message
Define the type of message used by the PAbstractSocketManager.
PSendStatus::PSendStatus sendData(const T &data, PSendFlag::PSendFlag flag)
Send data with the socket.
PSendStatus::PSendStatus sendMsg(const Message &msg, PSendFlag::PSendFlag flag)
Specialisation to send a Message with the PEmptySocket.
PRecvFlag
describe the receiving flag of the Socket
Definition PSocketFlag.h:41
PRecvStatus
describe the result of the recv
Definition PSocketFlag.h:52
@ CANNOT_DESERIALIZE_DATA
Definition PSocketFlag.h:60
@ NO_MESSAGE_RECEIVED
Definition PSocketFlag.h:54
PSendFlag
describe the sending flag of the Socket
Definition PSocketFlag.h:14
PSendStatus
describe the result of the send
Definition PSocketFlag.h:25
@ CANNOT_SERIALIZE_DATA
Definition PSocketFlag.h:32