diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 48ae5fc270ea3bbb965b4bd07cb1691a5c115642 (patch) | |
tree | 639ac5dd123a7fd28dfe4c86743b37c23b199b46 /libpp/name_storage.h | |
parent | cc2ee177dbb3befca43e36cfc56778b006c3d050 (diff) | |
download | oprofile-release-1.0.tar.gz |
Initial Contributionandroid-1.0release-1.0
Diffstat (limited to 'libpp/name_storage.h')
-rw-r--r-- | libpp/name_storage.h | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/libpp/name_storage.h b/libpp/name_storage.h deleted file mode 100644 index 0e278cb..0000000 --- a/libpp/name_storage.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @file name_storage.h - * Type-safe unique storage of global names (filenames and symbols) - * - * @remark Copyright 2002 OProfile authors - * @remark Read the file COPYING - * - * @author Philippe Elie - * @author John Levon - */ - -#ifndef NAME_STORAGE_H -#define NAME_STORAGE_H - -#include <string> - -#include "unique_storage.h" - -/// store original name and processed name -struct stored_name { - stored_name(std::string const & n = std::string()) - : name(n) {} - - bool operator<(stored_name const & rhs) const { - return name < rhs.name; - } - - std::string name; - mutable std::string name_processed; -}; - - -/// partial specialization for unique storage of names -template <typename I> struct name_storage : unique_storage<I, stored_name> { - - typedef typename unique_storage<I, stored_name>::id_value id_value; - - std::string const & name(id_value const & id) const { - return unique_storage<I, stored_name>::get(id).name; - }; -}; - - -class debug_name_tag; -/// a debug filename -typedef name_storage<debug_name_tag>::id_value debug_name_id; - -/// class storing a set of shared debug name (source filename) -struct debug_name_storage : name_storage<debug_name_tag> { - /// return the basename for the given ID - std::string const & basename(debug_name_id id) const; -}; - - -class image_name_tag; -/// an image name -typedef name_storage<image_name_tag>::id_value image_name_id; - -/// class storing a set of shared image name -struct image_name_storage : name_storage<image_name_tag> { - /// return the basename name for the given ID - std::string const & basename(image_name_id) const; -}; - - -class symbol_name_tag; -/// a (demangled) symbol -typedef name_storage<symbol_name_tag>::id_value symbol_name_id; - -/// class storing a set of shared symbol name -struct symbol_name_storage : name_storage<symbol_name_tag> { - /// return the demangled name for the given ID - std::string const & demangle(symbol_name_id id) const; -}; - - -/// for images -extern image_name_storage image_names; - -/// for debug filenames i.e. source filename -extern debug_name_storage debug_names; - -/// for symbols -extern symbol_name_storage symbol_names; - - -/** - * debug name specialisation for comparison. - * - * We compare by name rather by id since what user will see are - * filename and when the criteria "samples count" give identical - * result it's better to obtain result sorted by the user visible - * property filename rather than by an obscure, invisible from user - * point of view, file identifier property - */ -template<> inline bool -debug_name_id::operator<(debug_name_id const & rhs) const -{ - return debug_names.name(*this) < debug_names.name(rhs); -} - -#endif /* !NAME_STORAGE_H */ |