Skip to content
Snippets Groups Projects
PEmptyBackend.cpp 4.55 KiB
Newer Older
Pierre Aubert's avatar
Pierre Aubert committed
/***************************************
	Auteur : Pierre Aubert
	Mail : pierre.aubert@lapp.in2p3.fr
	Licence : CeCILL-C
****************************************/

#include "PEmptyBackend.h"


///Default constructor of PEmptyBackend
PEmptyBackend::PEmptyBackend(){
	
}

///Create param for a client socket
/**	@param address : address of the server to be connected to
 * 	@param port : port to be used
 * 	@return corresponding PZmqParam
*/
PEmptyBackend::Param PEmptyBackend::client(const std::string & address, size_t port){
	PEmptyBackend::Param param;
	param.address = address;
	param.port = port;
	return param;
}

///Create param for a server socket
/**	@param address : address of the server to be connected to
 * 	@param port : port to be used
 * 	@return corresponding PZmqParam
*/
PEmptyBackend::Param PEmptyBackend::server(const std::string & address, size_t port){
	return PEmptyBackend::client(address, port);
}

///Create a client socket
/**	@param[out] socket : socket to be created
 * 	@param address : address of the server, the client has to connect to
 * 	@param port : port to be used for the connection
 * 	@param param : extra customisable parameters for the creation of the socket (depends on the backend)
 * 	@return true if the socket has been created, false otherwise
*/
bool PEmptyBackend::createClientSocket(PEmptyBackend::Socket & socket, const std::string & address, size_t port, const PEmptyParam & param){
	return true;
}

///Create a client socket
/**	@param[out] socket : socket to be created
 * 	@param address : address of the server, the client has to connect to
 * 	@param port : port to be used for the connection
 * 	@param param : extra customisable parameters for the creation of the socket (depends on the backend)
 * 	@return true if the socket has been created, false otherwise
*/
bool PEmptyBackend::createServerSocket(PEmptyBackend::Socket & socket, const std::string & address, size_t port, const PEmptyParam & param){
	return true;
}

///Create a client socket
/**	@param[out] socket : socket to be created
 * 	@param param : extra customisable parameters for the creation of the socket (depends on the backend)
 * 	@return true if the socket has been created, false otherwise
*/
bool PEmptyBackend::createClientSocket(PEmptyBackend::Socket & socket, const PEmptyParam & param){
	return true;
}

///Create a client socket
/**	@param[out] socket : socket to be created
 * 	@param param : extra customisable parameters for the creation of the socket (depends on the backend)
 * 	@return true if the socket has been created, false otherwise
*/
bool PEmptyBackend::createServerSocket(PEmptyBackend::Socket & socket, const PEmptyParam & param){
	return true;
}

///Send message on the given socket
/**	@param socket : socket to be used
 * 	@param msg : message to be sent
 * 	@param flag : flags to be used to send the message (BLOCK, NON_BLOCK, etc)
Pierre Aubert's avatar
Pierre Aubert committed
 * 	@return true on success, false otherwise
*/
bool PEmptyBackend::send(PEmptyBackend::Socket & socket, const PEmptyBackend::Message & msg, PSendFlag::PSendFlag flag){
Pierre Aubert's avatar
Pierre Aubert committed
	return true;
}

///Recieve message from the given socket
/**	@param socket : socket to be used
 * 	@param msg : message to be recieved
 * 	@param flag : flags to be used to send the message (BLOCK, NON_BLOCK, etc)
Pierre Aubert's avatar
Pierre Aubert committed
 * 	@return true on success, false otherwise
*/
bool PEmptyBackend::recv(PEmptyBackend::Socket & socket, PEmptyBackend::Message & msg, PRecvFlag::PRecvFlag flag){
Pierre Aubert's avatar
Pierre Aubert committed
	return false;
}

///Resize a message
/**	@param[out] msg : message to be resized
 * 	@param sizeMsg : new size of the message
*/
void PEmptyBackend::msgResize(PEmptyBackend::Message& msg, size_t sizeMsg){
	msg.resize(sizeMsg);
}

///Get the size of a message
/**	@param msg : message to be used
 * 	@return size of the message in bytes
*/
size_t PEmptyBackend::msgSize(const PEmptyBackend::Message& msg){
	return msg.size();
}

///Get the data of a message
/**	@param msg : message to be used
 * 	@return data of the message in bytes
*/
const DataStreamIter PEmptyBackend::msgData(const PEmptyBackend::Message& msg){
	return (const DataStreamIter)msg.data();
Pierre Aubert's avatar
Pierre Aubert committed
}

///Get the data of a message
/**	@param msg : message to be used
 * 	@return data of the message in bytes
*/
DataStreamIter PEmptyBackend::msgData(PEmptyBackend::Message& msg){
Pierre Aubert's avatar
Pierre Aubert committed
	return msg.data();
}


///Close the given socket
/**	@param[out] socket : socket to be closed
*/
void PEmptyBackend::close(PEmptyBackend::Socket & socket){
	
}

///Close the given socket
/**	@param socket : socket to be checked
 * 	@return true if the socket is connected, false otherwise
*/
bool PEmptyBackend::isConnected(const PEmptyBackend::Socket & socket){
	return true;
}