Go to the documentation of this file.
29 #ifndef __SIM_PROXY_PTR_HH__
30 #define __SIM_PROXY_PTR_HH__
34 #include <type_traits>
40 template <
typename Proxy>
48 std::unique_ptr<uint8_t[]>
data;
65 assert(
sizeof(T) <=
size);
67 return *
reinterpret_cast<T *
>(
data.get());
74 assert(
sizeof(T) <=
size);
75 return *
reinterpret_cast<T *
>(
data.get());
105 template <
typename T,
typename Proxy>
110 std::shared_ptr<ProxyPtrBuffer<Proxy>>
buffer;
112 template <
typename O,
typename P>
136 template <
typename ...Args,
137 typename std::enable_if<std::is_constructible<
138 Proxy, Args&&...>::value,
int>
::type = 0>
140 proxy(
std::make_shared<Proxy>(args...))
144 template <
typename ...Args,
145 typename std::enable_if<std::is_constructible<
146 Proxy, Args&&...>::value,
int>
::type = 0>
148 proxy(
std::make_shared<Proxy>(args...))
153 template <
typename O,
typename Enabled=
154 typename std::enable_if<std::is_assignable<T *, O *>::value>
::type>
171 operator bool()
const {
return (
bool)
buffer; }
173 template <
typename A>
174 typename std::enable_if<std::is_integral<A>::value,
CPP>
::type
180 template <
typename A>
181 typename std::enable_if<std::is_integral<A>::value,
CPP>
::type
190 return (
addr() - other.
addr()) /
sizeof(T);
208 operator const T *()
const
210 return buffer ? &
buffer->template asConst<T>() :
nullptr;
217 return buffer->template asConst<T>();
223 return &
buffer->template asConst<T>();
227 template <
typename T,
typename Proxy,
typename A>
228 typename std::enable_if<std::is_integral<A>::value,
235 template <
typename T,
typename Proxy>
245 template <
typename ...Args,
246 typename std::enable_if<std::is_constructible<
247 Proxy, Args&&...>::value,
int>
::type = 0>
249 template <
typename ...Args,
250 typename std::enable_if<std::is_constructible<
251 Proxy, Args&&...>::value,
int>
::type = 0>
254 template <
typename O,
typename Enabled=
255 typename std::enable_if<std::is_assignable<T *, O *>::value>
::type>
259 operator bool()
const {
return (
bool)this->
buffer; }
265 this->
buffer->flush(force);
268 template <
typename A>
269 typename std::enable_if<std::is_integral<A>::value,
PP>
::type
272 return PP(this->
addr() + a *
sizeof(T), this->
proxy);
275 template <
typename A>
276 typename std::enable_if<std::is_integral<A>::value,
PP>
::type
279 return PP(this->
addr() - a *
sizeof(T), this->
proxy);
285 return (this->
addr() - other.
addr()) /
sizeof(T);
303 using CPP::operator
const T *;
306 return this->
buffer ? &this->
buffer->template as<T>() :
nullptr;
309 using CPP::operator *;
314 return this->
buffer->template as<T>();
317 using CPP::operator ->;
322 return &this->
buffer->template as<T>();
326 template <
typename T,
typename Proxy,
typename A>
336 template <
typename ABI,
typename T,
typename Proxy>
346 template <
typename ABI,
typename T,
typename Proxy>
359 template <
typename T,
typename Proxy>
369 template <
typename T>
371 template <
typename T>
374 #endif // __SIM_PROXY_PTR_HH__
ConstProxyPtr(Args &&... args)
std::shared_ptr< Proxy > proxy
ProxyPtr(Addr _ptr, std::shared_ptr< Proxy > _proxy)
std::unique_ptr< uint8_t[]> data
ProxyPtr(Addr _ptr, Args &&... args)
ProxyPtr(Args &&... args)
PP & operator=(const PP &other)
ConstProxyPtr(const ConstProxyPtr< O, Proxy > &other)
ConstProxyPtr(Addr _ptr, std::shared_ptr< Proxy > _proxy)
void flush(bool force=false)
ConstProxyPtr< T, Proxy > CPP
std::shared_ptr< Proxy > proxy
std::enable_if< std::is_integral< A >::value, PP >::type operator-(A a) const
static ProxyPtr< T, Proxy > get(ThreadContext *tc, typename ABI::State &state)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
ProxyPtr(const ProxyPtr< O, Proxy > &other)
std::shared_ptr< ProxyPtrBuffer< Proxy > > buffer
const T * operator->() const
std::enable_if< std::is_integral< A >::value, CPP >::type operator+(A a) const
static ConstProxyPtr< T, Proxy > get(ThreadContext *tc, typename ABI::State &state)
std::enable_if< std::is_integral< A >::value, CPP >::type operator-(A a) const
const T & operator*() const
std::enable_if< std::is_integral< A >::value, ConstProxyPtr< T, Proxy > >::type operator+(A a, const ConstProxyPtr< T, Proxy > &other)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::shared_ptr< Proxy > getProxy() const
void flush(bool force=false)
std::enable_if< std::is_integral< A >::value, PP >::type operator+(A a) const
CPP & operator=(const CPP &other)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Overload hash function for BasicBlockRange type.
void ccprintf(cp::Print &print)
ConstProxyPtr(Addr _ptr, Args &&... args)
const T & asConst() const
ProxyPtrBuffer(std::shared_ptr< Proxy > _proxy, Addr _ptr, size_t _size)
std::ostream & operator<<(std::ostream &os, const ConstProxyPtr< T, Proxy > &vptr)
ProxyPtr(const PP &other)
ConstProxyPtr(const CPP &other)
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17