ATLAS Offline Software
Classes | Macros | Functions
Control/AthenaKernel/AthenaKernel/ClassID_traits.h File Reference

a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataObject More...

#include "AthenaKernel/ClassName.h"
#include "GaudiKernel/ClassID.h"
#include <string>
#include <typeinfo>
#include <type_traits>
#include <concepts>
Include dependency graph for Control/AthenaKernel/AthenaKernel/ClassID_traits.h:

Go to the source code of this file.

Classes

class  ClassID_trait_dummy
 
class  ClassID_traits< T >
 Default, invalid implementation of ClassID_traits. More...
 
struct  ClassID_traits< T >
 

Macros

#define MY_STATIC_ASSERT(B)   static_assert (B, "You should use the CLASS_DEF macro to define CLID and VERSION")
 internal use: issues a compilation error when condition B is false More...
 

Functions

template<typename T >
requires requires ()
 This specialization is used for classes deriving from DataObject. More...
 

Detailed Description

a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataObject

Author
Paolo Calafiura pcala.nosp@m.fiur.nosp@m.a@lbl.nosp@m..gov - ATLAS Collaboration

Definition in file Control/AthenaKernel/AthenaKernel/ClassID_traits.h.

Macro Definition Documentation

◆ MY_STATIC_ASSERT

#define MY_STATIC_ASSERT (   B)    static_assert (B, "You should use the CLASS_DEF macro to define CLID and VERSION")

internal use: issues a compilation error when condition B is false

Definition at line 25 of file Control/AthenaKernel/AthenaKernel/ClassID_traits.h.

Function Documentation

◆ requires()

template<typename T >
requires requires ( )

This specialization is used for classes deriving from DataObject.

To avoid having a compile-time dependency on DataObject, we enable this based on whether or not T::classID() is defined.

Definition at line 68 of file Control/AthenaKernel/AthenaKernel/ClassID_traits.h.

68  {
69  { T::classID() } -> std::convertible_to<CLID>;
70 }