Open Lighting Architecture
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 <sys/uio.h>
27
28
namespace
ola {
29
namespace
io {
30
35
class
IOVecInterface
{
36
public
:
37
virtual
~
IOVecInterface
() {}
38
39
/*
40
* Returns a pointer to an array of iovecs and sets io_count to be the
41
* number of iovecs in the array
42
*/
43
virtual
const
struct
iovec *AsIOVec(
int
*io_count)
const
= 0;
44
48
virtual
void
Pop
(
unsigned
int
bytes) = 0;
49
50
/*
51
* Frees the iovec array returned by AsIOVec()
52
*/
53
static
void
FreeIOVec(
const
struct
iovec *iov) {
54
if
(iov)
55
delete
[] iov;
56
}
57
};
58
}
// namespace io
59
}
// namespace ola
60
#endif // INCLUDE_OLA_IO_IOVECINTERFACE_H_
Generated on Fri Apr 4 2014 11:54:22 for Open Lighting Architecture by
1.8.1.2