bug+codestyle: Fix compile bugs and adjust code style
Change-Id: I008bb538441c099fa25b8b967fbf23ffce13a220
diff --git a/src/trust-tree-node.hpp b/src/trust-tree-node.hpp
new file mode 100644
index 0000000..2fe455a
--- /dev/null
+++ b/src/trust-tree-node.hpp
@@ -0,0 +1,116 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef CHRONOS_TRUST_TREE_NODE_HPP
+#define CHRONOS_TRUST_TREE_NODE_HPP
+
+#include "common.hpp"
+
+namespace chronos {
+
+class TrustTreeNode;
+
+typedef std::vector<shared_ptr<TrustTreeNode> > TrustTreeNodeList;
+
+class TrustTreeNode
+{
+public:
+ TrustTreeNode()
+ : m_level(-1)
+ , m_visited(false)
+ {
+ }
+
+ TrustTreeNode(const Name& name)
+ : m_name(name)
+ , m_level(-1)
+ , m_visited(false)
+ {
+ }
+
+ ~TrustTreeNode()
+ {
+ }
+
+ const Name&
+ name()
+ {
+ return m_name;
+ }
+
+ void
+ addIntroducee(const shared_ptr<TrustTreeNode>& introducee)
+ {
+ m_introducees.push_back(introducee);
+ }
+
+ TrustTreeNodeList&
+ getIntroducees()
+ {
+ return m_introducees;
+ }
+
+ void
+ addIntroducer(const shared_ptr<TrustTreeNode>& introducer)
+ {
+ m_introducers.push_back(introducer);
+ }
+
+ TrustTreeNodeList&
+ getIntroducers()
+ {
+ return m_introducers;
+ }
+
+ void
+ setLevel(int level)
+ {
+ m_level = level;
+ }
+
+ int
+ level()
+ {
+ return m_level;
+ }
+
+ void
+ setVisited()
+ {
+ m_visited = true;
+ }
+
+ void
+ resetVisited()
+ {
+ m_visited = false;
+ }
+
+ bool
+ visited()
+ {
+ return m_visited;
+ }
+
+public:
+ double x;
+ double y;
+
+private:
+ Name m_name;
+ TrustTreeNodeList m_introducees;
+ TrustTreeNodeList m_introducers;
+ int m_level;
+ bool m_visited;
+};
+
+} // namespace chronos
+
+#endif // CHRONOS_TRUST_TREE_NODE_HPP