source: source/services/ariba_dht/messages/DhtMessage.cpp@ 10767

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
5namespace ariba_service {
6namespace dht {
7
8vsznDefault(DhtMessage);
9
10DhtMessage::DhtMessage() :
11 ttl( 0 ),
12 replace( false )
13{}
14
15DhtMessage::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
22DhtMessage::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
31DhtMessage::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
44DhtMessage::~DhtMessage() {
45 // empty
46}
47
48}}
Note: See TracBrowser for help on using the repository browser.