SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
simics_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_LOCK_H
15#define SIMICS_SYSTEMC_SIMICS_LOCK_H
16
17#include <simics/base/object-locks.h>
19
20namespace simics {
21namespace systemc {
22
24template <typename T>
26 public:
27 SimicsLock(iface::SimulationInterface *simulation, T *pointer)
28 : lock_(0), pointer_(pointer), object_(simulation->simics_object()) {
29 SIM_ACQUIRE_OBJECT(object_, &lock_);
30 }
31 virtual ~SimicsLock() {
32 SIM_RELEASE_OBJECT(object_, &lock_);
33 }
34 SimicsLock(const SimicsLock &) = delete;
35 SimicsLock& operator=(const SimicsLock &) = delete;
36 SimicsLock(SimicsLock&&) = default;
38
40 return *pointer_;
41 }
42 const T &operator* () const {
43 return *pointer_;
44 }
46 return pointer_;
47 }
48 const T *operator->() const {
49 return pointer_;
50 }
51 operator bool() const {
52 return pointer_ != NULL;
53 }
54
55 protected:
56 domain_lock_t *lock_;
58 conf_object_t *object_;
59};
60
61} // namespace systemc
62} // namespace simics
63
64#endif
Definition: simics_lock.h:25
T & operator*()
Definition: simics_lock.h:39
SimicsLock & operator=(SimicsLock &&)=default
SimicsLock(const SimicsLock &)=delete
SimicsLock(iface::SimulationInterface *simulation, T *pointer)
Definition: simics_lock.h:27
conf_object_t * object_
Definition: simics_lock.h:58
domain_lock_t * lock_
Definition: simics_lock.h:56
SimicsLock(SimicsLock &&)=default
T * operator->()
Definition: simics_lock.h:45
virtual ~SimicsLock()
Definition: simics_lock.h:31
const T * operator->() const
Definition: simics_lock.h:48
SimicsLock & operator=(const SimicsLock &)=delete
T * pointer_
Definition: simics_lock.h:57
Interface to the SystemC simulation.
Definition: simulation_interface.h:25
Definition: adapter.h:79