Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2012 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: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 19 | * 卞超轶 Chaoyi Bian <bcy@pku.edu.cn> |
| 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 21 | */ |
| 22 | |
Alexander Afanasyev | 146a51b | 2012-03-05 10:47:35 -0800 | [diff] [blame] | 23 | #ifndef STANDALONE |
| 24 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 25 | #ifndef SYNC_CCNX_NAME_INFO_H |
| 26 | #define SYNC_CCNX_NAME_INFO_H |
| 27 | |
| 28 | #include "sync-name-info.h" |
| 29 | #include "ns3/ptr.h" |
Alexander Afanasyev | 017784c | 2012-03-02 11:44:13 -0800 | [diff] [blame] | 30 | #include "ns3/ccnx-name-components.h" |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 31 | |
| 32 | namespace Sync { |
| 33 | |
Alexander Afanasyev | de505f2 | 2012-03-02 11:45:45 -0800 | [diff] [blame] | 34 | class Ns3NameInfo : public NameInfo |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 35 | { |
| 36 | public: |
| 37 | /** |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 38 | * @brief Lookup existing or create new NameInfo object |
| 39 | * @param name routable prefix |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 40 | */ |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 41 | static NameInfoConstPtr |
Alexander Afanasyev | 017784c | 2012-03-02 11:44:13 -0800 | [diff] [blame] | 42 | FindOrCreate (ns3::Ptr<const ns3::CcnxNameComponents> name); |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 43 | |
Alexander Afanasyev | de505f2 | 2012-03-02 11:45:45 -0800 | [diff] [blame] | 44 | virtual ~Ns3NameInfo () { }; |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 45 | |
| 46 | // from NameInfo |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 47 | virtual bool |
| 48 | operator == (const NameInfo &info) const; |
| 49 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 50 | virtual std::string |
| 51 | toString () const; |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 52 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 53 | private: |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 54 | // implementing a singleton pattern. |
| 55 | /** |
| 56 | * @brief Disabled default constructor. NameInfo object should be created through FindOrCreate static call. |
| 57 | */ |
| 58 | |
| 59 | /** |
| 60 | * @brief Disabled default |
| 61 | */ |
Alexander Afanasyev | de505f2 | 2012-03-02 11:45:45 -0800 | [diff] [blame] | 62 | Ns3NameInfo () {} |
| 63 | Ns3NameInfo& operator = (const Ns3NameInfo &info) { return *this; } |
| 64 | Ns3NameInfo (ns3::Ptr<const ns3::CcnxNameComponents> name); |
Alexander Afanasyev | b5547e3 | 2012-03-01 21:59:38 -0800 | [diff] [blame] | 65 | |
Alexander Afanasyev | 017784c | 2012-03-02 11:44:13 -0800 | [diff] [blame] | 66 | ns3::Ptr<const ns3::CcnxNameComponents> m_name; |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 67 | }; |
| 68 | |
Alexander Afanasyev | e00ffbe | 2012-03-05 00:01:36 -0800 | [diff] [blame] | 69 | Digest & |
| 70 | operator << (Digest &, const ns3::CcnxNameComponents &name); |
| 71 | |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 72 | } // Sync |
Alexander Afanasyev | 7a696fb | 2012-03-01 17:17:22 -0800 | [diff] [blame] | 73 | |
| 74 | #endif // SYNC_CCNX_NAME_INFO_H |
Alexander Afanasyev | 146a51b | 2012-03-05 10:47:35 -0800 | [diff] [blame] | 75 | |
| 76 | #endif // STANDALONE |