SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
class_type.h
Go to the documentation of this file.
1/*
2 © 2016 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_CLASS_TYPE_H
15#define SIMICS_SYSTEMC_CLASS_TYPE_H
16
17#include <string>
18#include <typeinfo>
19
20namespace simics {
21namespace systemc {
22
23class ClassType {
24 public:
25 ClassType() { implementor_ = this; }
26 std::string type() const {
27 return type_;
28 }
29 bool operator ==(const ClassType &type) const {
30 return type_ == type.type_;
31 }
32 bool operator !=(const ClassType &type) const {
33 return type_ != type.type_;
34 }
35 bool operator <(const ClassType &type) const {
36 return type_ < type.type_;
37 }
38 template<class T>
40 return dynamic_cast<T *>(implementor_);
41 }
42 template<class T>
45 type.type_ = typeid(T).name();
46 return type;
47 }
48 virtual ~ClassType() {}
49
50 protected:
51 void set_type() {
52 type_ = typeid(*this).name();
53 }
54 std::string type_;
56};
57
58} // namespace systemc
59} // namespace simics
60
61#endif
Definition: class_type.h:23
ClassType()
Definition: class_type.h:25
static ClassType typeForClass()
Definition: class_type.h:43
bool operator!=(const ClassType &type) const
Definition: class_type.h:32
virtual ~ClassType()
Definition: class_type.h:48
std::string type_
Definition: class_type.h:54
bool operator<(const ClassType &type) const
Definition: class_type.h:35
void set_type()
Definition: class_type.h:51
T * get_interface()
Definition: class_type.h:39
ClassType * implementor_
Definition: class_type.h:55
bool operator==(const ClassType &type) const
Definition: class_type.h:29
std::string type() const
Definition: class_type.h:26
Definition: adapter.h:79