From a15cf65c44d5c224169c32ef5495b68c758134b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 18 May 2014 16:08:14 +0200 Subject: Imported Upstream version 3.3.0.2 --- libcult/cult/rtti/type-info.cxx | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 libcult/cult/rtti/type-info.cxx (limited to 'libcult/cult/rtti/type-info.cxx') diff --git a/libcult/cult/rtti/type-info.cxx b/libcult/cult/rtti/type-info.cxx new file mode 100644 index 0000000..5bc4040 --- /dev/null +++ b/libcult/cult/rtti/type-info.cxx @@ -0,0 +1,42 @@ +// file : cult/rtti/type-info.cxx +// author : Boris Kolpackov +// copyright : Copyright (c) 2005-2010 Boris Kolpackov +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include + +#include + +#include + +namespace Cult +{ + namespace RTTI + { + Access const Access::private_ (Access::private__); + Access const Access::protected_ (Access::protected__); + Access const Access::public_ (Access::public__); + + typedef + Containers::Map + TypeInfoMap; + + static MM::StaticPtr map_; + + TypeInfo const& + lookup (TypeId const& type_id) + { + TypeInfoMap::ConstIterator i (map_->find (type_id)); + + if (i == map_->end ()) throw NoInfo (); + + return i->second; + } + + Void + insert (TypeInfo const& type_info) + { + map_->insert (TypeInfoMap::Pair (type_info.type_id (), type_info)); + } + } +} -- cgit v1.2.3