Exemplo n.º 1
0
intrusive_ptr<DocumentSourceFilter> DocumentSourceFilter::create(
    const intrusive_ptr<Expression> &pFilter,
    const intrusive_ptr<ExpressionContext> &pExpCtx) {
    intrusive_ptr<DocumentSourceFilter> pSource(
        new DocumentSourceFilter(pFilter, pExpCtx));
    return pSource;
}
Exemplo n.º 2
0
// If in immediate mode, quickly add a vertex.
// If building an action list, call pSource.
PARTICLEDLL_API void pVertex(float x, float y, float z)
{
	_ParticleState &_ps = _GetPState();

	if(_ps.in_new_list)
	{
		pSource(1, PDPoint, x, y, z);
		return;
	}
	
	// Immediate mode. Quickly add the vertex.
	if(_ps.pgrp == NULL)
		return;
	
	pVector pos(x, y, z);
	pVector siz, vel, col, posB;
	if(_ps.vertexB_tracks)
		posB = pos;
	else
		_ps.VertexB.Generate(posB);
	_ps.Size.Generate(siz);
	_ps.Vel.Generate(vel);
	_ps.Color.Generate(col);
	_ps.pgrp->Add(pos, posB, siz, vel, col, _ps.Alpha, _ps.Age);
}
Exemplo n.º 3
0
    intrusive_ptr<DocumentSourceCursor> DocumentSourceCursor::create(
	const shared_ptr<Cursor> &pCursor) {
	assert(pCursor.get());
	intrusive_ptr<DocumentSourceCursor> pSource(
	    new DocumentSourceCursor(pCursor));
	    return pSource;
    }
Exemplo n.º 4
0
    intrusive_ptr<DocumentSourceOut> DocumentSourceOut::createFromBson(
	BSONElement *pBsonElement) {
	intrusive_ptr<DocumentSourceOut> pSource(
	    new DocumentSourceOut(pBsonElement));

	return pSource;
    }
