blob: 78b3b9d0680d0bfc60ee27c1d1a390315f5f0112 [file] [log] [blame]
Jeff Thompson25b4e612013-10-10 16:03:24 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Jeff Thompson47eecfc2013-07-07 22:56:46 -07002/**
Jeff Thompson7687dc02013-09-13 11:54:07 -07003 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
Jeff Thompsonec39fbd2013-10-04 10:56:23 -07005 * @author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
6 * @author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
Jeff Thompson47eecfc2013-07-07 22:56:46 -07007 * See COPYING for copyright and distribution information.
Jeff Thompson9c41dfe2013-06-27 12:10:25 -07008 */
9
10#ifndef NDN_NAME_HPP
Jeff Thompson2d27e2f2013-08-09 12:55:00 -070011#define NDN_NAME_HPP
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070012
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080013#include "common.hpp"
14#include "name-component.hpp"
15
Alexander Afanasyevaf283d82014-01-03 13:23:34 -080016#include "encoding/block.hpp"
Wentao Shang77949212014-02-01 23:42:24 -080017#include "encoding/encoding-buffer.hpp"
Jeff Thompson25b4e612013-10-10 16:03:24 -070018
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080019#include <boost/iterator/reverse_iterator.hpp>
20
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070021namespace ndn {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080022
Jeff Thompsonc7d65502013-11-06 17:22:26 -080023/**
24 * A Name holds an array of Name::Component and represents an NDN name.
25 */
Alexander Afanasyevb790d952014-01-24 12:07:53 -080026class Name : public ptr_lib::enable_shared_from_this<Name> {
Jeff Thompson9c41dfe2013-06-27 12:10:25 -070027public:
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080028 /// @brief Error that can be thrown from the block
29 struct Error : public name::Component::Error { Error(const std::string &what) : name::Component::Error(what) {} };
Alexander Afanasyevaf283d82014-01-03 13:23:34 -080030
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080031 typedef name::Component Component;
32
33 typedef std::vector<Component> component_container;
34
35 typedef Component value_type;
36 typedef void allocator_type;
37 typedef Component& reference;
38 typedef const Component const_reference;
39 typedef Component* pointer;
40 typedef const Component* const_pointer;
41 typedef Component* iterator;
42 typedef const Component* const_iterator;
Alexander Afanasyevaf283d82014-01-03 13:23:34 -080043
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080044 typedef boost::reverse_iterator<iterator> reverse_iterator;
45 typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
46
47 typedef component_container::difference_type difference_type;
48 typedef component_container::size_type size_type;
Jeff Thompson5a6b5ab2013-08-05 15:43:47 -070049
Jeff Thompson443398d2013-07-02 19:45:46 -070050 /**
51 * Create a new Name with no components.
52 */
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080053 Name()
54 : m_nameBlock(Tlv::Name)
55 {
Jeff Thompson016ed642013-07-02 14:39:06 -070056 }
Jeff Thompson443398d2013-07-02 19:45:46 -070057
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -080058 // Name(const Block &name)
59 // {
60 // for (Block::element_const_iterator i = name.getAll().begin();
61 // i != name.getAll().end();
62 // ++i)
63 // {
64 // append(Component(i->value_begin(), i->value_end()));
65 // }
66 // }
Jeff Thompson3f2175b2013-07-31 17:12:47 -070067
68 /**
Jeff Thompson443398d2013-07-02 19:45:46 -070069 * Parse the uri according to the NDN URI Scheme and create the name with the components.
Jeff Thompson3f2175b2013-07-31 17:12:47 -070070 * @param uri The URI string.
Jeff Thompson443398d2013-07-02 19:45:46 -070071 */
Jeff Thompson3549ef32013-09-25 14:05:17 -070072 Name(const char* uri)
Jeff Thompson67515bd2013-08-15 17:43:22 -070073 {
74 set(uri);
75 }
Jeff Thompson5a6b5ab2013-08-05 15:43:47 -070076
Jeff Thompsone5f839b2013-06-28 12:50:38 -070077 /**
Jeff Thompson3549ef32013-09-25 14:05:17 -070078 * Parse the uri according to the NDN URI Scheme and create the name with the components.
79 * @param uri The URI string.
80 */
81 Name(const std::string& uri)
82 {
83 set(uri.c_str());
84 }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -070085
Wentao Shang77949212014-02-01 23:42:24 -080086 size_t
87 wireEncode (EncodingBuffer& blk);
88
Alexander Afanasyevaf283d82014-01-03 13:23:34 -080089 const Block &
90 wireEncode() const;
Alexander Afanasyev848c61a2014-01-03 13:52:04 -080091
92 void
93 wireDecode(const Block &wire);
Jeff Thompsonb468c312013-07-01 17:50:14 -070094
95 /**
Jeff Thompson67515bd2013-08-15 17:43:22 -070096 * Parse the uri according to the NDN URI Scheme and set the name with the components.
Jeff Thompson7781b392013-12-17 11:45:59 -080097 * @param uri The null-terminated URI string.
Jeff Thompson67515bd2013-08-15 17:43:22 -070098 */
Jeff Thompson0050abe2013-09-17 12:50:25 -070099 void
100 set(const char *uri);
Jeff Thompson67515bd2013-08-15 17:43:22 -0700101
102 /**
Jeff Thompson7781b392013-12-17 11:45:59 -0800103 * Parse the uri according to the NDN URI Scheme and set the name with the components.
104 * @param uri The URI string.
105 */
106 void
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800107 set(const std::string& uri)
108 {
109 set(uri.c_str());
110 }
Jeff Thompson7781b392013-12-17 11:45:59 -0800111
112 /**
Jeff Thompson0aa66f22013-09-23 13:02:13 -0700113 * Append a new component, copying from value of length valueLength.
Jeff Thompson26b0d792013-09-23 16:19:01 -0700114 * @return This name so that you can chain calls to append.
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700115 */
Jeff Thompson26b0d792013-09-23 16:19:01 -0700116 Name&
Jeff Thompson97223af2013-09-24 17:01:27 -0700117 append(const uint8_t *value, size_t valueLength)
Jeff Thompson0f743452013-09-12 14:23:18 -0700118 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800119 m_nameBlock.elements().push_back(Component(value, valueLength));
Jeff Thompson26b0d792013-09-23 16:19:01 -0700120 return *this;
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700121 }
Jeff Thompsonf72b1ac2013-08-16 16:44:41 -0700122
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800123 // /**
124 // * Append a new component, copying from value.
125 // * @return This name so that you can chain calls to append.
126 // */
127 // Name&
128 // append(const Buffer& value)
129 // {
130 // m_nameBlock.elements().push_back(value);
131 // return *this;
132 // }
Jeff Thompson0f743452013-09-12 14:23:18 -0700133
Jeff Thompson26b0d792013-09-23 16:19:01 -0700134 Name&
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800135 append(const ConstBufferPtr &value)
Jeff Thompson0f743452013-09-12 14:23:18 -0700136 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800137 m_nameBlock.elements().push_back(value);
Jeff Thompson26b0d792013-09-23 16:19:01 -0700138 return *this;
Jeff Thompsonf72b1ac2013-08-16 16:44:41 -0700139 }
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700140
Jeff Thompson21eb7212013-09-26 09:05:40 -0700141 Name&
142 append(const Component &value)
143 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800144 m_nameBlock.elements().push_back(value);
Jeff Thompson21eb7212013-09-26 09:05:40 -0700145 return *this;
146 }
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800147
Alexander Afanasyev594cdb22014-01-03 15:11:33 -0800148 /**
149 * @brief Append name component that represented as a string
150 *
151 * Note that this method is necessary to ensure correctness and unambiguity of
152 * ``append("string")`` operations (both Component and Name can be implicitly
153 * converted from string, each having different outcomes
154 */
155 Name&
156 append(const char *value)
157 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800158 m_nameBlock.elements().push_back(Component(value));
Alexander Afanasyev594cdb22014-01-03 15:11:33 -0800159 return *this;
160 }
161
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800162 Name&
163 append(const Block &value)
164 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800165 m_nameBlock.elements().push_back(Component(value.begin(), value.end()));
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800166 return *this;
167 }
Jeff Thompson21eb7212013-09-26 09:05:40 -0700168
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700169 /**
Jeff Thompson26b0d792013-09-23 16:19:01 -0700170 * Append the components of the given name to this name.
171 * @param name The Name with components to append.
172 * @return This name so that you can chain calls to append.
Jeff Thompson0aa66f22013-09-23 13:02:13 -0700173 */
Jeff Thompson26b0d792013-09-23 16:19:01 -0700174 Name&
175 append(const Name& name);
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800176
Jeff Thompson0aa66f22013-09-23 13:02:13 -0700177 /**
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700178 * Clear all the components.
179 */
Jeff Thompson0050abe2013-09-17 12:50:25 -0700180 void
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800181 clear()
182 {
183 m_nameBlock = Block(Tlv::Name);
Jeff Thompsone5f839b2013-06-28 12:50:38 -0700184 }
185
186 /**
Jeff Thompsond0159d72013-09-23 13:34:15 -0700187 * Get a new name, constructed as a subset of components.
188 * @param iStartComponent The index if the first component to get.
189 * @param nComponents The number of components starting at iStartComponent.
190 * @return A new name.
191 */
192 Name
193 getSubName(size_t iStartComponent, size_t nComponents) const;
194
195 /**
196 * Get a new name, constructed as a subset of components starting at iStartComponent until the end of the name.
197 * @param iStartComponent The index if the first component to get.
198 * @return A new name.
199 */
200 Name
201 getSubName(size_t iStartComponent) const;
202
203 /**
204 * Return a new Name with the first nComponents components of this Name.
Jeff Thompsoneb0358f2013-12-17 10:59:53 -0800205 * @param nComponents The number of prefix components. If nComponents is -N then return the prefix up
206 * to name.size() - N. For example getPrefix(-1) returns the name without the final component.
Jeff Thompsond0159d72013-09-23 13:34:15 -0700207 * @return A new Name.
208 */
209 Name
Jeff Thompsoneb0358f2013-12-17 10:59:53 -0800210 getPrefix(int nComponents) const
Jeff Thompsond0159d72013-09-23 13:34:15 -0700211 {
Jeff Thompsoneb0358f2013-12-17 10:59:53 -0800212 if (nComponents < 0)
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800213 return getSubName(0, m_nameBlock.elements().size() + nComponents);
Jeff Thompsoneb0358f2013-12-17 10:59:53 -0800214 else
215 return getSubName(0, nComponents);
Jeff Thompsond0159d72013-09-23 13:34:15 -0700216 }
217
218 /**
Jeff Thompsone6063512013-07-01 15:11:28 -0700219 * Encode this name as a URI.
Jeff Thompson3f2175b2013-07-31 17:12:47 -0700220 * @return The encoded URI.
Jeff Thompsone6063512013-07-01 15:11:28 -0700221 */
Jeff Thompson0050abe2013-09-17 12:50:25 -0700222 std::string
223 toUri() const;
Jeff Thompsone6063512013-07-01 15:11:28 -0700224
Jeff Thompson21844fc2013-08-08 14:52:51 -0700225 /**
Jeff Thompson8aac1992013-08-12 17:26:02 -0700226 * Append a component with the encoded segment number.
227 * @param segment The segment number.
Jeff Thompson26b0d792013-09-23 16:19:01 -0700228 * @return This name so that you can chain calls to append.
229 */
230 Name&
Jeff Thompsond129ac12013-10-11 14:30:12 -0700231 appendSegment(uint64_t segment)
Jeff Thompson8aac1992013-08-12 17:26:02 -0700232 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800233 m_nameBlock.elements().push_back(Component::fromNumberWithMarker(segment, 0x00));
Jeff Thompsond129ac12013-10-11 14:30:12 -0700234 return *this;
235 }
236
237 /**
238 * Append a component with the encoded version number.
239 * Note that this encodes the exact value of version without converting from a time representation.
240 * @param version The version number.
241 * @return This name so that you can chain calls to append.
242 */
243 Name&
244 appendVersion(uint64_t version)
245 {
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800246 m_nameBlock.elements().push_back(Component::fromNumberWithMarker(version, 0xFD));
Jeff Thompson26b0d792013-09-23 16:19:01 -0700247 return *this;
Jeff Thompson8aac1992013-08-12 17:26:02 -0700248 }
Alexander Afanasyev594cdb22014-01-03 15:11:33 -0800249
250 /**
251 * @brief Append a component with the encoded version number.
252 *
253 * This version of the method creates version number based on the current timestamp
254 * @return This name so that you can chain calls to append.
255 */
256 Name&
257 appendVersion();
Jeff Thompsoncc35cd42013-08-20 12:23:14 -0700258
Jeff Thompsonec7789a2013-08-21 11:08:36 -0700259 /**
Jeff Thompson3c2ab012013-10-02 14:18:16 -0700260 * Check if this name has the same component count and components as the given name.
261 * @param name The Name to check.
262 * @return true if the names are equal, otherwise false.
263 */
264 bool
265 equals(const Name& name) const;
266
267 /**
Jeff Thompsonec7789a2013-08-21 11:08:36 -0700268 * Check if the N components of this name are the same as the first N components of the given name.
269 * @param name The Name to check.
270 * @return true if this matches the given name, otherwise false. This always returns true if this name is empty.
271 */
Jeff Thompson0050abe2013-09-17 12:50:25 -0700272 bool
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800273 isPrefixOf(const Name& name) const;
274
275 bool
276 match(const Name& name) const
277 {
278 return isPrefixOf(name);
279 }
Jeff Thompsonec7789a2013-08-21 11:08:36 -0700280
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700281 //
282 // vector equivalent interface.
283 //
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800284
285 /**
286 * @brief Check if name is emtpy
287 */
288 bool
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800289 empty() const { return m_nameBlock.elements().empty(); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700290
291 /**
292 * Get the number of components.
293 * @return The number of components.
294 */
295 size_t
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800296 size() const { return m_nameBlock.elements().size(); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700297
298 /**
299 * Get the component at the given index.
300 * @param i The index of the component, starting from 0.
301 * @return The name component at the index.
302 */
303 const Component&
Alexander Afanasyev8f9aa8bed2013-12-30 15:58:57 -0800304 get(ssize_t i) const
305 {
306 if (i >= 0)
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800307 return reinterpret_cast<const Component&>(m_nameBlock.elements()[i]);
Alexander Afanasyev8f9aa8bed2013-12-30 15:58:57 -0800308 else
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800309 return reinterpret_cast<const Component&>(m_nameBlock.elements()[size() + i]);
310 }
311
312 const Component&
313 operator [] (ssize_t i) const
314 {
315 return get(i);
Alexander Afanasyev8f9aa8bed2013-12-30 15:58:57 -0800316 }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700317
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800318 const Component&
319 at(ssize_t i) const
320 {
321 return get(i);
322 }
323
Jeff Thompsonafc45a92014-01-15 12:42:45 -0800324 /**
325 * Compare this to the other Name using NDN canonical ordering. If the first components of each name are not equal,
326 * this returns -1 if the first comes before the second using the NDN canonical ordering for name components, or 1 if it comes after.
327 * If they are equal, this compares the second components of each name, etc. If both names are the same up to
328 * the size of the shorter name, this returns -1 if the first name is shorter than the second or 1 if it is longer.
329 * For example, if you std::sort gives: /a/b/d /a/b/cc /c /c/a /bb . This is intuitive because all names
330 * with the prefix /a are next to each other. But it may be also be counter-intuitive because /c comes before /bb
331 * according to NDN canonical ordering since it is shorter.
332 * @param other The other Name to compare with.
333 * @return 0 If they compare equal, -1 if *this comes before other in the canonical ordering, or
334 * 1 if *this comes after other in the canonical ordering.
335 *
336 * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
337 */
338 int
339 compare(const Name& other) const;
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700340
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700341 /**
342 * Append the component
343 * @param component The component of type T.
344 */
345 template<class T> void
346 push_back(const T &component)
347 {
348 append(component);
349 }
350
Jeff Thompson91737f52013-10-04 11:07:24 -0700351 /**
352 * Check if this name has the same component count and components as the given name.
353 * @param name The Name to check.
354 * @return true if the names are equal, otherwise false.
355 */
356 bool
357 operator == (const Name &name) const { return equals(name); }
358
359 /**
360 * Check if this name has the same component count and components as the given name.
361 * @param name The Name to check.
362 * @return true if the names are not equal, otherwise false.
363 */
364 bool
365 operator != (const Name &name) const { return !equals(name); }
Jeff Thompson82568ad2013-12-17 15:17:40 -0800366
367 /**
Jeff Thompsonafc45a92014-01-15 12:42:45 -0800368 * Return true if this is less than or equal to the other Name in the NDN canonical ordering.
369 * @param other The other Name to compare with.
370 *
371 * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
Jeff Thompson82568ad2013-12-17 15:17:40 -0800372 */
Jeff Thompsonafc45a92014-01-15 12:42:45 -0800373 bool
374 operator <= (const Name& other) const { return compare(other) <= 0; }
375
376 /**
377 * Return true if this is less than the other Name in the NDN canonical ordering.
378 * @param other The other Name to compare with.
379 *
380 * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
381 */
382 bool
383 operator < (const Name& other) const { return compare(other) < 0; }
384
385 /**
386 * Return true if this is less than or equal to the other Name in the NDN canonical ordering.
387 * @param other The other Name to compare with.
388 *
389 * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
390 */
391 bool
392 operator >= (const Name& other) const { return compare(other) >= 0; }
393
394 /**
395 * Return true if this is greater than the other Name in the NDN canonical ordering.
396 * @param other The other Name to compare with.
397 *
398 * @see http://named-data.net/doc/0.2/technical/CanonicalOrder.html
399 */
400 bool
401 operator > (const Name& other) const { return compare(other) > 0; }
Jeff Thompson82568ad2013-12-17 15:17:40 -0800402
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700403 //
404 // Iterator interface to name components.
405 //
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700406
407 /**
408 * Begin iterator (const).
409 */
410 const_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800411 begin() const
412 {
413 return reinterpret_cast<const_iterator>(&*m_nameBlock.elements().begin());
414 }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700415
416 /**
417 * Begin iterator.
418 */
419 iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800420 begin() { return reinterpret_cast<iterator>(&*m_nameBlock.elements().begin()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700421
422 /**
423 * End iterator (const).
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800424 *
425 * @todo Check if this crash when there are no elements in the buffer
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700426 */
427 const_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800428 end() const { return reinterpret_cast<const_iterator>(&*m_nameBlock.elements().end()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700429
430 /**
431 * End iterator.
432 */
433 iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800434 end() { return reinterpret_cast<iterator>(&*m_nameBlock.elements().end()); }
435
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700436 /**
437 * Reverse begin iterator (const).
438 */
439 const_reverse_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800440 rbegin() const { return const_reverse_iterator(end()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700441
442 /**
443 * Reverse begin iterator.
444 */
445 reverse_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800446 rbegin() { return reverse_iterator(end()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700447
448 /**
449 * Reverse end iterator (const).
450 */
451 const_reverse_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800452 rend() const { return const_reverse_iterator(begin()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700453
454 /**
455 * Reverse end iterator.
456 */
457 reverse_iterator
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800458 rend() { return reverse_iterator(begin()); }
Jeff Thompsonec39fbd2013-10-04 10:56:23 -0700459
Jeff Thompson9c41dfe2013-06-27 12:10:25 -0700460private:
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800461 mutable Block m_nameBlock;
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800462};
463
464std::ostream &
465operator << (std::ostream &os, const Name &name);
466
467inline std::string
468Name::toUri() const
Jeff Thompson49e321a2013-10-04 17:35:59 -0700469{
Alexander Afanasyevaf283d82014-01-03 13:23:34 -0800470 std::ostringstream os;
471 os << *this;
472 return os.str();
Jeff Thompson49e321a2013-10-04 17:35:59 -0700473}
474
Alexander Afanasyev95e8c2f2014-02-06 17:29:30 -0800475} // namespace ndn
Jeff Thompson9c41dfe2013-06-27 12:10:25 -0700476
477#endif
478