Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -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 | |
| 23 | #ifndef SYNC_STD_NAME_INFO_H |
| 24 | #define SYNC_STD_NAME_INFO_H |
| 25 | |
| 26 | #include "sync-name-info.h" |
| 27 | #include <string> |
| 28 | |
| 29 | namespace Sync { |
| 30 | |
| 31 | class StdNameInfo : public NameInfo |
| 32 | { |
| 33 | public: |
| 34 | /** |
| 35 | * @brief Lookup existing or create new NameInfo object |
| 36 | * @param name routable prefix |
| 37 | */ |
| 38 | static NameInfoConstPtr |
| 39 | FindOrCreate (const std::string &name); |
| 40 | |
| 41 | virtual ~StdNameInfo () { }; |
| 42 | |
| 43 | // from NameInfo |
| 44 | virtual bool |
| 45 | operator == (const NameInfo &info) const; |
| 46 | |
Alexander Afanasyev | a562532 | 2012-03-06 00:03:41 -0800 | [diff] [blame] | 47 | virtual bool |
| 48 | operator < (const NameInfo &info) const; |
| 49 | |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 50 | virtual std::string |
| 51 | toString () const; |
| 52 | |
| 53 | private: |
| 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 | */ |
| 62 | StdNameInfo () {} |
| 63 | StdNameInfo& operator = (const StdNameInfo &info) { return *this; } |
| 64 | StdNameInfo (const std::string &name); |
| 65 | |
| 66 | std::string m_name; |
| 67 | }; |
| 68 | |
| 69 | } // Sync |
| 70 | |
| 71 | #endif // SYNC_CCNX_NAME_INFO_H |