void lcsMassSourcePluginFunction::doEvaluation()
{
    typedef DimensionedField<scalar,volMesh> dimScalarField;
    autoPtr<dimScalarField> pSrho;

    // pick up the first fitting class
    castAndCall(pSrho,dimScalarField,basicReactingCloud,reactingCloud,Srho());
    castAndCall(pSrho,dimScalarField,basicReactingMultiphaseCloud,reactingMultiphaseCloud,Srho());

    noCloudFound(pSrho);

    const dimScalarField &Srho=pSrho();

    autoPtr<volScalarField> pSource(
        new volScalarField(
            IOobject(
                cloudName()+"MassSource",
                mesh().time().timeName(),
                mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh(),
            Srho.dimensions(),
            "zeroGradient"
        )
    );

    pSource->internalField()=Srho.field();

    result().setObjectResult(pSource);
}
 intrusive_ptr<DocumentSourceCommandFutures>
 DocumentSourceCommandFutures::create(
     string &errmsg, FuturesList *pList) {
     intrusive_ptr<DocumentSourceCommandFutures> pSource(
         new DocumentSourceCommandFutures(errmsg, pList));
     return pSource;
 }
Exemplo n.º 7
0
    void Pipeline::toBson(BSONObjBuilder *pBuilder) const {
        /* create an array out of the pipeline operations */
        BSONArrayBuilder arrayBuilder;
        for(SourceContainer::const_iterator iter(sources.begin()),
                                            listEnd(sources.end());
                                        iter != listEnd;
                                        ++iter) {
            intrusive_ptr<DocumentSource> pSource(*iter);
            pSource->addToBsonArray(&arrayBuilder);
        }

        /* add the top-level items to the command */
        pBuilder->append(commandName, getCollectionName());
        pBuilder->append(pipelineName, arrayBuilder.arr());

        if (explain) {
            pBuilder->append(explainName, explain);
        }

        bool btemp;
        if ((btemp = getSplitMongodPipeline())) {
            pBuilder->append(splitMongodPipelineName, btemp);
        }

        if ((btemp = pCtx->getInRouter())) {
            pBuilder->append(fromRouterName, btemp);
        }
    }
void lcsEnthalpySourcePluginFunction::doEvaluation()
{
    typedef DimensionedField<scalar,volMesh> dimScalarField;
    autoPtr<dimScalarField> pSh;

    // pick up the first fitting class
    castAndCall(pSh,dimScalarField,basicThermoCloud,thermoCloud,hsTrans());
    castAndCall(pSh,dimScalarField,basicReactingCloud,reactingCloud,hsTrans());
    castAndCall(pSh,dimScalarField,basicReactingMultiphaseCloud,reactingMultiphaseCloud,hsTrans());

    noCloudFound(pSh);

    const dimScalarField &Sh=pSh();

    autoPtr<volScalarField> pSource(
        new volScalarField(
            IOobject(
                cloudName()+"EnthalpySource",
                mesh().time().timeName(),
                mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh(),
            Sh.dimensions()/(dimTime*dimVolume),
            "zeroGradient"
        )
    );

    pSource->internalField()=Sh.field()/(mesh().V()*mesh().time().deltaT().value());

    result().setObjectResult(pSource);
}
 intrusive_ptr<DocumentSourceCommandFutures>
 DocumentSourceCommandFutures::create(
     string &errmsg, FuturesList *pList,
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     intrusive_ptr<DocumentSourceCommandFutures> pSource(
         new DocumentSourceCommandFutures(errmsg, pList, pExpCtx));
     return pSource;
 }
Exemplo n.º 10
0
    void Pipeline::writeExplainOps(BSONArrayBuilder *pArrayBuilder) const {
        for(SourceVector::const_iterator iter(sourceVector.begin()),
                listEnd(sourceVector.end()); iter != listEnd; ++iter) {
            intrusive_ptr<DocumentSource> pSource(*iter);

            pSource->addToBsonArray(pArrayBuilder, true);
        }
    }
 intrusive_ptr<DocumentSourceCommandShards>
 DocumentSourceCommandShards::create(
     const ShardOutput& shardOutput,
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     intrusive_ptr<DocumentSourceCommandShards> pSource(
         new DocumentSourceCommandShards(shardOutput, pExpCtx));
     return pSource;
 }
Exemplo n.º 12
0
    intrusive_ptr<DocumentSourceOut> DocumentSourceOut::createFromBson(
        BSONElement *pBsonElement,
        const intrusive_ptr<ExpressionContext> &pExpCtx) {
        intrusive_ptr<DocumentSourceOut> pSource(
            new DocumentSourceOut(pBsonElement, pExpCtx));

        return pSource;
    }
Exemplo n.º 13
0
 intrusive_ptr<DocumentSourceCursor> DocumentSourceCursor::create(
     const shared_ptr<CursorWithContext>& cursorWithContext,
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     verify( cursorWithContext );
     verify( cursorWithContext->_cursor );
     intrusive_ptr<DocumentSourceCursor> pSource(
         new DocumentSourceCursor( cursorWithContext, pExpCtx ) );
     return pSource;
 }
Exemplo n.º 14
0
void CDownloadWithSources::Serialize(CArchive& ar, int nVersion)	// DOWNLOAD_SER_VERSION
{
	CDownloadBase::Serialize( ar, nVersion );

	CQuickLock pLock( Transfers.m_pSection );

	if ( ar.IsStoring() )
	{
		DWORD_PTR nSources = GetCount();
		if ( nSources > Settings.Downloads.SourcesWanted )
			nSources = Settings.Downloads.SourcesWanted;
		ar.WriteCount( nSources );

		for ( POSITION posSource = GetIterator() ; posSource && nSources ; nSources-- )
		{
			CDownloadSource* pSource = GetNext( posSource );

			pSource->Serialize( ar, nVersion );
		}

		ar.WriteCount( m_pXML != NULL ? 1 : 0 );
		if ( m_pXML ) m_pXML->Serialize( ar );
	}
	else // Loading
	{
		for ( DWORD_PTR nSources = ar.ReadCount() ; nSources ; nSources-- )
		{
			// Create new source
			//CDownloadSource* pSource = new CDownloadSource( (CDownload*)this );
			CAutoPtr< CDownloadSource > pSource( new CDownloadSource( static_cast< CDownload* >( this ) ) );
			if ( ! pSource )
				AfxThrowMemoryException();

			// Load details from disk
			pSource->Serialize( ar, nVersion );

			// Extract ed2k client ID from url (m_pAddress) because it wasn't saved
			if ( ! pSource->m_nPort && _tcsnicmp( pSource->m_sURL, _T("ed2kftp://"), 10 ) == 0 )
			{
				CString strURL = pSource->m_sURL.Mid(10);
				if ( ! strURL.IsEmpty() )
					_stscanf( strURL, _T("%lu"), &pSource->m_pAddress.S_un.S_addr );
			}

			InternalAdd( pSource.Detach() );
		}

		if ( ar.ReadCount() )
		{
			m_pXML = new CXMLElement();
			if ( ! m_pXML )
				AfxThrowMemoryException();

			m_pXML->Serialize( ar );
		}
	}
}
 intrusive_ptr<DocumentSourceCursor> DocumentSourceCursor::create(
     const shared_ptr<Cursor> &pCursor,
     const string &ns,
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     verify(pCursor.get());
     intrusive_ptr<DocumentSourceCursor> pSource(
         new DocumentSourceCursor(pCursor, ns, pExpCtx));
         return pSource;
 }
Exemplo n.º 16
0
    intrusive_ptr<DocumentSourceBsonArray> DocumentSourceBsonArray::create(
        BSONElement *pBsonElement,
        const intrusive_ptr<ExpressionContext> &pExpCtx) {

        verify(pBsonElement->type() == Array);
        intrusive_ptr<DocumentSourceBsonArray> pSource(
            new DocumentSourceBsonArray(pBsonElement, pExpCtx));

        return pSource;
    }
Exemplo n.º 17
0
    bool PipelineCommand::runExecute(
        BSONObjBuilder &result, string &errmsg,
        const string &ns, const string &db,
        intrusive_ptr<Pipeline> &pPipeline,
        intrusive_ptr<ExpressionContext> &pCtx) {

        // The DocumentSourceCursor manages a read lock internally, see SERVER-6123.
        intrusive_ptr<DocumentSourceCursor> pSource(
            PipelineD::prepareCursorSource(pPipeline, db, pCtx));
        return executePipeline(result, errmsg, ns, pPipeline, pSource, pCtx);
    }
void lcsSpeciesSourcePluginFunction::doEvaluation()
{
    wordList speciesList;
    label speciesIndex=getIndex(speciesList);

    if(speciesList.size()==0) {
        listAvailableClouds(Info);
        FatalErrorIn("lcsSpeciesSourcePluginFunction::doEvaluation()")
            << "No species list found (probably wrong cloud type)"
                << endl
                << "Supported cloud types (typeid): "                   \
                << supportedTypes() << endl                             \
                << exit(FatalError);
    }

    if(speciesIndex<0) {
        listAvailableClouds(Info);
        FatalErrorIn("lcsSpeciesSourcePluginFunction::doEvaluation()")
            << "Species " << speciesName_ << " not found in gas composition "
                << speciesList
                << endl
                << "Supported cloud types (typeid): "                   \
                << supportedTypes() << endl                             \
                << exit(FatalError);

    }

    autoPtr<dimScalarField> pSrho=internalEvaluate(speciesIndex);;

    noCloudFound(pSrho);

    const dimScalarField &Srho=pSrho();

    autoPtr<volScalarField> pSource(
        new volScalarField(
            IOobject(
                cloudName()+"SpeciesSource",
                mesh().time().timeName(),
                mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            mesh(),
            Srho.dimensions(),
            "zeroGradient"
        )
    );

    pSource->internalField()=Srho.field();

    result().setObjectResult(pSource);
}
Exemplo n.º 19
0
    void Pipeline::writeExplainOps(BSONArrayBuilder *pArrayBuilder) const {
        for(SourceContainer::const_iterator iter(sources.begin()),
                                            listEnd(sources.end());
                                        iter != listEnd;
                                        ++iter) {
            intrusive_ptr<DocumentSource> pSource(*iter);

            // handled in writeExplainMongos
            if (dynamic_cast<DocumentSourceBsonArray*>(pSource.get()))
                continue;

            pSource->addToBsonArray(pArrayBuilder, true);
        }
    }
Exemplo n.º 20
0
bool CPDF_Type3Char::LoadBitmap(CPDF_RenderContext* pContext) {
  if (m_pBitmap || !m_pForm)
    return true;

  if (m_pForm->GetPageObjectList()->size() != 1 || m_bColored)
    return false;

  auto& pPageObj = m_pForm->GetPageObjectList()->front();
  if (!pPageObj->IsImage())
    return false;

  m_ImageMatrix = pPageObj->AsImage()->m_Matrix;
  std::unique_ptr<CFX_DIBSource> pSource(
      pPageObj->AsImage()->GetImage()->LoadDIBSource());
  if (pSource)
    m_pBitmap.reset(pSource->Clone());
  m_pForm.reset();
  return true;
}
Exemplo n.º 21
0
    intrusive_ptr<DocumentSourceGroup> DocumentSourceGroup::create(
	const intrusive_ptr<ExpressionContext> &pCtx) {
        intrusive_ptr<DocumentSourceGroup> pSource(
            new DocumentSourceGroup(pCtx));
        return pSource;
    }
Exemplo n.º 22
0
 intrusive_ptr<DocumentSourceProject> DocumentSourceProject::create() {
     intrusive_ptr<DocumentSourceProject> pSource(
         new DocumentSourceProject());
     return pSource;
 }
Exemplo n.º 23
0
 intrusive_ptr<DocumentSourceSort> DocumentSourceSort::create(
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     intrusive_ptr<DocumentSourceSort> pSource(
         new DocumentSourceSort(pExpCtx));
     return pSource;
 }
Exemplo n.º 24
0
 intrusive_ptr<DocumentSourceUnwind> DocumentSourceUnwind::create(
     const intrusive_ptr<ExpressionContext> &pExpCtx) {
     intrusive_ptr<DocumentSourceUnwind> pSource(
         new DocumentSourceUnwind(pExpCtx));
     return pSource;
 }