IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
TrackingBlock.h
Go to the documentation of this file.
1
/*
2
* TrackingBlock.h
3
*
4
* Created on: 15.01.2013
5
* Author: morgenro
6
*/
7
8
#ifndef TRACKINGBLOCK_H_
9
#define TRACKINGBLOCK_H_
10
11
#include <
ibrdtn/data/Block.h
>
12
#include <
ibrdtn/data/Number.h
>
13
#include <
ibrdtn/data/DTNTime.h
>
14
#include <
ibrdtn/data/ExtensionBlock.h
>
15
16
namespace
dtn
17
{
18
namespace
data
19
{
20
class
TrackingBlock
:
public
dtn::data::Block
21
{
22
public
:
23
class
Factory
:
public
dtn::data::ExtensionBlock::Factory
24
{
25
public
:
26
Factory
() : dtn::data::
ExtensionBlock
::
Factory
(
TrackingBlock
::
BLOCK_TYPE
) {};
27
virtual
~Factory
() {};
28
virtual
dtn::data::Block
*
create
();
29
};
30
31
static
const
dtn::data::block_t
BLOCK_TYPE
;
32
33
TrackingBlock
();
34
virtual
~TrackingBlock
();
35
36
virtual
Length
getLength
()
const
;
37
virtual
std::ostream &
serialize
(std::ostream &stream,
Length
&length)
const
;
38
virtual
std::istream &
deserialize
(std::istream &stream,
const
Length
&length);
39
40
virtual
std::ostream &
serialize_strict
(std::ostream &stream,
Length
&length)
const
;
41
virtual
Length
getLength_strict
()
const
;
42
43
class
TrackingEntry
44
{
45
public
:
46
enum
Flags
47
{
48
TIMESTAMP_PRESENT
= 1,
49
GEODATA_PRESENT
= 2
50
};
51
52
TrackingEntry
();
53
TrackingEntry
(
const
dtn::data::EID
&eid);
54
~TrackingEntry
();
55
56
bool
getFlag
(
Flags
f)
const
;
57
void
setFlag
(
Flags
f,
bool
value);
58
59
Bitset<Flags>
flags
;
60
dtn::data::EID
endpoint
;
61
dtn::data::DTNTime
timestamp
;
62
63
friend
std::ostream&
operator<<
(std::ostream &stream,
const
TrackingEntry
&entry);
64
friend
std::istream&
operator>>
(std::istream &stream,
TrackingEntry
&entry);
65
66
Length
getLength
()
const
;
67
};
68
69
typedef
std::list<TrackingEntry>
tracking_list
;
70
71
const
tracking_list
&
getTrack
()
const
;
72
73
void
append
(
const
dtn::data::EID
&eid);
74
75
private
:
76
tracking_list
_entries;
77
};
78
82
static
TrackingBlock::Factory
__TrackingBlockFactory__;
83
}
/* namespace data */
84
}
/* namespace dtn */
85
#endif
/* TRACKINGBLOCK_H_ */
ibrdtn
ibrdtn
data
TrackingBlock.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4