#include "DADissenter.h"
#include "DAInternal.h"
#include <unistd.h>
DADissenterRef DADissenterCreate( CFAllocatorRef allocator, DAReturn status, CFStringRef string )
{
CFMutableDictionaryRef dissenter;
dissenter = CFDictionaryCreateMutable( allocator, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks );
if ( dissenter )
{
___CFDictionarySetIntegerValue( dissenter, _kDADissenterProcessIDKey, getpid( ) );
___CFDictionarySetIntegerValue( dissenter, _kDADissenterStatusKey, status );
if ( string )
{
CFDictionarySetValue( dissenter, _kDADissenterStatusStringKey, string );
}
}
return ( void * ) dissenter;
}
pid_t DADissenterGetProcessID( DADissenterRef dissenter )
{
return ___CFDictionaryGetIntegerValue( ( void * ) dissenter, _kDADissenterProcessIDKey );
}
DAReturn DADissenterGetStatus( DADissenterRef dissenter )
{
return ___CFDictionaryGetIntegerValue( ( void * ) dissenter, _kDADissenterStatusKey );
}
CFStringRef DADissenterGetStatusString( DADissenterRef dissenter )
{
return CFDictionaryGetValue( ( void * ) dissenter, _kDADissenterStatusStringKey );
}