9 Source::Source(CFStringRef sourceObjectName
, Transform
* destination
, CFStringRef destinationName
) :
10 CoreFoundationObject(sourceObjectName
),
11 mDestination(destination
),
12 mDestinationName(destinationName
)
14 CFStringRef queueName
= CFStringCreateWithFormat(NULL
, NULL
, CFSTR("source:%@"), sourceObjectName
);
15 char *queueName_cstr
= utf8(queueName
);
18 mDispatchQueue
= MyDispatchQueueCreate(queueName_cstr
, NULL
);
19 free((void*)queueName_cstr
);
27 if (mLastValue
!= NULL
)
29 CFRelease(mLastValue
);
32 dispatch_release(mDispatchQueue
);
37 void Source::Activate()
39 dispatch_async(mDispatchQueue
, ^{DoActivate();});
44 void Source::SetValue(CFTypeRef value
)
46 if (value
== mLastValue
)
51 if (mLastValue
!= NULL
) // is there an existing value? If so, release it
53 CFRelease(mLastValue
);
58 mLastValue
= CFRetain(value
);
68 Boolean
Source::Equal(const CoreFoundationObject
* obj
)
70 if (CoreFoundationObject::Equal(obj
))
72 const Source
* objSource
= (const Source
*) obj
;
73 if (objSource
->mDestination
== mDestination
&&
74 CFStringCompare(objSource
->mDestinationName
, mDestinationName
, 0) == kCFCompareEqualTo
)
85 std::string
Source::DebugDescription()
87 string result
= CoreFoundationObject::DebugDescription() + ": Source ";
90 sprintf(buffer
, "(Destination = %p, name = %s)", mDestination
, StringFromCFString(mDestinationName
).c_str());