1 /*------------------------------------------------------------------------------
2 Name: NodeId.h
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Holds the unique name of a cluster node
6 ------------------------------------------------------------------------------*/
7
8
9 /**
10 * Holds the unique name of an xmlBlaster server instance (= cluster node)
11 * @author xmlBlaster@marcelruff.info
12 * @author laghi@swissinfo.org
13 * @since 0.79e
14 * @url http://www.xmlBlaster.org/xmlBlaster/doc/requirements/cluster.html
15 */
16
17 #ifndef _UTIL_CLUSTER_NODEID_H
18 #define _UTIL_CLUSTER_NODEID_H
19
20 #include <util/xmlBlasterDef.h>
21 #include <string>
22 #include <util/I_Log.h>
23
24 namespace org { namespace xmlBlaster { namespace util { namespace cluster {
25
26 class Dll_Export NodeId
27 {
28 private:
29 const std::string ME;
30 std::string id_;
31 org::xmlBlaster::util::Global& global_;
32 org::xmlBlaster::util::I_Log& log_;
33
34 public:
35 NodeId(org::xmlBlaster::util::Global& global, const std::string& id);
36
37 NodeId(const NodeId& nodeId);
38
39 NodeId& operator =(const NodeId& nodeId);
40
41 std::string getId() const;
42
43 /**
44 * @param id The cluster node id, e.g. "heron".<br />
45 * If you pass "/node/heron/client/joe" everything ins stripped to get "heron"
46 */
47 void setId(const std::string& id);
48
49 std::string toString() const;
50
51 /**
52 * Needed for use in TreeSet and TreeMap, enforced by java.lang.Comparable
53 */
54 bool operator <(const NodeId& nodeId) const;
55
56 bool operator ==(const NodeId& nodeId) const;
57
58 };
59
60 }}}} // namespace
61
62 #endif
syntax highlighted by Code2HTML, v. 0.9.1