table: mock PIT

refs #1128

Change-Id: I8943ad07d93422dc456fd051b2e4c0d5f38bc227
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
new file mode 100644
index 0000000..97de5e2
--- /dev/null
+++ b/daemon/table/pit-entry.hpp
@@ -0,0 +1,93 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_TABLE_PIT_ENTRY_HPP
+#define NFD_TABLE_PIT_ENTRY_HPP
+
+#include "pit-in-record.hpp"
+#include "pit-out-record.hpp"
+
+namespace ndn {
+namespace pit {
+
+/** \class InRecordCollection
+ *  \brief represents an unordered collection of InRecords
+ */
+typedef std::list< InRecord>  InRecordCollection;
+
+/** \class OutRecordCollection
+ *  \brief represents an unordered collection of OutRecords
+ */
+typedef std::list<OutRecord> OutRecordCollection;
+
+/** \class Entry
+ *  \brief represents a PIT entry
+ */
+class Entry : noncopyable
+{
+public:
+  explicit
+  Entry(const Interest& interest);
+  
+  const Interest&
+  getInterest() const;
+  
+  /** \return{ Interest Name }
+   */
+  const Name&
+  getName() const;
+  
+  const InRecordCollection&
+  getInRecords() const;
+  
+  const OutRecordCollection&
+  getOutRecords() const;
+  
+  /** \brief determines whether nonce is seen before
+   *         in an incoming or outgoing Interest
+   */
+  bool
+  isNonceSeen(uint32_t nonce) const;
+  
+  /** \brief inserts a InRecord for face, and updates it with interest
+   *  If InRecord for face exists, the existing one is updated.
+   *  \return{ an iterator to the InRecord }
+   */
+  InRecordCollection::iterator
+  insertOrUpdateInRecord(shared_ptr<Face> face, const Interest& interest);
+  
+  /// deletes all InRecords
+  void
+  deleteInRecords();
+  
+  /** \brief inserts a OutRecord for face, and updates it with interest
+   *  If OutRecord for face exists, the existing one is updated.
+   *  \return{ an iterator to the OutRecord }
+   */
+  OutRecordCollection::iterator
+  insertOrUpdateOutRecord(shared_ptr<Face> face, const Interest& interest);
+  
+  /// deletes one OutRecord for face if exists
+  void
+  deleteOutRecord(shared_ptr<Face> face);
+
+private:
+  std::set<uint32_t> m_nonces;
+  const Interest m_interest;
+  InRecordCollection m_inRecords;
+  OutRecordCollection m_outRecords;
+};
+
+inline const Interest&
+Entry::getInterest() const
+{
+  return m_interest;
+}
+
+} // namespace pit
+} // namespace ndn
+
+#endif // NFD_TABLE_PIT_ENTRY_HPP