Collage
1.0.1
Object-Oriented C++ Network Library
Main Page
Related Pages
Namespaces
Classes
Files
File List
install
include
co
array.h
1
2
/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
3
*
4
* This file is part of Collage <https://github.com/Eyescale/Collage>
5
*
6
* This library is free software; you can redistribute it and/or modify it under
7
* the terms of the GNU Lesser General Public License version 2.1 as published
8
* by the Free Software Foundation.
9
*
10
* This library is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
* details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* along with this library; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
*/
19
20
#ifndef CO_ARRAY_H
21
#define CO_ARRAY_H
22
23
#include <co/types.h>
24
25
namespace
co
26
{
28
template
<
class
T >
class
Array
29
{
30
public
:
32
explicit
Array
( T* data_,
const
size_t
num_ )
33
:
data
( data_ ),
num
( num_ ) {}
34
36
size_t
getNumBytes
()
const
{
return
num
*
sizeof
( T ); }
37
38
T*
const
data
;
39
const
size_t
num
;
40
};
41
42
template
<>
inline
size_t
Array< void >::getNumBytes
()
const
{
return
num; }
43
template
<>
inline
size_t
Array< const void >::getNumBytes
()
const
44
{
return
num; }
45
}
46
47
#endif // CO_ARRAY_H
co::Array::num
const size_t num
The number of elements in the data.
Definition:
array.h:39
co::Array
A wrapper to (de)serialize arrays.
Definition:
array.h:28
co::Array::Array
Array(T *data_, const size_t num_)
Create a new array wrapper for the given data.
Definition:
array.h:32
co::Array::getNumBytes
size_t getNumBytes() const
Definition:
array.h:36
co::Array::data
T *const data
The data.
Definition:
array.h:38
Generated on Thu Dec 5 2013 12:02:22 for Collage by
1.8.5