Open Lighting Architecture
0.9.4
Main Page
Modules
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
ola
io
IOVecInterface.h
1
/*
2
* This library is free software; you can redistribute it and/or
3
* modify it under the terms of the GNU Lesser General Public
4
* License as published by the Free Software Foundation; either
5
* version 2.1 of the License, or (at your option) any later version.
6
*
7
* This library is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
* Lesser General Public License for more details.
11
*
12
* You should have received a copy of the GNU Lesser General Public
13
* License along with this library; if not, write to the Free Software
14
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15
*
16
* IOVecInterface.h
17
* An interface for a class which provides a way of accessing it's data via
18
* iovecs. This allows us to write the contents of the class to a network
19
* socket without incurring a copy.
20
* Copyright (C) 2013 Simon Newton
21
*/
22
23
#ifndef INCLUDE_OLA_IO_IOVECINTERFACE_H_
24
#define INCLUDE_OLA_IO_IOVECINTERFACE_H_
25
26
#include <stdlib.h>
27
28
namespace
ola {
29
namespace
io {
30
36
struct
IOVec
{
37
public
:
38
/*
39
* Contains the address of a buffer.
40
*/
41
void
* iov_base;
42
43
/*
44
* Contains the length of the buffer.
45
*/
46
size_t
iov_len;
47
};
48
53
class
IOVecInterface
{
54
public
:
55
virtual
~
IOVecInterface
() {}
56
57
/*
58
* Returns a pointer to an array of IOVecs and sets io_count to be the
59
* number of IOVecs in the array.
60
*/
61
virtual
const
struct
IOVec
*AsIOVec(
int
*io_count)
const
= 0;
62
66
virtual
void
Pop
(
unsigned
int
bytes) = 0;
67
68
/*
69
* Frees the IOVec array returned by AsIOVec()
70
*/
71
static
void
FreeIOVec(
const
struct
IOVec
*iov) {
72
if
(iov)
73
delete
[] iov;
74
}
75
};
76
}
// namespace io
77
}
// namespace ola
78
#endif // INCLUDE_OLA_IO_IOVECINTERFACE_H_
Generated on Wed Jan 28 2015 16:56:22 for Open Lighting Architecture by
1.8.1.2