21 return inOutStr <<
"MasterPort instance " << hex << &inObj << dec <<
" portRef " << hex << inObj.
GetPortRef () << dec <<
" " << (inObj.
IsOkay () ?
"OK" :
"Not OK");
29 IONotificationPortRef masterPortRef (
NULL);
31 assert (masterPortInstance &&
"Must have valid MasterPort instance");
32 if (masterPortInstance)
34 masterPortRef = *masterPortInstance;
35 assert (masterPortRef &&
"Must have valid masterPortRef");
59 if (!outObj->IsOkay ())
62 catch (std::bad_alloc)
70 MasterPort::MasterPort ()
77 mpMasterPort = IONotificationPortCreate (kIOMasterPortDefault);
80 cerr <<
"IONotificationPortCreate returned NULL" << endl;
83 CFRunLoopSourceRef pRunLoopSource (IONotificationPortGetRunLoopSource (mpMasterPort));
86 cerr <<
"IONotificationPortGetRunLoopSource returned NULL" << endl;
89 CFRunLoopAddSource (CFRunLoopGetCurrent (), pRunLoopSource, kCFRunLoopDefaultMode);
98 IONotificationPortDestroy (mpMasterPort);
static IONotificationPortRef Get(void)
I am a reference-counted pointer template class. I am intended to be a proxy for an underlying object...
static MasterPortPtr GetInstance(void)
virtual bool IsOkay(void) const
static MasterPortDestroyer gMasterPortDestroyer
static bool gTerminating(false)
virtual IONotificationPortRef GetPortRef(void) const
static ostream & operator<<(ostream &inOutStr, const MasterPort &inObj)
Declares the MasterPort class.
static MasterPortPtr gMasterPort
virtual ~MasterPortDestroyer()
I sit around waiting for main() to exit(), whereupon I destroy the gMasterPort singleton.