SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
simics_target_lock.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2019 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_SYSTEMC_SIMICS_TARGET_LOCK_H
17#define SIMICS_SYSTEMC_SIMICS_TARGET_LOCK_H
18
19#include <simics/device-api.h>
20#include <simics/base/object-locks.h>
21
22namespace simics {
23namespace systemc {
24
26template <typename T>
28 public:
29 SimicsTargetLock(conf_object_t *target, T *pointer)
30 : lock_(0), pointer_(pointer), target_(target) {
31#ifndef SYSTEMC_SERIAL_TD
32 if (target_)
33 SIM_ACQUIRE_TARGET(target_, &lock_);
34#endif
35 }
37 return *pointer_;
38 }
39 const T &operator* () const {
40 return *pointer_;
41 }
43 return pointer_;
44 }
45 const T *operator->() const {
46 return pointer_;
47 }
48 bool operator ==(T *t) {
49 return pointer_ == t;
50 }
52#ifndef SYSTEMC_SERIAL_TD
53 if (target_)
54 SIM_RELEASE_TARGET(target_, &lock_);
55#endif
56 }
57
58 protected:
59 domain_lock_t *lock_;
61 conf_object_t *target_;
62};
63} // namespace systemc
64} // namespace simics
65
66#endif
Definition: simics_target_lock.h:27
const T * operator->() const
Definition: simics_target_lock.h:45
T * pointer_
Definition: simics_target_lock.h:60
SimicsTargetLock(conf_object_t *target, T *pointer)
Definition: simics_target_lock.h:29
virtual ~SimicsTargetLock()
Definition: simics_target_lock.h:51
conf_object_t * target_
Definition: simics_target_lock.h:61
bool operator==(T *t)
Definition: simics_target_lock.h:48
T * operator->()
Definition: simics_target_lock.h:42
T & operator*()
Definition: simics_target_lock.h:36
domain_lock_t * lock_
Definition: simics_target_lock.h:59
Definition: pci_bus_interface.h:24