当前位置: 首页>>代码示例>>C++>>正文


C++ DataPtr类代码示例

本文整理汇总了C++中DataPtr的典型用法代码示例。如果您正苦于以下问题:C++ DataPtr类的具体用法?C++ DataPtr怎么用?C++ DataPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DataPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Visit

void Composite::Visit(void* instance, Visitor& visitor) const
{
    if (!instance)
    {
        return;
    }

    DynArray< Field >::ConstIterator itr = m_Fields.Begin();
    DynArray< Field >::ConstIterator end = m_Fields.End();
    for ( ; itr != end; ++itr )
    {
        const Field* field = &*itr;

        if ( !visitor.VisitField( instance, field ) )
        {
            continue;
        }

        DataPtr data = field->CreateData();

        data->ConnectField( instance, field );

        data->Accept( visitor );

        data->Disconnect();
    }
}
开发者ID:,项目名称:,代码行数:27,代码来源:

示例2:

std::vector<Vector3D> CustomMetric::getPointCloud() const
{
	std::vector<Vector3D> retval;

	DataPtr model = this->getModel();

	std::vector<Transform3D> pos = this->calculateOrientations();
	std::vector<Vector3D> cloud;
	Transform3D rrMd;

	if (model)
	{
		rrMd = model->get_rMd();
		cloud = model->getPointCloud();
	}
	else
	{
		cloud.push_back(Vector3D::Zero());
		rrMd = Transform3D::Identity();
	}

	for (unsigned i=0; i<pos.size(); ++i)
	{
		Transform3D rMd = pos[i] * rrMd;

		for (unsigned j=0; j<cloud.size(); ++j)
		{
			Vector3D p_r = rMd.coord(cloud[j]);
			retval.push_back(p_r);
		}
	}

	return retval;
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:34,代码来源:cxCustomMetric.cpp

示例3: testData

void testData()
{

    DataPtr dun = Data::create("hello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-worldhello-world");
    log(dun->toString());

    DataPtr d = ZLib::compress(dun);


    DataPtr base64 = Base64::encode(d);
    if(base64)
    {
        log(base64->toString());

        DataPtr dec = Base64::decode(base64);
        log(ZLib::decompress(dec)->toString());
        std::string dec_string = base64->toString();

        if(dec)
            log(dec_string);

        dec_string[2] = '*';

        DataPtr dec2 = Base64::decode(Data::create(dec_string));
        if(dec2)
            log("Dec ok");
        else
            log("Dec failed");

    }

}
开发者ID:seagullua,项目名称:free-wifi,代码行数:32,代码来源:Test.cpp

示例4: testEncryption

void testEncryption()
{
    std::string plain_text = "The rooster crows at midnight!";
    std::string key = "A16ByteKey......";

    DataPtr iv = Data::create("IV6ByteKey......");
    Data::ByteArr& iv_raw = iv->getRawData();

    //iv_raw.resize(Protect::IV_SIZE, 0);

    DataPtr enc = Protect::encodeIV(Data::create(plain_text),
                                    Data::create(key),
                                    iv);
    DataPtr enc2 = Protect::encode(Data::create(plain_text),
                                   Data::create(key));

    log("Enc: "+Base64::encode(enc)->toString());
    log("Enc2: "+Base64::encode(enc2)->toString());

    DataPtr dec = Protect::decodeIV(enc, Data::create(key), iv);
    DataPtr dec2 = Protect::decode(enc2, Data::create(key));
    log("Dec: "+dec->toString());
    log("Dec2: "+dec2->toString());


}
开发者ID:seagullua,项目名称:free-wifi,代码行数:26,代码来源:Test.cpp

示例5: accuracy

void    ManualImage2ImageRegistrationWidget::updateAverageAccuracyLabel()
{
    QString fixedName;
    QString movingName;
    DataPtr fixedData = boost::dynamic_pointer_cast<Data>(mServices->registration()->getFixedData());
    DataPtr movingData = boost::dynamic_pointer_cast<Data>(mServices->registration()->getMovingData());
    if (fixedData)
        fixedName = fixedData->getName();
    if (movingData)
        movingName = movingData->getName();

    int numberOfActiveLandmarks = 0;
    if(this->isAverageAccuracyValid(numberOfActiveLandmarks))
    {
        mAvarageAccuracyLabel->setText(tr("Root mean square accuracy (Landmarks) %1 mm, calculated in %2 landmarks").
                                       arg(this->getAverageAccuracy(numberOfActiveLandmarks), 0, 'f', 2).arg(numberOfActiveLandmarks));
        mAvarageAccuracyLabel->setToolTip(QString("Root Mean Square landmark accuracy from target [%1] to fixed [%2].").
                                          arg(movingName).arg(fixedName));
    }
    else
    {
        mAvarageAccuracyLabel->setText(" ");
        mAvarageAccuracyLabel->setToolTip("");
    }
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:25,代码来源:cxManualImage2ImageRegistrationWidget.cpp

示例6: QCOMPARE

void TestSharedPtr::testSharedPtrDict()
{
    QHash<DataPtr, int> dict;
    DataPtr nullPtr = Data::createNull();
    dict[nullPtr] = 1;
    QCOMPARE(dict.size(), 1);
    QCOMPARE(dict[nullPtr], 1);

    DataPtr validPtr1 = Data::create();
    QCOMPARE(qHash(validPtr1.data()), qHash(validPtr1));
    dict[validPtr1] = 2;
    QCOMPARE(dict.size(), 2);
    QCOMPARE(dict[nullPtr], 1);
    QCOMPARE(dict[validPtr1], 2);

    DataPtr validPtr2 = validPtr1;
    QCOMPARE(validPtr1.data(), validPtr2.data());
    QCOMPARE(qHash(validPtr1), qHash(validPtr2));
    dict[validPtr2] = 3;
    QCOMPARE(dict.size(), 2);
    QCOMPARE(dict[nullPtr], 1);
    QCOMPARE(dict[validPtr1], 3);
    QCOMPARE(dict[validPtr2], 3);

    DataPtr validPtrAlternative = Data::create();
    QVERIFY(validPtr1.data() != validPtrAlternative.data());
    QVERIFY(validPtr1 != validPtrAlternative);
    QVERIFY(qHash(validPtr1) != qHash(validPtrAlternative));
    dict[validPtrAlternative] = 4;
    QCOMPARE(dict.size(), 3);
    QCOMPARE(dict[nullPtr], 1);
    QCOMPARE(dict[validPtr1], 3);
    QCOMPARE(dict[validPtr2], 3);
    QCOMPARE(dict[validPtrAlternative], 4);
}
开发者ID:TelepathyQt,项目名称:telepathy-qt,代码行数:35,代码来源:ptr.cpp

示例7: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(manyReferenceTimesAndValidTimesCreatesTimeOffsetVariable, TimeHandlerFixture)
{
	add("2011-05-29 00:00:00", "2011-05-29 00:00:00");
	add("2011-05-30 00:00:00", "2011-05-29 00:00:00");
	add("2011-05-30 00:00:00", "2011-05-30 00:00:00");
	add("2011-05-31 00:00:00", "2011-05-30 00:00:00");

	WdbIndex index(gridData());
	TimeHandler timeHandler(index);
	timeHandler.addToCdm(cdm);

	const CDMVariable & offsetVar = cdm.getVariable(TimeHandler::timeOffsetName);
	DataPtr d = timeHandler.getData(offsetVar, 0);
	BOOST_REQUIRE_EQUAL(2, d->size());
	boost::shared_array<double> array = d->asDouble();
	BOOST_CHECK_EQUAL(0, array[0]);
	BOOST_CHECK_EQUAL(24*60*60, array[1]);

	const std::vector<std::string> & shape = offsetVar.getShape();
	BOOST_REQUIRE_EQUAL(1, shape.size());
	BOOST_CHECK_EQUAL(TimeHandler::timeOffsetName, shape[0]);

	CHECK_ATTRIBUTE(TimeHandler::timeOffsetName, "long_name", "offset since referenceTime");
	CHECK_ATTRIBUTE(TimeHandler::timeOffsetName, "units", "seconds");

	const CDMDimension & dim = cdm.getDimension(TimeHandler::timeOffsetName);
	BOOST_CHECK_EQUAL(2, dim.getLength());
}
开发者ID:GEO-IASS,项目名称:fimex,代码行数:28,代码来源:TimeHandlerTest.cpp

示例8: writeStateText

	void SkinExportSerializer::writeStateText(pugi::xml_node _parent, DataPtr _data, const MyGUI::IntCoord& _value)
	{
		pugi::xml_node node = _parent.append_child("State");
		node.append_attribute("name").set_value(convertEditorToExportStateName(_data->getPropertyValue("Name")).c_str());
		node.append_attribute("colour").set_value(_data->getPropertyValue("TextColour").c_str());
		node.append_attribute("shift").set_value(_data->getPropertyValue("TextShift").c_str());
	}
开发者ID:xzwang2005,项目名称:mygui,代码行数:7,代码来源:SkinExportSerializer.cpp

示例9: ZENIC_WARNING

Serializable* ExporterBackend::buildTexture(CSLImage* image, CSIBCPixMap& pixMap)
{
	uint depth = pixMap.GetTotalPixelDepthByte();

	// We only handly 32 bit and 24bit textures right now

	if (depth != 4 && depth != 3)
	{
		ZENIC_WARNING("Unsupported pixeldepth (" << pixMap.GetTotalPixelDepthByte() << ") for texture " << image->GetSourceFile() <<
					 "skipping");
		return 0;
	}

	Texture* texture = zenic_new Texture;
	TextureData* textureData = zenic_new TextureData;

	textureData->setWidth(u16(pixMap.GetWidth()));
	textureData->setHeight(u16(pixMap.GetHeight()));
	textureData->setFlags(TextureData::RGB);

	DataPtr<u8> imageData;

	uint imageSize = pixMap.GetWidth() * pixMap.GetHeight() * depth;

	imageData.allocate(imageSize);
	memcpy(imageData.objects(), pixMap.GetMap(), imageSize);

	textureData->setImageData(imageData);
	texture->setData(textureData);

	return texture;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例10: doPatientRegistration

void RegistrationImplService::doPatientRegistration()
{
	DataPtr fixedImage = this->getFixedData();

	if(!fixedImage)
	{
	reportError("The fixed data is not set, cannot do patient registration!");
		return;
	}
	LandmarkMap fixedLandmarks = fixedImage->getLandmarks()->getLandmarks();
	LandmarkMap toolLandmarks = mPatientModelService->getPatientLandmarks()->getLandmarks();

	this->writePreLandmarkRegistration(fixedImage->getName(), fixedImage->getLandmarks()->getLandmarks());
	this->writePreLandmarkRegistration("physical", toolLandmarks);

	std::vector<QString> landmarks = this->getUsableLandmarks(fixedLandmarks, toolLandmarks);

	vtkPointsPtr p_ref = this->convertTovtkPoints(landmarks, fixedLandmarks, fixedImage->get_rMd());
	vtkPointsPtr p_pr = this->convertTovtkPoints(landmarks, toolLandmarks, Transform3D::Identity());

	// ignore if too few data.
	if (p_ref->GetNumberOfPoints() < 3)
		return;

	bool ok = false;
	Transform3D rMpr = this->performLandmarkRegistration(p_pr, p_ref, &ok);
	if (!ok)
	{
		reportError("P-I Landmark registration: Failed to register: [" + qstring_cast(p_pr->GetNumberOfPoints()) + "p]");
		return;
	}

	this->applyPatientRegistration(rMpr, "Patient Landmark");
}
开发者ID:normit-nav,项目名称:CustusX,代码行数:34,代码来源:cxRegistrationImplService.cpp

示例11: getValue

QString StringPropertyRegistrationMovingImage::getValue() const
{
	DataPtr image = mRegistrationService->getMovingData();
  if (!image)
    return "";
  return qstring_cast(image->getUid());
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例12: InvalidArgumentException

std::vector<PointsPrimitivePtr> IECoreScene::PointsAlgo::segment(
	const PointsPrimitive *points,
	const PrimitiveVariable &primitiveVariable,
	const IECore::Data *segmentValues
)
{
	DataPtr data;
	if( !segmentValues )
	{
		data = IECore::uniqueValues( primitiveVariable.data.get() );
		segmentValues = data.get();
	}

	std::string primitiveVariableName;
	for (const auto &pv : points->variables )
	{
		if ( pv.second == primitiveVariable )
		{
			primitiveVariableName = pv.first;
		}
	}

	if( primitiveVariableName == "" )
	{
		throw IECore::InvalidArgumentException( "IECoreScene::PointsAlgo::segment : Primitive variable not found on Points Primitive" );
	}

	auto f = PointsAlgo::deletePoints;
	IECoreScene::Detail::TaskSegmenter<IECoreScene::PointsPrimitive, decltype(f) > segmenter( points, const_cast<IECore::Data*> (segmentValues), primitiveVariableName, f);

	return dispatch( primitiveVariable.data.get(), segmenter );
}
开发者ID:ImageEngine,项目名称:cortex,代码行数:32,代码来源:PointsAlgoSegment.cpp

示例13: getTargetTransform

/** Return transform from target space to reference space
 *
 */
Transform3D ImageLandmarksWidget::getTargetTransform() const
{
	DataPtr image = this->getCurrentData();
	if (!image)
		return Transform3D::Identity();
	return image->get_rMd();
}
开发者ID:SINTEFMedtek,项目名称:CustusX,代码行数:10,代码来源:cxImageLandmarksWidget.cpp

示例14: assert

void
FreezeScript::AssignVisitor::visitSequence(const SequenceDataPtr& dest)
{
    Slice::TypePtr type = dest->getType();
    SequenceDataPtr src = SequenceDataPtr::dynamicCast(_src);
    if(src && isCompatible(type, src->getType()))
    {
        DataList& srcElements = src->getElements();
        DataList destElements;
        Slice::SequencePtr seqType = Slice::SequencePtr::dynamicCast(type);
        assert(seqType);
        Slice::TypePtr elemType = seqType->type();
        string typeName = typeToString(type);
        for(DataList::const_iterator p = srcElements.begin(); p != srcElements.end(); ++p)
        {
            DataPtr element = _factory->create(elemType, false);
            Destroyer<DataPtr> elementDestroyer(element);
            AssignVisitor v(*p, _factory, _errorReporter, _convert, typeName + " element");
            element->visit(v);
            destElements.push_back(element);
            elementDestroyer.release();
        }
        DataList& l = dest->getElements();
        l.swap(destElements);
    }
    else
    {
        typeMismatchError(type, _src->getType());
    }
}
开发者ID:BlackHoleJet,项目名称:freeze,代码行数:30,代码来源:AssignVisitor.cpp

示例15: m_map

Context::Context( const Context &other, Ownership ownership )
	:	m_map( other.m_map ), m_changedSignal( NULL )
{
	// We used the (shallow) Map copy constructor in our initialiser above
	// because it offers a big performance win over iterating and inserting copies
	// ourselves. Now we need to go in and tweak our copies based on the ownership.
	
	for( Map::iterator it = m_map.begin(), eIt = m_map.end(); it != eIt; ++it )
	{
		it->second.ownership = ownership;
		switch( ownership )
		{
			case Copied :
				{
					DataPtr valueCopy = it->second.data->copy();
					it->second.data = valueCopy.get();
					it->second.data->addRef();
					break;
				}
			case Shared :
				it->second.data->addRef();
				break;
			case Borrowed :
				// no need to do anything
				break;
		}
	}
}
开发者ID:sonyomega,项目名称:gaffer,代码行数:28,代码来源:Context.cpp


注:本文中的DataPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。