blob: 2385074a1c8133dbafa9041408d7f42eb98eaa73 [file] [log] [blame]
akmhoque66e66182014-02-21 17:56:03 -06001/* -*- 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 Lehman0a7da612014-10-29 14:39:29 -050020 * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
akmhoque66e66182014-02-21 17:56:03 -060021 */
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
29namespace Sync {
30
31class StdNameInfo : public NameInfo
32{
33public:
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 Lehman0a7da612014-10-29 14:39:29 -050045
akmhoque66e66182014-02-21 17:56:03 -060046 // 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
56private:
Vince Lehman0a7da612014-10-29 14:39:29 -050057 // implementing a singleton pattern.
akmhoque66e66182014-02-21 17:56:03 -060058 /**
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 Lehman0a7da612014-10-29 14:39:29 -050068
akmhoque66e66182014-02-21 17:56:03 -060069 std::string m_name;
70};
71
72} // Sync
73
74#endif // SYNC_CCNX_NAME_INFO_H