C++ Device API Reference Manual
Reference documentation for the Simics C++ Device API.
 
Loading...
Searching...
No Matches
init-class.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2021 Intel Corporation
5
6 This software and the related documents are Intel copyrighted materials, and
7 your use of them is governed by the express license under which they were
8 provided to you ("License"). Unless the License provides otherwise, you may
9 not use, modify, copy, publish, distribute, disclose or transmit this software
10 or the related documents without Intel's prior written permission.
11
12 This software and the related documents are provided as is, with no express or
13 implied warranties, other than those that are expressly stated in the License.
14*/
15
16#ifndef SIMICS_INIT_CLASS_H
17#define SIMICS_INIT_CLASS_H
18
19#include <type_traits>
20
21namespace simics {
22
23class ConfClass;
24
25namespace detail {
26
27template<class ...Ts>
28struct Voider {
29 using type = void;
30};
31
32// General case when init_class is not declared in T
33template<typename T, typename = void>
34struct has_init_class : std::false_type {};
35// Special case when init_class is declared in T
36template<typename T>
37struct has_init_class<T, typename Voider<decltype(T::init_class)>::type>
38 : std::true_type {};
39
40// When init_class is not declared in T
41template <class T>
42typename std::enable_if<!has_init_class<T>::value>::type
44// When init_class is declared in T
45template <class T>
46typename std::enable_if<has_init_class<T>::value>::type
48 T::init_class(cls);
49}
50
51} // namespace detail
52} // namespace simics
53
54#endif
Represents Simics C type conf_class_t.
Definition: conf-class.h:52
std::enable_if<!has_init_class< T >::value >::type init_class(ConfClass *)
Definition: init-class.h:43
Definition: after-bank.h:33
Definition: init-class.h:28
void type
Definition: init-class.h:29
Definition: init-class.h:34