Last change
on this file since 10767 was 10700, checked in by Michael Tänzer, 12 years ago |
Merge CMake branch into trunk
|
File size:
985 bytes
|
Line | |
---|
1 | #include "DhtMessage.h"
|
---|
2 |
|
---|
3 | #include<boost/foreach.hpp>
|
---|
4 |
|
---|
5 | namespace ariba_service {
|
---|
6 | namespace dht {
|
---|
7 |
|
---|
8 | vsznDefault(DhtMessage);
|
---|
9 |
|
---|
10 | DhtMessage::DhtMessage() :
|
---|
11 | ttl( 0 ),
|
---|
12 | replace( false )
|
---|
13 | {}
|
---|
14 |
|
---|
15 | DhtMessage::DhtMessage( DhtMessageType type, const std::string& key ) :
|
---|
16 | type( static_cast<uint8_t>(type) ),
|
---|
17 | ttl( 0 ),
|
---|
18 | replace( false ),
|
---|
19 | key( key )
|
---|
20 | {}
|
---|
21 |
|
---|
22 | DhtMessage::DhtMessage( DhtMessageType type, const std::string& key,
|
---|
23 | const std::string& value, uint16_t ttl ) :
|
---|
24 | type( static_cast<uint8_t>(type) ),
|
---|
25 | ttl( ttl ),
|
---|
26 | replace( false ),
|
---|
27 | key( key ),
|
---|
28 | values(1, value)
|
---|
29 | {}
|
---|
30 |
|
---|
31 | DhtMessage::DhtMessage( DhtMessageType type, const std::string& key,
|
---|
32 | const vector<string>& values, uint16_t ttl ) :
|
---|
33 | type( static_cast<uint8_t>(type) ),
|
---|
34 | ttl( ttl ),
|
---|
35 | replace( false ),
|
---|
36 | key( key )
|
---|
37 | {
|
---|
38 | // preallocate enough room so we don't need to copy a lot
|
---|
39 | this->values.reserve(values.size());
|
---|
40 | BOOST_FOREACH(const std::string value, values )
|
---|
41 | this->values.push_back( value );
|
---|
42 | }
|
---|
43 |
|
---|
44 | DhtMessage::~DhtMessage() {
|
---|
45 | // empty
|
---|
46 | }
|
---|
47 |
|
---|
48 | }}
|
---|
Note:
See
TracBrowser
for help on using the repository browser.