blob: 319151fe4a29589ef410effd31914c1522d8d307 [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 {
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070031namespace Name {
32
33Components::Components ()
34{
35 // m_value = ccn_charbuf_create ();
36 // ccn_name_init(m_value);
37}
38
39Components::Components (const string &s)
40{
41 // m_value = ccn_charbuf_create ();
42 // ccn_name_init(m_value);
43 // (*this) (s);
44 m_prefix.push_back (s);
45}
46
47Components::~Components ()
48{
49 // ccn_charbuf_destroy(&m_value);
50}
51
52// const ccn_charbuf*
53// Components::GetName () const
54// {
55// return m_value;
56// }
57
58Components&
59Components::operator () (const string &s)
60{
61 // ccn_name_append_str (m_value,s.c_str());
62 m_prefix.push_back (s);
63 return *this;
64}
65
66// Components::operator const unsigned char* ()
67// {
68// return m_value->buf;
69// }
70
71void
72Components::Print (std::ostream &os) const
73{
74 for (const_iterator i=m_prefix.begin(); i!=m_prefix.end(); i++)
75 {
76 os << "/" << *i;
77 }
78}
79
80std::ostream &
81operator << (std::ostream &os, const Components &components)
82{
83 components.Print (os);
84 return os;
85}
86
87}
88}
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070089