]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/mem/Page.h
1 #ifndef SQUID_IPC_MEM_PAGE_H
2 #define SQUID_IPC_MEM_PAGE_H
12 /// Shared memory page identifier, address, or handler
16 PageId(): pool(0), number(0), purpose(maxPurpose
) {}
18 /// true if and only if both critical components have been initialized
19 bool set() const { return pool
&& number
; }
21 // safer than bool which would enable silent casts to int
22 typedef const uint32_t PageId::*SaferBool
;
23 operator SaferBool() const { return set() ? &PageId::number
: NULL
; }
25 uint32_t pool
; ///< page pool ID within Squid
26 // uint32_t segment; ///< memory segment ID within the pool; unused for now
27 uint32_t number
; ///< page number within the segment
29 enum Purpose
{ cachePage
, ioPage
, maxPurpose
};
30 Purpose purpose
; ///< page purpose
33 /// writes page address (e.g., "sh_page5.3"), for debugging
34 std::ostream
&operator <<(std::ostream
&os
, const PageId
&page
);
40 #endif // SQUID_IPC_MEM_PAGE_H