2 #include "SingleShotSource.h"
7 CFStringRef gSingleShotSourceName
= CFSTR("Single Shot Source");
9 SingleShotSource::SingleShotSource(CFTypeRef value
, Transform
* t
, CFStringRef name
) :
10 Source(gSingleShotSourceName
, t
, name
)
15 void SingleShotSource::DoActivate()
17 // Make sure our destination doesn't vanish while we are sending it data (or the final NULL)
18 CFRetain(mDestination
->GetCFObject());
20 // take our value and send it on its way
21 mDestination
->SetAttribute(mDestinationName
, GetValue());
23 // send an end of stream
24 mDestination
->SetAttribute(mDestinationName
, NULL
);
26 CFRelease(mDestination
->GetCFObject());
31 Boolean
SingleShotSource::Equal(const CoreFoundationObject
* obj
)
33 if (Source::Equal(obj
))
35 const SingleShotSource
* sss
= (const SingleShotSource
*) obj
;
36 return CFEqual(GetValue(), sss
->GetValue());
44 CFTypeRef
SingleShotSource::Make(CFTypeRef value
, Transform
* t
, CFStringRef name
)
46 return CoreFoundationHolder::MakeHolder(gInternalCFObjectName
, new SingleShotSource(value
, t
, name
));
51 std::string
SingleShotSource::DebugDescription()
53 string result
= Source::DebugDescription() + ": SingleShotSource ";
56 snprintf(buffer
, sizeof(buffer
), "(value = %p)", GetValue());