diff --git a/Control/SGTools/CMakeLists.txt b/Control/SGTools/CMakeLists.txt index 38dc2dcc73f62dff3f9f4a07dba7d5e3535a2634..36a99cde64fed5ba4fba6ac417d1ddfaf9d8b8c3 100644 --- a/Control/SGTools/CMakeLists.txt +++ b/Control/SGTools/CMakeLists.txt @@ -33,12 +33,6 @@ atlas_add_dictionary( SGToolsDict INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel CxxUtils GaudiKernel TestTools SGAudCore SGTools ) -atlas_add_test( CLIDRegistry_test - SOURCES - test/CLIDRegistry_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel CxxUtils GaudiKernel TestTools SGAudCore SGTools ) - atlas_add_test( VersionedKey_test SOURCES test/VersionedKey_test.cxx @@ -82,12 +76,6 @@ atlas_add_test( StringPool_test INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel CxxUtils GaudiKernel TestTools SGAudCore SGTools ) -atlas_add_test( ClassName_test - SOURCES - test/ClassName_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel CxxUtils GaudiKernel TestTools SGAudCore SGTools ) - atlas_add_test( DataProxy_test SOURCES test/DataProxy_test.cxx diff --git a/Control/SGTools/SGTools/CLASS_DEF.h b/Control/SGTools/SGTools/CLASS_DEF.h index da8fa1dadf6cd371874eb071166876c5702df344..c17ffe8383dd558b0ffa58f8fa420a160faab6bc 100755 --- a/Control/SGTools/SGTools/CLASS_DEF.h +++ b/Control/SGTools/SGTools/CLASS_DEF.h @@ -11,125 +11,8 @@ * $Id: CLASS_DEF.h,v 1.3 2009-01-15 19:07:29 binet Exp $ */ -#include "SGTools/ClassID_traits.h" -#include "CxxUtils/unused.h" -#include <boost/preprocessor/stringize.hpp> -#ifdef __CLING__ -# define CLIDREGISTRY_ADDENTRY(CID, NAME) \ - namespace detail { \ - const bool UNUSED(clidEntry_ ## CID) = \ - CLIDRegistry::addEntry(CID, typeid(NAME), \ - ClassID_traits< NAME >::typeNameString(), \ - ClassID_traits< NAME >::packageInfo(), \ - ClassName< NAME >::name()); \ - } -# define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) \ - namespace detail { \ - const bool UNUSED(clidEntry_ ## CID) = \ - CLIDRegistry::addEntry \ - (CID, typeid(ARG1,ARG2), \ - ClassID_traits< ARG1,ARG2 >::typeNameString(), \ - ClassID_traits< ARG1,ARG2 >::packageInfo(), \ - ClassName< ARG1,ARG2 >::name()); \ - } -#else -# define CLIDREGISTRY_ADDENTRY(CID, NAME) \ - namespace detail { \ - const bool UNUSED(clidEntry_ ## CID) = \ - CLIDRegistry::addEntry<CID>(typeid(NAME), \ - ClassID_traits< NAME >::typeNameString(), \ - ClassID_traits< NAME >::packageInfo(), \ - ClassName< NAME >::name()); \ - } -# define CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) \ - namespace detail { \ - const bool UNUSED(clidEntry_ ## CID) = \ - CLIDRegistry::addEntry<CID> \ - (typeid(ARG1,ARG2), \ - ClassID_traits< ARG1,ARG2 >::typeNameString(), \ - ClassID_traits< ARG1,ARG2 >::packageInfo(), \ - ClassName< ARG1,ARG2 >::name()); \ - } -#endif +#include "AthenaKernel/CLASS_DEF.h" -/** @def CLASS_DEF(NAME, CID , VERSION) - * @brief associate a clid and a version to a type - * eg - * @code - * CLASS_DEF(std::vector<Track*>,8901, 1) - * @endcode - * @param NAME type name - * @param CID clid - * @param VERSION not yet used - */ -#define CLASS_DEF(NAME, CID , VERSION) \ - template <> \ - struct ClassID_traits< NAME > { \ - typedef std::is_base_of<DataObject, NAME> isDObj_t; \ - static const bool s_isDataObject = isDObj_t::value; \ - typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \ - typedef std::true_type has_classID_tag; \ - static const CLID& ID() { static CLID c(CID); return c; } \ - static const char* typeNameString() { \ - return #NAME; \ - } \ - static const std::string& typeName() { \ - static const std::string name = typeNameString(); \ - return name; \ - } \ - static Athena::PackageInfo packageInfo() { \ - static Athena::PackageInfo pi( BOOST_PP_STRINGIZE(PACKAGE_VERSION_UQ) ); \ - return pi; \ - } \ - static const std::type_info& typeInfo() { \ - return typeid (NAME); \ - } \ - typedef std::true_type has_version_tag; \ - static const int s_version = VERSION; \ - static const bool s_isConst = false; \ - }; \ - CLIDREGISTRY_ADDENTRY(CID, NAME) - - -/** @def CLASS_DEF2(ARG1, ARG2, CID , VERSION) - * @brief hack to use instead of CLASS_DEF when type name contains a comma ',' - * eg - * @code - * CLASS_DEF2(map<int,string>,8900, 1) - * @endcode - * @param ARG1 type name (1st part) - * @param ARG2 type name (2nd part) - * @param CID clid - * @param VERSION not yet used - */ -#define CLASS_DEF2(ARG1, ARG2, CID , VERSION) \ - template <> \ - struct ClassID_traits< ARG1,ARG2 > { \ - typedef std::is_base_of<DataObject, ARG1, ARG2 > isDObj_t; \ - static const bool s_isDataObject = isDObj_t::value; \ - typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; \ - typedef std::true_type has_classID_tag; \ - static const CLID& ID() { \ - static CLID c(CID); return c; \ - } \ - static const char* typeNameString() { \ - return #ARG1 "," #ARG2; \ - } \ - static const std::string& typeName() { \ - static const std::string name = typeNameString(); \ - return name; \ - } \ - static const std::type_info& typeInfo() { \ - return typeid (ARG1,ARG2); \ - } \ - static Athena::PackageInfo packageInfo() { \ - return Athena::PackageInfo("Package-00-00-00"); \ - } \ - typedef std::true_type has_version_tag; \ - static const int s_version = VERSION; \ - static const bool s_isConst = false; \ - }; \ - CLIDREGISTRY_ADDENTRY2(CID, ARG1, ARG2) #endif // not SGTOOLS_CLASS_DEF_H diff --git a/Control/SGTools/SGTools/CLIDRegistry.h b/Control/SGTools/SGTools/CLIDRegistry.h index b88d065e472362a810369b694059a5afcdc74618..5cf0f4c7ced7eaf018066966368cfd9d779b6b97 100755 --- a/Control/SGTools/SGTools/CLIDRegistry.h +++ b/Control/SGTools/SGTools/CLIDRegistry.h @@ -12,116 +12,9 @@ *$Id: CLIDRegistry.h,v 1.2 2009-01-15 19:07:29 binet Exp $ */ -#include <vector> -#include <string> -#include <utility> /* pair */ -#include <boost/tuple/tuple.hpp> -#include <boost/static_assert.hpp> -/* #define CLIDREG_DEBUG 1 */ -#ifdef CLIDREG_DEBUG - #include <iostream> -#endif +// Moved to AthenaKernel +#include "AthenaKernel/CLIDRegistry.h" -#include "AthenaKernel/tools/AthenaPackageInfo.h" -#ifndef BOOST_HAS_STATIC_ASSERT -# include "CxxUtils/unused.h" -#endif - -namespace CLIDdetail { - /// @name allowed class id range - //@{ - const unsigned long MINCLID = 256; - const unsigned long MAXCLID = 2147483647; ///< 2**31 - 1 - //@} -} - -/** @class CLIDRegistry - * @brief a static registry of CLID->typeName entries. NOT for general use. - * Use ClassIDSvc instead. - */ -class CLIDRegistry { -private: - typedef boost::tuple <unsigned long, - std::string, - Athena::PackageInfo, - std::string> tuple_t; - typedef std::vector< tuple_t > CLIDRegistryImpl; -public: - typedef CLIDRegistryImpl::const_iterator const_iterator; - - ///to be called by the CLASS_DEFS - template <unsigned long CLID> - static bool addEntry(const std::type_info& ti, - const char* typeName, - const Athena::PackageInfo& pkgInfo, - const std::string& typeInfoName); - // static bool addEntry(unsigned long id, const std::string& typeName); - - /// allowed class id range (backward compatibility) - //@{ - static const unsigned long MINCLID; - static const unsigned long MAXCLID; - //@} - - /// registry accessors (used by ClassIDSvc) - //@{ - static const_iterator begin(); - static const_iterator end(); - /// are there new entries since last call? Does not move the entries ptr - static bool hasNewEntries(); - /// returns an iterator range over the entries added since last time - /// newEntries was called - static std::pair<const_iterator, const_iterator> newEntries(); - //@} - - /// Translate between CLID and type_info. - static const std::type_info* CLIDToTypeinfo (unsigned long clid); - static unsigned long typeinfoToCLID (const std::type_info& ti); - - - /// Out-of-line part of addEntry(). - static bool addEntry (unsigned long clid, - const std::type_info& ti, - const char* typeName, - const Athena::PackageInfo& pkgInfo, - const std::string& typeInfoName); - -private: - /// Add a CLID <> type_info mapping. - static void addCLIDMapping (unsigned long clid, const std::type_info& ti); - - static CLIDRegistryImpl& registry(); -}; - - -//the drudgery below is to issue a compilation error when CLID is -//out of range -template <bool x> struct ERROR_CLID_out_of_CLIDRegistry_range; -template <> struct ERROR_CLID_out_of_CLIDRegistry_range<true>{}; - -#ifndef __GCCXML__ - -//<<<<<< INLINE MEMBER FUNCTIONS >>>>>> -template <unsigned long CLID> -bool CLIDRegistry::addEntry(const std::type_info& ti, - const char* typeName, - const Athena::PackageInfo& pkgInfo, - const std::string& typeInfoName) { - //more drudgery -#ifdef BOOST_HAS_STATIC_ASSERT - static_assert (CLIDdetail::MINCLID <= CLID && CLID <= CLIDdetail::MAXCLID, - "CLID out of CLIDRegistry range"); -#else - UNUSED(typedef ::boost::static_assert_test< - sizeof(ERROR_CLID_out_of_CLIDRegistry_range< (bool)(CLIDdetail::MINCLID <= CLID && CLID <= CLIDdetail::MAXCLID) >) - > BOOST_JOIN(boost_static_assert_typedef_, __LINE__)); -#endif - - addEntry (CLID, ti, typeName, pkgInfo, typeInfoName); - return true; -} - -#endif #endif // SGTOOLS_CLIDREGISTRY_H diff --git a/Control/SGTools/SGTools/ClassID_traits.h b/Control/SGTools/SGTools/ClassID_traits.h index 81a90cb38d1950b616fd2a2f3ff5382a6cf14537..574d472db437aa43adc777ec239e4f154093294c 100755 --- a/Control/SGTools/SGTools/ClassID_traits.h +++ b/Control/SGTools/SGTools/ClassID_traits.h @@ -11,89 +11,10 @@ * @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration * $Id: ClassID_traits.h,v 1.3 2009-01-15 19:07:29 binet Exp $ */ -#include <string> -#include <typeinfo> -#include <boost/static_assert.hpp> -#include "GaudiKernel/ClassID.h" -#include "GaudiKernel/DataObject.h" -#include "GaudiKernel/System.h" +#include "AthenaKernel/ClassID_traits.h" -#include "SGTools/CLIDRegistry.h" -#include "SGTools/ClassName.h" - -#include "AthenaKernel/tools/AthenaPackageInfo.h" -#ifndef BOOST_HAS_STATIC_ASSERT -# include "CxxUtils/unused.h" -#endif -#include <type_traits> - - - -template <bool x> struct ERROR_you_should_use_the_CLASS_DEF_macro_to_define_CLID_and_VERSION; -template <> struct ERROR_you_should_use_the_CLASS_DEF_macro_to_define_CLID_and_VERSION<true>{}; - -///internal use: issues a compilation error when condition B is false -#ifdef BOOST_HAS_STATIC_ASSERT -#define MY_STATIC_ASSERT( B ) \ - static_assert (B, "You should use the CLASS_DEF macro to define CLID and VERSION"); -#else -#define MY_STATIC_ASSERT( B ) \ - UNUSED(typedef ::boost::static_assert_test< \ - sizeof(ERROR_you_should_use_the_CLASS_DEF_macro_to_define_CLID_and_VERSION< (bool)( B ) >)>\ - BOOST_JOIN(boost_static_assert_typedef_, __LINE__)) -#endif - -/** @class ClassID_traits - * @brief a traits class that associates a CLID to a type T - * It also detects whether T inherits from Gaudi DataObject - */ -template <typename T> -struct ClassID_traits { - //default only works for DataObjects - typedef std::is_base_of<DataObject, T> isDObj_t; - ///flags whether T inherits from DataObject - static const bool s_isDataObject = isDObj_t::value; - - //default traits for class ID assignment - typedef std::integral_constant<bool, s_isDataObject> is_DataObject_tag; - - ///the CLID of T - static const CLID& ID() { - MY_STATIC_ASSERT(s_isDataObject); - return T::classID(); - } - - ///the demangled type name of T - static const std::string& typeName() { - MY_STATIC_ASSERT(s_isDataObject); - static const std::string tname = System::typeinfoName(typeid(T)); - return tname; - } - - ///the type id of T - static const std::type_info& typeInfo() { - MY_STATIC_ASSERT(s_isDataObject); - return typeid(T); - } - - ///the package name of this CLASSDEF (and BY CONVENTION of the data obj too!) - static Athena::PackageInfo packageInfo() { - MY_STATIC_ASSERT(s_isDataObject); - return Athena::PackageInfo("Package-00-00-00"); - } - - typedef std::false_type has_version_tag; - typedef std::false_type has_classID_tag; - static const int s_version = 0; - - // Is this is true, these types will automatically be made - // const when added to StoreGate. - static const bool s_isConst = false; -}; - -#undef MY_STATIC_ASSERT #endif // not SGTOOLS_CLASSID_TRAITS_H diff --git a/Control/SGTools/SGTools/ClassName.h b/Control/SGTools/SGTools/ClassName.h index 80826d4edd32a4b31f304fa052da219967fb1773..cfe3d2026e6602f8fcdcf04f333b63d262ce40d9 100644 --- a/Control/SGTools/SGTools/ClassName.h +++ b/Control/SGTools/SGTools/ClassName.h @@ -17,37 +17,7 @@ #define SGTOOLS_CLASSNAME_H -#include <string> - - -/** - * @brief An interface for getting the name of a class as a string. - * - * This template class provides an interface for getting the name - * of a class as a string. By default, it uses @c typeinfoName - * from @c GaudiKernel, but it may be specialized to override - * the behavior for specific classes. - */ -template <class T> -class ClassName -{ -public: - /** - * @brief Return the name of class @c T as a string. - */ - static std::string name() -#ifdef __GNUC__ - // Force this function to appear as a symbol in the output file, - // even in an optimized build where it's always inlined. - // Otherwise, we get complaints from cling that it can't find the symbol - // (as of root 6.04). - __attribute__ ((used)) -#endif - ; -}; - - -#include "SGTools/ClassName.icc" +#include "AthenaKernel/ClassName.h" #endif // not SGTOOLS_CLASSNAME_H diff --git a/Control/SGTools/SGTools/ClassName.icc b/Control/SGTools/SGTools/ClassName.icc deleted file mode 100644 index 55e22f24897c17181a457113d36cd1298db54793..0000000000000000000000000000000000000000 --- a/Control/SGTools/SGTools/ClassName.icc +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: ClassName.icc,v 1.1 2009-01-15 19:07:29 binet Exp $ -/** - * @file DataModel/ClassName.icc - * @author scott snyder - * @date Jul 2005 - * @brief An interface for getting the name of a class as a string. - * Implementation file. - */ - - -#include "GaudiKernel/System.h" - - -/** - * @brief Return the name of class @c T as a string. - */ -template <class T> -std::string ClassName<T>::name() -{ - return System::typeinfoName (typeid (T)); -} - -// /** -// * @brief Specialization of @c ClassName for @c std::vector. -// * -// * This overrides the default implementation of @c ClassName -// * to hide @c std::vector's second template parameter. -// */ -// #include <vector> -// template <class T> -// std::string ClassName<std::vector<T> >::name() -// { -// std::string out = "std::vector<"; -// out += ClassName<T>::name(); -// if (out[out.size()-1] == '>') -// out += ' '; -// out += '>'; -// return out; -// } - -// /** -// * @brief Specialization of @c ClassName for @c std::list. -// * -// * This overrides the default implementation of @c ClassName -// * to hide @c std::list's second template parameter. -// */ -// #include <list> -// template <class T> -// std::string ClassName<std::list<T> >::name() -// { -// std::string out = "std::list<"; -// out += ClassName<T>::name(); -// if (out[out.size()-1] == '>') -// out += ' '; -// out += '>'; -// return out; -// } - -// /** -// * @brief Specialization of @c ClassName for @c std::map. -// * -// * This overrides the default implementation of @c ClassName -// * to hide @c std::map's 4th template parameter (and optionally the 3rd too) -// */ -// #include <map> -// template <class K, class V, class C> -// std::string ClassName<std::map<K, V, C> >::name() -// { -// std::string out = "std::map<"; -// out += ClassName<K>::name()+ "," + ClassName<V>::name(); -// std::string comp = ClassName<C>::name(); -// if (comp.size() > 10 && comp.substr(0, 10) != "std::less<") { -// out += ","+ClassName<C>::name(); -// } -// if (out[out.size()-1] == '>') -// out += ' '; -// out += '>'; -// return out; -// } - - diff --git a/Control/SGTools/share/CLIDRegistry_test.ref b/Control/SGTools/share/CLIDRegistry_test.ref deleted file mode 100755 index b5d0b6a45586b001a89587f8568a2ad420c975ae..0000000000000000000000000000000000000000 --- a/Control/SGTools/share/CLIDRegistry_test.ref +++ /dev/null @@ -1,2 +0,0 @@ -*** CLIDRegistry_test starts *** -*** CLIDRegistry_test OK *** diff --git a/Control/SGTools/share/ClassName_test.ref b/Control/SGTools/share/ClassName_test.ref deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Control/SGTools/src/CLIDRegistry.cxx b/Control/SGTools/src/CLIDRegistry.cxx deleted file mode 100755 index 9091d635377cc2013299116e96e0bd64911b025c..0000000000000000000000000000000000000000 --- a/Control/SGTools/src/CLIDRegistry.cxx +++ /dev/null @@ -1,144 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "SGTools/CLIDRegistry.h" -#include <unordered_map> -#include <memory> -/* #include <algorithm> */ -using namespace std; - -const unsigned long CLIDRegistry::MINCLID = CLIDdetail::MINCLID; -const unsigned long CLIDRegistry::MAXCLID = CLIDdetail::MAXCLID; - -namespace { -unsigned int alreadyDone (0); -} - - -// bool -// CLIDRegistry::addEntry(unsigned long id, const string& typeName) { -// assert( MINCLID <= id && id <= MAXCLID ); -// registry().push_back(pair<unsigned long, string>(id,typeName)); -// return true; -// } - - -CLIDRegistry::const_iterator CLIDRegistry::begin() { -#ifdef CLIDREG_DEBUG - cerr << "CLIDRegistry::begin: returns " - << &*(registry().begin()) << " for registry " <<®istry() - <<endl; -#endif - return registry().begin(); -} - - -CLIDRegistry::const_iterator CLIDRegistry::end() { -#ifdef CLIDREG_DEBUG - cerr << "CLIDRegistry::end: returns " - << &*(registry().end()) << " for registry " <<®istry() - <<endl; -#endif - return registry().end(); - //return unique(registry().begin(), registry().end()); //FIXME O(N)! -} - -bool -CLIDRegistry::hasNewEntries() { - return (alreadyDone < CLIDRegistry::registry().size()); -} - -std::pair<CLIDRegistry::const_iterator, CLIDRegistry::const_iterator> -CLIDRegistry::newEntries() { - std::pair<CLIDRegistry::const_iterator, CLIDRegistry::const_iterator> ret = - std::make_pair(CLIDRegistry::begin()+alreadyDone, - CLIDRegistry::end()); - alreadyDone = CLIDRegistry::registry().size(); - return ret; -} - - -CLIDRegistry::CLIDRegistryImpl& CLIDRegistry::registry() { - static CLIDRegistryImpl reg; - return reg; -} - - -namespace { -typedef std::unordered_map<unsigned long, const std::type_info*> clid_ti_map_t; -std::unique_ptr<clid_ti_map_t> clid_ti_map; - -typedef std::unordered_map<const std::type_info*, unsigned long> ti_clid_map_t; -std::unique_ptr<ti_clid_map_t> ti_clid_map; -} - - -/** - * @brief Add a new CLID <> type_info mapping. - * @param clid The CLID of the class. - * @param ti The @c type_info of the class. - */ -void CLIDRegistry::addCLIDMapping (unsigned long clid, const std::type_info& ti) -{ - if (!clid_ti_map) - clid_ti_map = std::make_unique<clid_ti_map_t>(); - if (!ti_clid_map) - ti_clid_map = std::make_unique<ti_clid_map_t>(); - - (*clid_ti_map)[clid] = &ti; - (*ti_clid_map)[&ti] = clid; -} - - -/** - * @brief Return the @c type_info corresponding to a CLID. - * @param clid The CLID to find. - * - * Returns the corresponding @c type_info or nullptr. - */ -const std::type_info* CLIDRegistry::CLIDToTypeinfo (unsigned long clid) -{ - if (clid_ti_map) { - auto i = clid_ti_map->find (clid); - if (i != clid_ti_map->end()) - return i->second; - } - return nullptr; -} - - -/** - * @brief Return the CLID corresponding to a @c type_info. - * @param ti The @c type_info to find. - * - * Returns the corresponding @c CLID or CLID_NULL. - */ -unsigned long CLIDRegistry::typeinfoToCLID (const std::type_info& ti) -{ - if (ti_clid_map) { - auto i = ti_clid_map->find (&ti); - if (i != ti_clid_map->end()) - return i->second; - } - return 0; -} - - -/// Out-of-line part of addEntry(). -bool CLIDRegistry::addEntry (unsigned long clid, - const std::type_info& ti, - const char* typeName, - const Athena::PackageInfo& pkgInfo, - const std::string& typeInfoName) -{ - registry().push_back(tuple_t(clid, std::string(typeName), pkgInfo, typeInfoName)); -#ifdef CLIDREG_DEBUG - std::cerr << "CLIDRegistry::addEntry: for CLID/type " - << clid << '/' << typeName << " to registry " <<®istry() - <<std::endl; -#endif - addCLIDMapping (clid, ti); - return true; -} - diff --git a/Control/SGTools/test/CLIDRegistry_test.cxx b/Control/SGTools/test/CLIDRegistry_test.cxx deleted file mode 100755 index e0bb249a670f5bf15a7c4736f38cf4dc58e4da29..0000000000000000000000000000000000000000 --- a/Control/SGTools/test/CLIDRegistry_test.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** @file CLIDRegistry_test.cxx - * @brief unit test for CLIDRegistry - * - * $Id: CLIDRegistry_test.cxx,v 1.2 2009-01-19 17:02:55 binet Exp $ - * @author Paolo Calafiura <pcalafiura@lbl.gov> - ATLAS Collaboration - */ - -/* #define COMPILEFAIL 1 */ - -#undef NDEBUG - -#include "SGTools/CLIDRegistry.h" - -#include <algorithm> -#include <cassert> -#include <iostream> -#include <typeinfo> - -#include <boost/tuple/tuple.hpp> -using boost::get; -#include "AthenaKernel/tools/AthenaPackageInfo.h" - -class Foo {}; -class Bar {}; -class Baz {}; - -int main () { - std::cerr << "*** CLIDRegistry_test starts ***" <<std::endl; - //reset newEntries before we start counting - std::pair<CLIDRegistry::const_iterator, CLIDRegistry::const_iterator> er = - CLIDRegistry::newEntries(); - Athena::PackageInfo info(PACKAGE_VERSION); -#ifdef COMPILEFAIL - CLIDRegistry::addEntry<12>(typeid(Foo), "Foo", info, "Foo"); - //no upper limit CLIDRegistry::addEntry<1245736740>("Foo", info); -#endif - CLIDRegistry::addEntry<1234>(typeid(Foo), "Foo", info, "Foo"); - CLIDRegistry::addEntry<4321>(typeid(Bar), "Bar", info, "Bar"); - assert(CLIDRegistry::hasNewEntries()); - er = CLIDRegistry::newEntries(); - assert( distance(er.first, er.second) == 2 ); - assert( get<0>(*(CLIDRegistry::end()-2)) == 1234 ); - assert( get<1>(*(CLIDRegistry::end()-2)) == "Foo" ); - assert( get<2>(*(CLIDRegistry::end()-2)).name() == "SGTools" ); - - assert (CLIDRegistry::CLIDToTypeinfo (4321) == &typeid(Bar)); - assert (CLIDRegistry::CLIDToTypeinfo (43213) == 0); - assert (CLIDRegistry::typeinfoToCLID (typeid(Bar)) == 4321); - assert (CLIDRegistry::typeinfoToCLID (typeid(Baz)) == 0); - - CLIDRegistry::addEntry<43213>(typeid(Baz), "Baz", info, "Baz"); - assert (CLIDRegistry::CLIDToTypeinfo (43213) == &typeid(Baz)); - assert (CLIDRegistry::typeinfoToCLID (typeid(Baz)) == 43213); - - er = CLIDRegistry::newEntries(); - assert( distance(er.first, er.second) == 1 ); - assert( !CLIDRegistry::hasNewEntries()); - std::cerr << "*** CLIDRegistry_test OK ***" <<std::endl; - - return 0; -} diff --git a/Control/SGTools/test/ClassName_test.cxx b/Control/SGTools/test/ClassName_test.cxx deleted file mode 100755 index efd1eebcd8063f62d3cb014547ac73ea105f2d83..0000000000000000000000000000000000000000 --- a/Control/SGTools/test/ClassName_test.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cassert> -#include "SGTools/ClassName.h" - -class A {}; -class B {}; -template <class T> class C {}; - -template <> -class ClassName<B> -{ -public: - static std::string name() { return "fooB"; } -}; - -int main() -{ - assert (ClassName<A>::name() == "A"); - assert (ClassName<C<C<A> > >::name() == "C<C<A> >"); - assert (ClassName<B>::name() == "fooB"); - return 0; -}