Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame^] | 3 | * Copyright (c) 2012-2014 University of California, Los Angeles |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame^] | 5 | * This file is part of ChronoSync, synchronization library for distributed realtime |
| 6 | * applications for NDN. |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame^] | 8 | * ChronoSync is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, either |
| 10 | * version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame^] | 12 | * ChronoSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 8722d87 | 2014-07-02 13:00:29 -0700 | [diff] [blame^] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ChronoSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | * |
| 19 | * @author Zhenkai Zhu <http://irl.cs.ucla.edu/~zhenkai/> |
| 20 | * @author Chaoyi Bian <bcy@pku.edu.cn> |
| 21 | * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html> |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 22 | */ |
| 23 | |
| 24 | #ifndef SYNC_STD_NAME_INFO_H |
| 25 | #define SYNC_STD_NAME_INFO_H |
| 26 | |
| 27 | #include "sync-name-info.h" |
| 28 | #include <string> |
| 29 | |
| 30 | namespace Sync { |
| 31 | |
| 32 | class StdNameInfo : public NameInfo |
| 33 | { |
| 34 | public: |
| 35 | /** |
| 36 | * @brief Lookup existing or create new NameInfo object |
| 37 | * @param name routable prefix |
| 38 | */ |
| 39 | static NameInfoConstPtr |
| 40 | FindOrCreate (const std::string &name); |
| 41 | |
Alexander Afanasyev | a4ce9cf | 2012-03-06 14:29:58 -0800 | [diff] [blame] | 42 | /** |
| 43 | * @brief Destructor which will clean up m_names structure |
| 44 | */ |
| 45 | virtual ~StdNameInfo (); |
Yingdi Yu | 7c64e5c | 2014-04-30 14:06:37 -0700 | [diff] [blame] | 46 | |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 47 | // from NameInfo |
| 48 | virtual bool |
| 49 | operator == (const NameInfo &info) const; |
| 50 | |
Alexander Afanasyev | a562532 | 2012-03-06 00:03:41 -0800 | [diff] [blame] | 51 | virtual bool |
| 52 | operator < (const NameInfo &info) const; |
| 53 | |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 54 | virtual std::string |
| 55 | toString () const; |
| 56 | |
| 57 | private: |
Yingdi Yu | 7c64e5c | 2014-04-30 14:06:37 -0700 | [diff] [blame] | 58 | // implementing a singleton pattern. |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 59 | /** |
| 60 | * @brief Disabled default constructor. NameInfo object should be created through FindOrCreate static call. |
| 61 | */ |
| 62 | |
| 63 | /** |
| 64 | * @brief Disabled default |
| 65 | */ |
| 66 | StdNameInfo () {} |
Chaoyi Bian | b119028 | 2012-06-13 17:15:07 -0700 | [diff] [blame] | 67 | StdNameInfo& operator = (const StdNameInfo &info) { (void)info; return *this; } |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 68 | StdNameInfo (const std::string &name); |
Yingdi Yu | 7c64e5c | 2014-04-30 14:06:37 -0700 | [diff] [blame] | 69 | |
Alexander Afanasyev | 2fc2d67 | 2012-03-05 16:57:39 -0800 | [diff] [blame] | 70 | std::string m_name; |
| 71 | }; |
| 72 | |
| 73 | } // Sync |
| 74 | |
| 75 | #endif // SYNC_CCNX_NAME_INFO_H |