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/*
2 © 2019 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_SIMICS_TARGET_LOCK_H
15#define SIMICS_SYSTEMC_SIMICS_TARGET_LOCK_H
16
17#include <simics/device-api.h>
18#include <simics/base/object-locks.h>
19
20namespace simics {
21namespace systemc {
22
24template <typename T>
26 public:
27 SimicsTargetLock(conf_object_t *target, T *pointer)
28 : lock_(0), pointer_(pointer), target_(target) {
29 if (target_)
30 SIM_ACQUIRE_TARGET(target_, &lock_);
31 }
33 return *pointer_;
34 }
35 const T &operator* () const {
36 return *pointer_;
37 }
39 return pointer_;
40 }
41 const T *operator->() const {
42 return pointer_;
43 }
44 bool operator ==(T *t) {
45 return pointer_ == t;
46 }
48 if (target_)
49 SIM_RELEASE_TARGET(target_, &lock_);
50 }
51
52 protected:
53 domain_lock_t *lock_;
55 conf_object_t *target_;
56};
57} // namespace systemc
58} // namespace simics
59
60#endif
Definition: simics_target_lock.h:25
const T * operator->() const
Definition: simics_target_lock.h:41
T * pointer_
Definition: simics_target_lock.h:54
SimicsTargetLock(conf_object_t *target, T *pointer)
Definition: simics_target_lock.h:27
virtual ~SimicsTargetLock()
Definition: simics_target_lock.h:47
conf_object_t * target_
Definition: simics_target_lock.h:55
bool operator==(T *t)
Definition: simics_target_lock.h:44
T * operator->()
Definition: simics_target_lock.h:38
T & operator*()
Definition: simics_target_lock.h:32
domain_lock_t * lock_
Definition: simics_target_lock.h:53
Definition: adapter.h:79