IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
StreamBlock.h
Go to the documentation of this file.
1
/*
2
* StreamBlock.h
3
*
4
* Copyright (C) 2011 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#ifndef STREAMBLOCK_H_
23
#define STREAMBLOCK_H_
24
25
#include "
ibrdtn/data/Number.h
"
26
#include "
ibrdtn/data/Block.h
"
27
#include "
ibrdtn/data/ExtensionBlock.h
"
28
29
namespace
dtn
30
{
31
namespace
data
32
{
33
class
StreamBlock
:
public
dtn::data::Block
34
{
35
public
:
36
class
Factory
:
public
dtn::data::ExtensionBlock::Factory
37
{
38
public
:
39
Factory
() : dtn::data::
ExtensionBlock
::
Factory
(
StreamBlock
::
BLOCK_TYPE
) {};
40
virtual
~Factory
() {};
41
virtual
dtn::data::Block
*
create
();
42
};
43
44
static
const
dtn::data::block_t
BLOCK_TYPE
;
45
46
enum
STREAM_FLAGS
47
{
48
STREAM_BEGIN
= 1,
49
STREAM_END
= 1 << 0x01
50
};
51
52
StreamBlock
();
53
virtual
~StreamBlock
();
54
55
virtual
Length
getLength
()
const
;
56
virtual
std::ostream &
serialize
(std::ostream &stream,
Length
&length)
const
;
57
virtual
std::istream &
deserialize
(std::istream &stream,
const
Length
&length);
58
59
void
setSequenceNumber
(
Number
seq);
60
const
Number
&
getSequenceNumber
()
const
;
61
62
void
set
(
STREAM_FLAGS
flag,
const
bool
&value);
63
bool
get
(
STREAM_FLAGS
flag)
const
;
64
65
private
:
66
Number
_seq;
67
Bitset<STREAM_FLAGS>
_streamflags;
68
};
69
73
static
StreamBlock::Factory __StreamBlockFactory__;
74
}
/* namespace data */
75
}
/* namespace dtn */
76
#endif
/* STREAMBLOCK_H_ */
ibrdtn
ibrdtn
data
StreamBlock.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4