blob: 8c124f8a0c65c87076805f81617fa3fc0e9b1e1c [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -07002/*
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#ifndef _NDN_NAME_COMPONENTS_H_
22#define _NDN_NAME_COMPONENTS_H_
23
Alexander Afanasyev2536e202011-08-12 14:13:10 -070024#include "ns3/simple-ref-count.h"
25
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070026#include <string>
27#include <list>
28
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070029namespace ns3 {
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070030namespace Name {
31
32class Components : public SimpleRefCount<Components>
33{
34public:
35 Components ();
36 Components (const std::string &s);
37 ~Components ();
38
39 Components& operator () (const std::string &s);
40
41 // virtual uint32_t
42 // GetSerializedSize (void) const;
43
44 // virtual void
45 // Serialize (Buffer::Iterator start) const;
46
47 // virtual uint32_t
48 // Deserialize (Buffer::Iterator start);
49
50 void Print (std::ostream &os) const;
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070051
52 inline size_t
53 size () const;
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070054
55private:
56 std::list<std::string> m_prefix;
57
58 typedef std::list<std::string>::iterator iterator;
59 typedef std::list<std::string>::const_iterator const_iterator;
60};
61
62std::ostream & operator << (std::ostream &os, const Components &components);
63
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070064size_t
65Components::size () const
66{
67 return m_prefix.size ();
68}
69
70
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070071} // Namespace Name
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070072} // namespace ns3
73
74#endif // _NDN_NAME_COMPONENTS_H_
75