util: ensure concepts.hpp can compile on its own
This commit also adds comments and test cases for concept checks.
refs #2270
Change-Id: Ibc4239adf8980f5b0c0c2d73b6c4b22fb94cbf18
diff --git a/src/util/concepts.hpp b/src/util/concepts.hpp
index 94baeaa..b61c301 100644
--- a/src/util/concepts.hpp
+++ b/src/util/concepts.hpp
@@ -23,9 +23,12 @@
#define NDN_UTIL_CONCEPTS_HPP
#include <boost/concept/usage.hpp>
+#include "../encoding/block.hpp"
namespace ndn {
+/** \brief a concept check for TLV abstraction with .wireEncode method
+ */
template<class X>
class WireEncodable
{
@@ -33,10 +36,14 @@
BOOST_CONCEPT_USAGE(WireEncodable)
{
X j;
- j.wireEncode();
+ Block block = j.wireEncode();
+ block.size(); // avoid 'unused variable block'
}
};
+/** \brief a concept check for TLV abstraction with .wireDecode method
+ * and constructible from Block
+ */
template<class X>
class WireDecodable
{
@@ -49,6 +56,8 @@
}
};
+/** \brief a concept check for CryptoPP hash algorithm
+ */
template<class X>
class Hashable
{