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
);
20 CFReleaseNull(queueName
);
27 if (mLastValue
!= NULL
)
29 CFReleaseNull(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 // is there an existing value? If so, release it
52 CFReleaseNull(mLastValue
);
54 mLastValue
= CFRetainSafe(value
);
59 Boolean
Source::Equal(const CoreFoundationObject
* obj
)
61 if (CoreFoundationObject::Equal(obj
))
63 const Source
* objSource
= (const Source
*) obj
;
64 if (objSource
->mDestination
== mDestination
&&
65 CFStringCompare(objSource
->mDestinationName
, mDestinationName
, 0) == kCFCompareEqualTo
)
76 std::string
Source::DebugDescription()
78 string result
= CoreFoundationObject::DebugDescription() + ": Source ";
81 sprintf(buffer
, "(Destination = %p, name = %s)", mDestination
, StringFromCFString(mDestinationName
).c_str());