int mitk::BaseData::GetExternalReferenceCount() const { if(m_CalculatingExternalReferenceCount==false) //this is only needed because a smart-pointer to m_Outputs (private!!) must be created by calling GetOutputs. { m_CalculatingExternalReferenceCount = true; m_ExternalReferenceCount = -1; int realReferenceCount = GetReferenceCount(); if(GetSource().IsNull()) { m_ExternalReferenceCount = realReferenceCount; m_CalculatingExternalReferenceCount = false; return m_ExternalReferenceCount; } mitk::BaseProcess::DataObjectPointerArray outputs = m_SmartSourcePointer->GetOutputs(); unsigned int idx; for (idx = 0; idx < outputs.size(); ++idx) { //references of outputs that are not referenced from someone else (reference additional to the reference from this BaseProcess object) are interpreted as non-existent if(outputs[idx]==this) --realReferenceCount; } m_ExternalReferenceCount = realReferenceCount; if(m_ExternalReferenceCount<0) m_ExternalReferenceCount=0; m_CalculatingExternalReferenceCount = false; } else return -1; return m_ExternalReferenceCount; }
DataItem& DataItem::CreateAndInsert(ItemPointer ptr) { auto x = RawItem::Get<Header>(ptr); auto& ret = x.ritem.SplitCreate<DataItem>( ptr.offset, x.t, x.ritem.GetSize() - ptr.offset - sizeof(Header)); if (x.t.length > 0) ret.MoveNextToChild(x.t.length); NEPTOOLS_ASSERT(ret.GetSize() == sizeof(Header) + x.t.length); // hack if (!ret.GetChildren().empty()) { auto child = dynamic_cast<RawItem*>(&ret.GetChildren().front()); if (child && child->GetSize() > sizeof(Gbnl::Header)) { char buf[4]; child->GetSource().Pread(child->GetSize() - sizeof(Gbnl::Header), buf, 4); if (memcmp(buf, "GBNL", 4) == 0) GbnlItem::CreateAndInsert({child, 0}); } } return ret; }
void LoopingSound::InternalUpdate() { if (fadingOut and GetCurrentGain() == 0.0f) { Stop(); } if (not fadingOut) { if (leadingSample) { if (GetSource().IsStopped()) { SetupLoopingSound(GetSource()); GetSource().Play(); leadingSample = nullptr; } } SetSoundGain(effectsVolume.Get()); } }
void HostileReference::updateOnlineStatus() { bool online = false; if (!isValid()) if (Unit* target = ObjectAccessor::GetUnit(*GetSourceUnit(), getUnitGuid())) link(target, GetSource()); // only check for online status if // ref is valid // target is no player or not gamemaster // target is not in flight if (isValid() && (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->IsGameMaster()) && !getTarget()->IsInFlight() && getTarget()->IsInMap(GetSourceUnit()) && getTarget()->InSamePhase(GetSourceUnit()) ) { Creature* creature = GetSourceUnit()->ToCreature(); online = getTarget()->isInAccessiblePlaceFor(creature); if (!online) { if (creature->IsWithinCombatRange(getTarget(), creature->m_CombatDistance)) online = true; // not accessible but stays online } } setOnlineOfflineState(online); }
void RegexPattern::Finalize(bool isShutdown) { if(isShutdown) return; const auto scriptContext = GetScriptContext(); if(!scriptContext) return; #if DBG if(!isLiteral && !scriptContext->IsClosed()) { const auto source = GetSource(); RegexPattern *p; Assert( !GetScriptContext()->GetDynamicRegexMap()->TryGetValue( RegexKey(source.GetBuffer(), source.GetLength(), GetFlags()), &p) || p != this); } #endif if(isShallowClone) return; rep.unified.program->FreeBody(scriptContext->RegexAllocator()); }
void OneShotSound::InternalUpdate() { if (GetSource().IsStopped()) { Stop(); return; } SetSoundGain(effectsVolume.Get()); }
Rect Image::GetCoverageBounds () { // FIXME: SL3 final only supports PixelFormatPbgra32 which makes this optimization // obsolete - unless we keep an "has_alpha" flag with each image ?!? return Rect (); #if FALSE ImageSource *source = GetSource (); if (!source || source->GetPixelFormat () == PixelFormatPbgra32) return Rect (); Stretch stretch = GetStretch (); if (stretch == StretchFill || stretch == StretchUniformToFill) return bounds; cairo_matrix_t matrix; Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ()); Rect paint = Rect (0, 0, GetActualWidth (), GetActualHeight ()); image_brush_compute_pattern_matrix (&matrix, paint.width, paint.height, image.width, image.height, stretch, AlignmentXCenter, AlignmentYCenter, NULL, NULL); cairo_matrix_invert (&matrix); cairo_matrix_multiply (&matrix, &matrix, &absolute_xform); image = image.Transform (&matrix); image = image.Intersection (bounds); return image; #endif }
void MediaBase::SetAllowDownloads (bool allow) { const char *uri; Downloader *dl; if ((allow_downloads && allow) || (!allow_downloads && !allow)) return; if (allow && IsAttached () && source_changed) { source_changed = false; if ((uri = GetSource ()) && *uri) { if (!(dl = GetDeployment ()->CreateDownloader ())) { // we're shutting down return; } dl->Open ("GET", uri, GetDownloaderPolicy (uri)); SetSource (dl, ""); dl->unref (); } } allow_downloads = allow; }
void Image::ImageFailed (ImageErrorEventArgs *args) { BitmapSource *source = (BitmapSource*) GetSource (); if (source->Is (Type::BITMAPIMAGE)) { source->RemoveHandler (BitmapImage::DownloadProgressEvent, download_progress, this); source->RemoveHandler (BitmapImage::ImageOpenedEvent, image_opened, this); source->RemoveHandler (BitmapImage::ImageFailedEvent, image_failed, this); } source->RemoveHandler (BitmapSource::PixelDataChangedEvent, source_pixel_data_changed, this); InvalidateArrange (); InvalidateMeasure (); UpdateBounds (); Invalidate (); args = new ImageErrorEventArgs (this, *(MoonError*)args->GetMoonError ()); if (HasHandlers (ImageFailedEvent)) { Emit (ImageFailedEvent, args); } else { GetDeployment ()->GetSurface ()->EmitError (args); } }
/** * \brief Returns the source. * * \return The source as CString. */ CString CBibList::GetSource() { xString* src = xsNew(); GetSource(src); CString res = CString(xsValue(src)); xsDelete(src); return res; }
virtual std::vector<unsigned int> EnumImageProperties() const override { cdHSource hSource = GetSource(); ImagePropertyAccess p(hSource); return p.EnumImageProperties(); }
void Image::DownloadProgress () { BitmapImage *source = (BitmapImage *) GetSource (); SetDownloadProgress (source->GetProgress ()); Emit (DownloadProgressChangedEvent); }
/* virtual */ NS_IMETHODIMP TVSourceListener::NotifyChannelScanStopped(const nsAString& aTunerId, const nsAString& aSourceType) { RefPtr<TVSource> source = GetSource(aTunerId, aSourceType); source->NotifyChannelScanStopped(); return NS_OK; }
int I_SoundIsPlaying(int handle) { sndsource_t *src = GetSource(handle); if(!initOk || !src) return false; if(src->source == NULL) return false; return I2_IsSourcePlaying(src); }
//------------------------------------------------------------------------------ bool CBOMRecognizerFilter::Read( unsigned long& ulUnitsRead, unsigned long ulUnitsToRead ) { bool bResult = false; //Switch on whether recognition has taken place if( m_bRecognized ) { bResult = GetSource()->Read( ulUnitsRead, ulUnitsToRead ); } else { bResult = GetSource()->Read( ulUnitsRead, sculBOMBytes ); RecognizeBOM(); } return bResult; }
void CField::SaveToFile(CFile *file) { if (!m_Value.IsEmpty()) { xString* str = xsNew(); GetSource(str); file->Write(xsValue(str), xsLen(str)); xsDelete(str); } }
void RadioBearer::Enqueue (Packet *packet) { #ifdef TEST_ENQUEUE_PACKETS std::cout << "Enqueue packet on " << GetSource ()->GetIDNetworkNode () << std::endl; #endif GetMacQueue ()->Enqueue(packet); }
void* mitk::Image::GetData() { if(m_Initialized==false) { if(GetSource().IsNull()) return NULL; if(GetSource()->Updating()==false) GetSource()->UpdateOutputInformation(); } m_CompleteData=GetChannelData(); // update channel's data // if data was not available at creation point, the m_Data of channel descriptor is NULL // if data present, it won't be overwritten m_ImageDescriptor->GetChannelDescriptor(0).SetData(m_CompleteData->GetData()); return m_CompleteData->GetData(); }
int WAVEFILE::Read(void* lpDest, DWORD dwBytes) { if (dwAccess != WAVE_OPEN_READ) return WAVE_READ_ERROR; DWORD dwRead=GetSource()->Read(lpDest,dwBytes); dwCurrentPos+=dwRead; return dwRead; }
void Image::Dispose () { BitmapSource *source = (BitmapSource*)GetSource (); if (source) source->RemoveAllHandlers (this); MediaBase::Dispose (); }
void I_Update3DSound(int handle, sound3d_t *desc) { sndsource_t *buf = GetSource(handle); if(!initOk || !buf) return; if(buf->source == NULL) return; if(buf->source3D == NULL) return; if(!I2_IsSourcePlaying(buf)) IDirectSoundBuffer_Play(buf->source, 0, 0, 0); I2_UpdateSource(buf, desc); }
wxString InputPort::GetType() const { OutputPort *output = GetSource(); if (output != NULL) { return output->GetType(); } return wxT("?"); }
wxString edbPackageProcedure::GetSql(ctlTree *browser) { if (sql.IsNull()) { sql = wxT("-- Package Procedure: ") + GetName() + wxT("\n\n"); sql += GetSource() + wxT("\n\n"); } return sql; }
// update void SpatialChannel::DoUpdate3() { const phys::Sound *sound(GetSound()); assert(sound); alSourcefv(GetSource(), AL_POSITION, &*math::Vector<3, ALfloat>(sound->GetPosition()).begin()); // FIXME: waiting for implementation /*alSourcefv(GetSource(), AL_VELOCITY, &*math::Vector<3, ALfloat>(sound->GetVelocity()).begin()); alSourcefv(GetSource(), AL_DIRECTION, &*math::Vector<3, ALfloat>( math::NormVector<3>() * sound->GetOrientation()).begin());*/ }
vtkUnstructuredGrid* mitk::UnstructuredGrid::GetVtkUnstructuredGrid(unsigned int t) { if ( t < m_GridSeries.size() ) { vtkUnstructuredGrid* grid = m_GridSeries[ t ]; if((grid == 0) && (GetSource().GetPointer() != 0)) { RegionType requestedregion; requestedregion.SetIndex(3, t); requestedregion.SetSize(3, 1); SetRequestedRegion(&requestedregion); GetSource()->Update(); } grid = m_GridSeries[ t ]; return grid; } else return 0; }
HRESULT CSinaSvr::CheckLoginStatus(CString URL) { if(m_ActionStatus != SINA_LOGINING) return S_FALSE; /* check login pwd //http://login.sina.com.cn/sso/login.php */ long ulen = 0; IHTMLDocument3 *pDoc3 = GetDocument3(); HRESULT hr = E_FAIL; if (URL.Find(_T("http://login.sina.com.cn/sso/login.php"),0) >= 0) { CComBSTR strName = _T("retcode"); CComQIPtr<IHTMLElementCollection> i_Collect; CComQIPtr<IDispatch> i_Dispath; CComQIPtr<IHTMLInputElement> iInput; pDoc3->getElementsByName(strName,&i_Collect); i_Collect->get_length(&ulen); for (long i=0;i<ulen;i++){ i_Dispath = getElementInCollection(i_Collect,i); hr = i_Dispath-> QueryInterface(IID_IHTMLInputElement,(void **)&iInput); CComBSTR str; iInput->get_value(&str); m_ActionStatus = SINA_PWD_ERROR; return S_OK; } } pDoc3->Release(); //http://weibo.com/signup/full_info.php?uid=2452258262&type=2&r=/2452258262 not regist for weibo. if (URL.Find(_T("http://weibo.com/signup/full_info.php?uid="),0) >= 0) { m_ActionStatus = SINA_NO_WEIBO; return S_OK; } CString strHtml; IHTMLDocument2 *pDoc = GetDocument(); GetCookie(pDoc,m_strCookie); GetSource(pDoc,strHtml); pDoc->Release(); FILE *f = _tfopen(_T("cookie.txt"),_T("w")); fwrite(m_strCookie.GetBuffer(),1,m_strCookie.GetLength()*2,f); fclose(f); f = _tfopen(_T("html.txt"),_T("w")); fwrite(strHtml.GetBuffer(),1,strHtml.GetLength(),f); fclose(f); return S_OK; }
mitk::ImageVtkAccessor* mitk::Image::GetVtkImageData(int t, int n) { if(m_Initialized==false) { if(GetSource().IsNull()) return NULL; if(GetSource()->Updating()==false) GetSource()->UpdateOutputInformation(); } ImageDataItemPointer volume=GetVolumeData(t, n); if(volume.GetPointer()==NULL || volume->GetVtkImageData(this) == NULL) return NULL; SlicedGeometry3D* geom3d = GetSlicedGeometry(t); float *fspacing = const_cast<float *>(geom3d->GetFloatSpacing()); double dspacing[3] = {fspacing[0],fspacing[1],fspacing[2]}; volume->GetVtkImageData(this)->SetSpacing( dspacing ); return volume->GetVtkImageData(this); }
/* virtual */ NS_IMETHODIMP TVSourceListener::NotifyEITBroadcasted(const nsAString& aTunerId, const nsAString& aSourceType, nsITVChannelData* aChannelData, nsITVProgramData** aProgramDataList, const uint32_t aCount) { RefPtr<TVSource> source = GetSource(aTunerId, aSourceType); source->NotifyEITBroadcasted(aChannelData, aProgramDataList, aCount); return NS_OK; }
void I_StopSound(int handle) { sndsource_t *buf = GetSource(handle); if(!initOk || !buf) return; if(buf->source) { IDirectSoundBuffer_Stop(buf->source); IDirectSoundBuffer_SetCurrentPosition(buf->source, 0); } }
std::shared_ptr<MediaStreamTrack> MediaStreamTrack::Clone(const std::shared_ptr<RtcPeerConnectionFactory> & factory) { std::shared_ptr<MediaStreamTrack> track = nullptr; if (!track) { auto inner_audio_track = this->inner_audio_track(); if (inner_audio_track) { track = factory->CreateAudioTrack(label(), inner_audio_track->GetSource(), remote()); } } if (!track) { auto inner_video_track = this->inner_video_track(); if (inner_video_track) { track = factory->CreateVideoTrack(label(), inner_video_track->GetSource(), remote()); } } track->set_enabled(enabled()); track->inner_track().set_state(inner_track().state()); return track; }