예제 #1
0
/**@brief
*******************************************************************************/
template<class Decl> inline void
check_declaration(const Node_id nid, const Decl d, Triple_store const& ts) {
   const Decl nt = declaration<Decl>(nid, ts);
   if( nt != d ) BOOST_THROW_EXCEPTION(
               Logic_err()
               << Logic_err::msg_t(
                        "node is " + nt.to_string() +
                        "; should be " + d.to_string()
               )
               << Logic_err::str1_t(to_string(nid, ts))
   );
}
예제 #2
0
/**@brief
*******************************************************************************/
template<class Decl> inline Decl
check_same_declaration(const Node_id n1, const Node_id n2, Triple_store const& ts) {
   const Decl d1 = declaration<Decl>(n1, ts);
   if( d1.is_none() ) BOOST_THROW_EXCEPTION(
            Logic_err()
            << Logic_err::msg_t("node " + Decl::name() + " declaration not found")
            << Logic_err::str1_t(to_string(n1, ts))
   );
   const Decl d2 = declaration<Decl>(n2, ts);
   if( d1 != d2 ) BOOST_THROW_EXCEPTION(
               Logic_err()
               << Logic_err::msg_t("node type mismatch")
               << Logic_err::str1_t(d1.to_string())
               << Logic_err::str2_t(d2.to_string())
   );
   return d1;
}