8 #ifndef NTCORE_HANDLE_H_ 9 #define NTCORE_HANDLE_H_ 23 kConnectionListener = 1,
24 kConnectionListenerPoller,
34 enum { kIndexMax = 0xfffff };
36 explicit Handle(NT_Handle handle) : m_handle(handle) {}
37 operator NT_Handle()
const {
return m_handle; }
39 NT_Handle handle()
const {
return m_handle; }
41 Handle(
int inst,
int index, Type type) {
42 if (inst < 0 || index < 0) {
46 m_handle = ((
static_cast<int>(type) & 0xf) << 27) | ((inst & 0x7f) << 20) |
50 int GetIndex()
const {
return static_cast<int>(m_handle) & 0xfffff; }
51 Type GetType()
const {
52 return static_cast<Type
>((
static_cast<int>(m_handle) >> 27) & 0xf);
54 int GetInst()
const {
return (static_cast<int>(m_handle) >> 20) & 0x7f; }
55 bool IsType(Type type)
const {
return type == GetType(); }
56 int GetTypedIndex(Type type)
const {
return IsType(type) ? GetIndex() : -1; }
57 int GetTypedInst(Type type)
const {
return IsType(type) ? GetInst() : -1; }
65 #endif // NTCORE_HANDLE_H_
Definition: IEntryNotifier.h:16