X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2FTypeIdValue.cci;h=28c1e11dddf5600adbd459057fcc3916759535f3;hb=93d9568d448749dc187e7622b733a4a3caa319df;hp=e73ffd0f8961d4e92fb92836e6de24797999af22;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/TypeIdValue.cci b/senf/Utils/TypeIdValue.cci index e73ffd0..28c1e11 100644 --- a/senf/Utils/TypeIdValue.cci +++ b/senf/Utils/TypeIdValue.cci @@ -27,48 +27,49 @@ // Custom includes #include "TypeInfo.hh" +#include "senfassert.hh" #define prefix_ inline -///////////////////////////////cci.p/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// prefix_ senf::TypeIdValue::TypeIdValue() - : value_(new ValueImpl()) + : p_ (&typeid(void)) {} -prefix_ senf::TypeIdValue::TypeIdValue(TypeIdValue const & other) -{ - value_.reset(other.value_->clone()); -} - -prefix_ senf::TypeIdValue const & -senf::TypeIdValue::operator=(TypeIdValue const & other) -{ - value_.reset(other.value_->clone()); - return *this; -} +prefix_ senf::TypeIdValue::TypeIdValue(std::type_info const & v) + : p_ (&v) +{} prefix_ bool senf::TypeIdValue::operator==(TypeIdValue const & other) const { - return value_->id() == other.value_->id(); + return (*p_) == (*other.p_); } prefix_ bool senf::TypeIdValue::operator<(TypeIdValue const & other) const { - return value_->id().before(other.value_->id()); + return p_->before(*other.p_); } prefix_ std::string senf::TypeIdValue::name() const { - return std::string(value_->id().name()); + return p_->name(); +} + +prefix_ std::string senf::TypeIdValue::prettyName() + const +{ + return senf::prettyName(id()); } prefix_ std::type_info const & senf::TypeIdValue::id() const { - return value_->id(); + SENF_ASSERT( + p_, "Internal failure: Empty TypeIdValue should have p_ point to typeid(void) not 0"); + return *p_; } prefix_ senf::TypeIdValue const senf::typeIdValue() @@ -78,11 +79,11 @@ prefix_ senf::TypeIdValue const senf::typeIdValue() prefix_ std::ostream & senf::operator<<(std::ostream & os, TypeIdValue const & v) { - os << prettyName(v.id()); + os << v.prettyName(); return os; } -///////////////////////////////cci.e/////////////////////////////////////// +//-///////////////////////////////////////////////////////////////////////////////////////////////// #undef prefix_