src: Refactoring common.hpp and minimizing exposed includes
Face class has relatively large rewrite to hide internals using
Implementor pattern. As of this commit, <boost/asio.hpp> is not
automatically included whenever ndn-cxx/face.hpp is included. If it is
needed to directly work with io_service, asio.hpp should be specifically
included.
Change-Id: Ie742b851025b4e3da634eb981319df0f42937855
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index d23e8c8..d1a762f 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -12,8 +12,8 @@
* @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
*/
-#ifndef NDN_BLOCK_HPP
-#define NDN_BLOCK_HPP
+#ifndef NDN_ENCODING_BLOCK_HPP
+#define NDN_ENCODING_BLOCK_HPP
#include "../common.hpp"
@@ -83,12 +83,6 @@
Block(const void* buffer, size_t maxlength);
- /*
- * @brief A helper version of a constructor to create Block from the stream.
- */
- explicit
- Block(std::istream& is);
-
/**
* @brief Create Block from the wire buffer (no parsing)
*
@@ -124,6 +118,23 @@
explicit
Block(uint32_t type, const Block& value);
+ /*
+ * @brief A helper version of a constructor to create Block from the stream
+ *
+ * @deprecated Use Block::fromStream instead
+ */
+ explicit
+ Block(std::istream& is)
+ {
+ *this = Block::fromStream(is);
+ }
+
+ /*
+ * @brief A helper version of a constructor to create Block from the stream.
+ */
+ Block
+ fromStream(std::istream& is);
+
/**
* @brief Try to construct block from Buffer, referencing data block pointed by wire
*
@@ -327,23 +338,6 @@
return m_type;
}
-inline const Block&
-Block::get(uint32_t type) const
-{
- for (element_const_iterator i = m_subBlocks.begin();
- i != m_subBlocks.end();
- i++)
- {
- if (i->type() == type)
- {
- return *i;
- }
- }
-
- throw Error("(Block::get) Requested a non-existed type [" +
- boost::lexical_cast<std::string>(type) + "] from Block");
-}
-
inline Block::element_const_iterator
Block::find(uint32_t type) const
{
@@ -504,6 +498,4 @@
} // ndn
-#include "block-helpers.hpp"
-
-#endif // NDN_BLOCK_HPP
+#endif // NDN_ENCODING_BLOCK_HPP