blob: a6aae87a7095932fec2c21ed05b59fe37a87cd17 [file] [log] [blame]
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
19 */
20
21#include "name-components.h"
Alexander Afanasyev2536e202011-08-12 14:13:10 -070022
23#include "ns3/ccn.h"
24#include "ns3/ccn_charbuf.h"
25
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070026#include <iostream>
27
28using namespace std;
29
30namespace ns3 {
31namespace NDNabstraction {
32namespace Name {
33
34Components::Components ()
35{
36 // m_value = ccn_charbuf_create ();
37 // ccn_name_init(m_value);
38}
39
40Components::Components (const string &s)
41{
42 // m_value = ccn_charbuf_create ();
43 // ccn_name_init(m_value);
44 // (*this) (s);
45 m_prefix.push_back (s);
46}
47
48Components::~Components ()
49{
50 // ccn_charbuf_destroy(&m_value);
51}
52
53// const ccn_charbuf*
54// Components::GetName () const
55// {
56// return m_value;
57// }
58
59Components&
60Components::operator () (const string &s)
61{
62 // ccn_name_append_str (m_value,s.c_str());
63 m_prefix.push_back (s);
64 return *this;
65}
66
67// Components::operator const unsigned char* ()
68// {
69// return m_value->buf;
70// }
71
72void
73Components::Print (std::ostream &os) const
74{
75 for (const_iterator i=m_prefix.begin(); i!=m_prefix.end(); i++)
76 {
77 os << "/" << *i;
78 }
79}
80
81std::ostream &
82operator << (std::ostream &os, const Components &components)
83{
84 components.Print (os);
85 return os;
86}
87
88}
89}
90}
91