1 /*------------------------------------------------------------------------------
 2 Name:      RouteInfo.h
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 ------------------------------------------------------------------------------*/
 6 #ifndef _UTIL_CLUSTER_ROUTEINFO_H
 7 #define _UTIL_CLUSTER_ROUTEINFO_H
 8 
 9 #include <util/xmlBlasterDef.h>
10 #include <util/cluster/NodeId.h>
11 #include <string>
12 
13 namespace org { namespace xmlBlaster { namespace util { namespace cluster {
14 
15 /**
16  * This class holds the information about a route node which the message passed. 
17  * @author xmlBlaster@marcelruff.info
18  * @author laghi@swissinfo.org
19  */
20 class Dll_Export RouteInfo
21 {
22 private:
23    org::xmlBlaster::util::cluster::NodeId    nodeId_;
24    int       stratum_;
25    Timestamp timestamp_;
26    bool      dirtyRead_;
27 
28 public:
29 
30    RouteInfo(org::xmlBlaster::util::Global& global);
31 
32    /**
33     * @param nodeId The unique name of the xmlBlaster instance
34     * @param stratum The distance from the node to the master node, if you don't know
35     *                it set it to 0.
36     * @param timestamp The receive timestamp of the message (nano seconds)
37     */
38    RouteInfo(const org::xmlBlaster::util::cluster::NodeId& nodeId, int stratum, Timestamp timestamp);
39 
40    /**
41     * The unique node name of the xmlBlaster instance. 
42     */
43    void setNodeId(const org::xmlBlaster::util::cluster::NodeId& nodeId);
44 
45    /**
46     * The unique node name of the xmlBlaster instance. 
47     */
48    org::xmlBlaster::util::cluster::NodeId getNodeId() const;
49 
50    /**
51     * The unique node name of the xmlBlaster instance. 
52     * @param The std::string representation of my name
53     */
54    std::string getId() const;
55 
56    /**
57     * The distance from the current xmlBlaster node from the
58     * master node (for this message). 
59     */
60    void setStratum(int stratum);
61 
62    /**
63     * The distance from the current xmlBlaster node from the
64     * master node (for this message). 
65     */
66    int getStratum() const;
67 
68    /**
69     * Message receive timestamp in nano seconds
70     */
71    void setTimestamp(Timestamp timestamp);
72 
73    /**
74     * Message receive timestamp in nano seconds
75     */
76    Timestamp getTimestamp() const;
77 
78    /**
79     * @param dirtyRead true if cluster slaves cache forwarded publish messages
80     * @see <a href="http://www.xmlBlaster.org/xmlBlaster/doc/requirements/cluster.dirtyRead.html">The cluster.dirtyRead requirement</a>
81     */
82    void setDirtyRead(bool dirtyRead);
83 
84    bool getDirtyRead() const;
85 
86    /**
87     * Dump state of this object into a XML ASCII std::string. 
88     * @param extraOffset indenting of tags for nice output
89     */
90    std::string toXml(const std::string& extraOffset="") const;
91 };
92 
93 }}}}
94 
95 #endif


syntax highlighted by Code2HTML, v. 0.9.1