blob: 0978b7f2790bff5aad58115a3fbe60cd5d14383e [file] [log] [blame]
Alexander Afanasyev2fc2d672012-03-05 16:57:39 -08001/* -*- 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>
Chaoyi Bian3e1eb162012-04-03 16:59:32 -070019 * Chaoyi Bian <bcy@pku.edu.cn>
Alexander Afanasyev2fc2d672012-03-05 16:57:39 -080020 * 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
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
Alexander Afanasyeva4ce9cf2012-03-06 14:29:58 -080041 /**
42 * @brief Destructor which will clean up m_names structure
43 */
44 virtual ~StdNameInfo ();
Alexander Afanasyev2fc2d672012-03-05 16:57:39 -080045
46 // from NameInfo
47 virtual bool
48 operator == (const NameInfo &info) const;
49
Alexander Afanasyeva5625322012-03-06 00:03:41 -080050 virtual bool
51 operator < (const NameInfo &info) const;
52
Alexander Afanasyev2fc2d672012-03-05 16:57:39 -080053 virtual std::string
54 toString () const;
55
56private:
57 // implementing a singleton pattern.
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) { return *this; }
67 StdNameInfo (const std::string &name);
68
69 std::string m_name;
70};
71
72} // Sync
73
74#endif // SYNC_CCNX_NAME_INFO_H