akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [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> |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame^] | 20 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [diff] [blame] | 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 | /** |
| 42 | * @brief Destructor which will clean up m_names structure |
| 43 | */ |
| 44 | virtual ~StdNameInfo (); |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame^] | 45 | |
akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [diff] [blame] | 46 | // from NameInfo |
| 47 | virtual bool |
| 48 | operator == (const NameInfo &info) const; |
| 49 | |
| 50 | virtual bool |
| 51 | operator < (const NameInfo &info) const; |
| 52 | |
| 53 | virtual std::string |
| 54 | toString () const; |
| 55 | |
| 56 | private: |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame^] | 57 | // implementing a singleton pattern. |
akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [diff] [blame] | 58 | /** |
| 59 | * @brief Disabled default constructor. NameInfo object should be created through FindOrCreate static call. |
| 60 | */ |
| 61 | |
| 62 | /** |
| 63 | * @brief Disabled default |
| 64 | */ |
| 65 | StdNameInfo () {} |
| 66 | StdNameInfo& operator = (const StdNameInfo &info) { (void)info; return *this; } |
| 67 | StdNameInfo (const std::string &name); |
Vince Lehman | 0a7da61 | 2014-10-29 14:39:29 -0500 | [diff] [blame^] | 68 | |
akmhoque | 66e6618 | 2014-02-21 17:56:03 -0600 | [diff] [blame] | 69 | std::string m_name; |
| 70 | }; |
| 71 | |
| 72 | } // Sync |
| 73 | |
| 74 | #endif // SYNC_CCNX_NAME_INFO_H |