add Callback::Assign

Mathieu Lacage 2007-05-07 13:44:22 +02:00
parent 658cc9cd23
commit 9e269500d2
1 changed files with 11 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#define CALLBACK_H
#include "reference-list.h"
#include "fatal-error.h"
namespace ns3 {
@ -292,6 +293,16 @@ public:
return false;
}
}
void Assign (CallbackBase const &other) {
if (!CheckType (other))
{
NS_FATAL_ERROR ("Incompatible types. (feed to \"c++filt -t\")"
" got=" << typeid (other).name () <<
", expected=" << typeid (*this).name ());
}
const Callback<R, T1,T2,T3,T4,T5> *goodType = static_cast<const Callback<R,T1,T2,T3,T4,T5> *> (&other);
*this = *goodType;
}
private:
virtual CallbackImplBase *PeekImpl (void) const {
return m_impl.Get ();