#define prefix_
///////////////////////////////cc.p////////////////////////////////////////
-prefix_ senf::TypeIdValue::Value::~Value()
-{}
-
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "TypeIdValue.mpp"
// Custom includes
#include "TypeInfo.hh"
+#include "senfassert.hh"
#define prefix_ inline
///////////////////////////////cci.p///////////////////////////////////////
prefix_ senf::TypeIdValue::TypeIdValue()
- : value_(new ValueImpl<void>())
+ : 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_);
+ return *p_;
}
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;
}
// $Id$
//
-// Copyright (C) 2006
+// Copyright (C) 2009
// Fraunhofer Institute for Open Communication Systems (FOKUS)
// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
///////////////////////////////cti.p///////////////////////////////////////
template <class Type>
-prefix_ senf::TypeIdValue::TypeIdValue(Type *)
- : value_(new ValueImpl<Type>())
-{}
-
-template <class Type>
-prefix_ std::type_info const & senf::TypeIdValue::ValueImpl<Type>::id()
+prefix_ senf::TypeIdValue const senf::typeIdValue()
{
return typeid(Type);
}
template <class Type>
-prefix_ senf::TypeIdValue::Value *
-senf::TypeIdValue::ValueImpl<Type>::clone()
-{
- return new ValueImpl<Type>();
-}
-
-template <class Type>
-prefix_ senf::TypeIdValue const senf::typeIdValue()
+prefix_ senf::TypeIdValue const senf::typeidValue(Type const & ob)
{
- return TypeIdValue(static_cast<Type*>(0));
+ return typeid(ob);
}
-///////////////////////////////cti.e///////////////////////////////////////
+/////////////////////////////cti.e///////////////////////////////////////
#undef prefix_
\f
// Local Variables:
// mode: c++
// fill-column: 100
+// comment-column: 40
// c-file-style: "senf"
// indent-tabs-mode: nil
// ispell-local-dictionary: "american"
// compile-command: "scons -u test"
-// comment-column: 40
// End:
// no conversion constructors
TypeIdValue();
- TypeIdValue(TypeIdValue const & other);
- TypeIdValue const & operator=(TypeIdValue const & other);
+ TypeIdValue(std::type_info const & v);
///@}
///////////////////////////////////////////////////////////////////////////
bool operator<(TypeIdValue const & other) const;
std::string name() const;
+ std::string prettyName() const;
+
std::type_info const & id() const;
protected:
private:
- template <class Type> TypeIdValue(Type *);
-
- struct Value {
- virtual ~Value();
- virtual std::type_info const & id() = 0;
- virtual Value * clone() = 0;
- };
-
- template <class Type>
- struct ValueImpl : public Value {
- virtual std::type_info const & id();
- virtual Value * clone();
- };
-
- boost::scoped_ptr<Value> value_;
-
- template <class Type> friend TypeIdValue const typeIdValue();
+ std::type_info const * p_;
};
TypeIdValue const typeIdValue();
template <class Type>
TypeIdValue const typeIdValue();
+ template <class Type>
+ TypeIdValue const typeidValue(Type const & ob);
+
std::ostream & operator<<(std::ostream & os, TypeIdValue const & v);
}
{
// We don't care for the ordering, just that the following compiles
(void) ( senf::typeIdValue<int>() < senf::typeIdValue<float>() );
- (void) ( senf::typeIdValue<int>() == senf::typeIdValue<float>() );
+ BOOST_CHECK ( senf::typeIdValue<int>() != senf::typeIdValue<float>() );
+ BOOST_CHECK ( senf::typeIdValue<int>() == senf::typeIdValue<int>() );
}
///////////////////////////////cc.e////////////////////////////////////////
-name "*.o" -o \
-name "*.os" -o \
-name "*.so" -o \
- \( -type f -a ! -name "*.*" \) -o \
+ \( -type f -a ! -name "*.*" -a -exec sh -c "file --brief {} | grep -q ELF" \; \) -o \
-name "*~" -o \
-name "#*#" -o \
-name "*.pyc" -o \