2 #include "SingleShotSource.h"
8 CFStringRef gSingleShotSourceName
= CFSTR("Single Shot Source");
10 SingleShotSource::SingleShotSource(CFTypeRef value
, Transform
* t
, CFStringRef name
) :
11 Source(gSingleShotSourceName
, t
, name
)
16 void SingleShotSource::DoActivate()
18 // Make sure our destination doesn't vanish while we are sending it data (or the final NULL)
19 CFRetainSafe(mDestination
->GetCFObject());
21 // take our value and send it on its way
22 mDestination
->SetAttribute(mDestinationName
, GetValue());
24 // send an end of stream
25 mDestination
->SetAttribute(mDestinationName
, NULL
);
27 CFReleaseSafe(mDestination
->GetCFObject());
32 Boolean
SingleShotSource::Equal(const CoreFoundationObject
* obj
)
34 if (Source::Equal(obj
))
36 const SingleShotSource
* sss
= (const SingleShotSource
*) obj
;
37 return CFEqual(GetValue(), sss
->GetValue());
45 CFTypeRef
SingleShotSource::Make(CFTypeRef value
, Transform
* t
, CFStringRef name
)
47 return CoreFoundationHolder::MakeHolder(gInternalCFObjectName
, new SingleShotSource(value
, t
, name
));
52 std::string
SingleShotSource::DebugDescription()
54 string result
= Source::DebugDescription() + ": SingleShotSource ";
57 snprintf(buffer
, sizeof(buffer
), "(value = %p)", GetValue());