base: ensure Element::Error inherits from tlv::Error
Adding static asserts to ensure (Name|name::Component|Interest|
Selectors|Exclude|KeyLocator|Data|MetaInfo|Signature|SignatureInfo)
::Error are subclasses of tlv::Error.
This commit also adds WireEncodable and WireDecodable concept checks
to Name,name::Component,Interest,Selectors,Exclude,KeyLocator,Data,
MetaInfo,SignatureInfo types.
This commit also moves definition of Selectors method into .cpp.
refs #1983
Change-Id: I15220b93437d4a624ae09df66defc91ceac2386c
diff --git a/src/interest.cpp b/src/interest.cpp
index 3d3d40b..eb80c4b 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -24,10 +24,17 @@
#include "interest.hpp"
#include "util/random.hpp"
#include "util/crypto.hpp"
+#include "util/concepts.hpp"
#include "data.hpp"
namespace ndn {
+BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Interest>));
+BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
+BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
+static_assert(std::is_base_of<tlv::Error, Interest::Error>::value,
+ "Interest::Error must inherit from tlv::Error");
+
uint32_t
Interest::getNonce() const
{
@@ -266,7 +273,7 @@
// InterestLifetime?
if (m_wire.type() != tlv::Interest)
- throw tlv::Error("Unexpected TLV number when decoding Interest");
+ throw Error("Unexpected TLV number when decoding Interest");
// Name
m_name.wireDecode(m_wire.get(tlv::Name));