A platform for high-performance distributed tool and library development written in C++. It can be deployed in two different cluster modes: standalone or distributed. API for v0.5.0, released on June 13, 2018.
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
SimpleSendBytesRequest.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* *
3
* Copyright 2018 Rice University *
4
* *
5
* Licensed under the Apache License, Version 2.0 (the "License"); *
6
* you may not use this file except in compliance with the License. *
7
* You may obtain a copy of the License at *
8
* *
9
* http://www.apache.org/licenses/LICENSE-2.0 *
10
* *
11
* Unless required by applicable law or agreed to in writing, software *
12
* distributed under the License is distributed on an "AS IS" BASIS, *
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
14
* See the License for the specific language governing permissions and *
15
* limitations under the License. *
16
* *
17
*****************************************************************************/
18
19
#ifndef SIMPLE_SEND_BYTES_REQUEST_H
20
#define SIMPLE_SEND_BYTES_REQUEST_H
21
22
#include "
PDBLogger.h
"
23
24
// This templated function makes it easy to write a simple network client that asks a request,
25
// as a PDB object, then sends some data (as a Handle <pdb :: Vector <DataType>>) to a server and
26
// then gets a result.
27
//
28
// The type args are:
29
// RequestType: the type of object to create to send over the wire
30
// ResponseType: the type of object we expect to receive over the wire
31
// ReturnType: the type we will return to the caller
32
// RequestTypeParams: type of the params to use for the contructor to the object we send over the
33
//wre
34
//
35
// The params are:
36
// myLogger: The logger we write error messages to
37
// port: the port to send the request to
38
// address: the address to send the request to
39
// onErr: the value to return if there is an error sending/receiving data
40
// bytesForRequest: the number of bytes to give to the allocator used to build the request
41
// processResponse: the function used to process the response to the request
42
// args: the arguments to give to the constructor of the request
43
//
44
45
namespace
pdb {
46
47
template
<
class
RequestType,
class
ResponseType,
class
ReturnType,
class
... RequestTypeParams>
48
ReturnType
simpleSendBytesRequest
(
PDBLoggerPtr
myLogger,
49
int
port,
50
std::string address,
51
ReturnType onErr,
52
size_t
bytesForRequest,
53
function
<ReturnType(Handle<ResponseType>)> processResponse,
54
char
* bytes,
55
size_t
numBytes,
56
RequestTypeParams&&... args);
57
}
58
59
#endif
60
61
#include "
SimpleSendBytesRequest.cc
"
SimpleSendBytesRequest.cc
PDBLogger.h
pdb::simpleSendBytesRequest
ReturnType simpleSendBytesRequest(PDBLoggerPtr myLogger, int port, std::string address, ReturnType onErr, size_t bytesForRequest, function< ReturnType(Handle< ResponseType >)> processResponse, char *bytes, size_t numBytes, RequestTypeParams &&...args)
Definition:
SimpleSendBytesRequest.cc:35
pdb::PDBLoggerPtr
std::shared_ptr< PDBLogger > PDBLoggerPtr
Definition:
PDBLogger.h:40
plinycompute
pdb
src
communication
headers
SimpleSendBytesRequest.h
Generated on Mon Jun 18 2018 18:10:35 by
1.8.6