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


C++ Property类代码示例

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


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

示例1: fprintf

void OdeSdlSimulation::init(RobotStreamer *streamer, 
                            RobotConfig *config) {
    OdeInit& odeinit = OdeInit::get();
    if (video!=NULL) {
        fprintf(stderr, "Only one Simulation object allowed\n");
        yarp::os::exit(1);
    }
    robot_streamer = streamer;
    robot_config = config;

    ode_step_length = config->getWorldTimestep();
    dstep = ode_step_length*1e-3;

    video = new VideoTexture;
    string moduleName = odeinit.getName();
    video->setName( moduleName ); 
    odeinit._iCub->eyeLidsPortName = moduleName;
    Property options;

    //get the camera calibration parameters
    string camcalib_context=robot_config->getFinder().check("camcalib_context",
                                                            Value("cameraCalibration")).asString().c_str();
    string camcalib_file=robot_config->getFinder().check("camcalib_file",
                                                         Value("icubSimEyes.ini")).asString().c_str();

    ResourceFinder rf_camcalib;
    rf_camcalib.setVerbose();
    rf_camcalib.setDefaultContext(camcalib_context.c_str());
    rf_camcalib.setDefaultConfigFile(camcalib_file.c_str());
    rf_camcalib.configure(0,NULL);

    //left
    Bottle &bCalibLeft=rf_camcalib.findGroup("CAMERA_CALIBRATION_LEFT");
    width_left=bCalibLeft.check("w",Value(320)).asInt();
    height_left=bCalibLeft.check("h",Value(240)).asInt();

    cameraSizeWidth=width_left;
    cameraSizeHeight=height_left;

    double focal_length_left=bCalibLeft.check("fy",Value(257.34)).asDouble();
    fov_left=2*atan2((double)height_left,2*focal_length_left)*180.0/M_PI;

    //right
    Bottle &bCalibRight=rf_camcalib.findGroup("CAMERA_CALIBRATION_RIGHT");
    width_right=bCalibRight.check("w",Value(320)).asInt();
    height_right=bCalibRight.check("h",Value(240)).asInt();

    double focal_length_right=bCalibRight.check("fy",Value(257.34)).asDouble();
    fov_right=2*atan2((double)height_right,2*focal_length_right)*180.0/M_PI;
    //--------------------------------------//


    ConstString videoconf = robot_config->getFinder().findFile("video");
    options.fromConfigFile(videoconf.c_str());

    Bottle textures = *options.find("textures").asList();
    for (int i=0; i<textures.size(); i++) {
        ConstString name = textures.get(i).asString();
        printf("Adding video texture %s\n", name.c_str());
        video->add(options.findGroup(name.c_str()));
    }
}
开发者ID:apostroph,项目名称:icub-main,代码行数:62,代码来源:iCub_Sim.cpp

示例2: Q_UNUSED

bool Item::mouseDoubleClickEvent( const EventInfo & eventInfo )
{
	Q_UNUSED(eventInfo);
	
	Property * property = 0l;
	Variant::Type::Value type = Variant::Type::None;
	
	const VariantDataMap::iterator variantDataEnd = m_variantData.end();
	for ( VariantDataMap::iterator it = m_variantData.begin(); it != variantDataEnd; ++it )
	{
		Property * current = *it;
		
		if ( current->type() == Variant::Type::Multiline ||
				   current->type() == Variant::Type::RichText )
		{
			property = current;
			type = current->type();
			break;
		}
	}
	if ( !property )
		return false;
	
	if ( type == Variant::Type::Multiline )
	{
		//KDialog * dlg = new KDialog( 0l, "", true, property->editorCaption(), KDialog::Ok|KDialog::Cancel|KDialog::User1, KDialog::Ok,
        //                             false, KStandardGuiItem::clear() );
        KDialog * dlg = new KDialog( 0 );
        dlg->setModal(true);
        dlg->setCaption( property->editorCaption() );
        dlg->setButtons(KDialog::Ok|KDialog::Cancel|KDialog::User1);
        dlg->setDefaultButton(KDialog::Ok);
        dlg->showButtonSeparator(false);
        dlg->setButtonText(KDialog::User1, KStandardGuiItem::clear().text());
        //QFrame *frame = dlg->makeMainWidget();
		QFrame *frame = new QFrame(dlg);
        dlg->setMainWidget(frame);
		QVBoxLayout *layout = new QVBoxLayout( frame );
        layout->setMargin(0);
        layout->setSpacing(dlg->spacingHint());
		KTextEdit *textEdit = new KTextEdit( frame );
		//textEdit->setTextFormat( Qt::PlainText ); // 2018.12.02
        textEdit->setAcceptRichText(false);
		textEdit->setText( property->value().toString() );
		layout->addWidget( textEdit, 10 );
		textEdit->setFocus();
		connect( dlg, SIGNAL( user1Clicked() ), textEdit, SLOT( clear() ) );
		dlg->setMinimumWidth( 600 );
		
		if ( dlg->exec() == KDialog::Accepted )
		{
			property->setValue( textEdit->toPlainText() );
			dataChanged();
			p_itemDocument->setModified(true);
		}
		delete dlg;
	}
	else
	{
		// Is rich text
		RichTextEditorDlg * dlg = new RichTextEditorDlg( 0l, property->editorCaption() );
		dlg->setText( property->value().toString() );
		
		if ( dlg->exec() == KDialog::Accepted )
		{
			property->setValue( dlg->text() );
			dataChanged();
			p_itemDocument->setModified(true);
		}
		delete dlg;
	}
	
	return true;
}
开发者ID:ktechlab,项目名称:ktechlab,代码行数:74,代码来源:item.cpp

示例3: yTrace

bool AnalogServer::open(yarp::os::Searchable &config)
{
     yTrace() << "AnalogServer param = " << config.toString().c_str();

    Property params;
    params.fromString(config.toString().c_str());
    bool correct=true;

//     if(params.check("ports"))
//     {
//       Bottle *ports=params.find("ports").asList();
//       setId(ports->get(0).asString().c_str());
//     }

    // Verify minimum set of parameters required
    if(!params.check("robotName") )   // ?? qui dentro, da dove lo pesco ??
    {
        correct=false;
        yError() << "AnalogServer missing robot Name, check your configuration file!! Quitting\n";
        return false;
    }

    if(params.check("deviceId"))
    {
      string tmp(params.find("deviceId").asString());// .asList();
//       string tmp(deviceId->get(0).asString());
      cout << tmp;
      setId(tmp);
    }

    if (params.check("period"))
    {
        _rate=params.find("period").asInt();
    }
    else
    {
        _rate=20;
        std::cout<<"Warning: part "<< id <<" using default period ("<<_rate<<")\n";
    }

    // Read the list of ports
    std::string robotName=params.find("robotName").asString().c_str();
    std::string root_name;
    root_name+="/";
    root_name+=robotName;
    root_name+= "/" + this->id + "/analog";
    rpcPortName = root_name + "/rpc:i";

    // port names are optional, do not check for correctness.
    if(!params.check("ports"))
    {
     // if there is no "ports" section take the name of the "skin" group as the only port name
        createPort((root_name+":o" ).c_str(), _rate );

//         tmpPorts.resize( (size_t) 1);
//         tmpPorts[0].offset = 0;
//         tmpPorts[0].length = -1;
//         tmpPorts[0].port_name = root_name + this->id;
    }
    else
    {
        Bottle *ports=params.find("ports").asList();

        if (!params.check("total_taxels", "number of taxels of the part"))
            return false;
        int total_taxels=params.find("total_taxels").asInt();
        int nports=ports->size();
        int totalT = 0;
        std::vector<AnalogPortEntry> tmpPorts;
        tmpPorts.resize(nports);

        for(int k=0;k<ports->size();k++)
        {
            Bottle parameters=params.findGroup(ports->get(k).asString().c_str());

            if (parameters.size()!=5)
            {
                yError () <<"check skin port parameters in part description";
                yError() << "--> I was expecting "<<ports->get(k).asString().c_str() << " followed by four integers";
                return false;
            }

            int wBase=parameters.get(1).asInt();
            int wTop=parameters.get(2).asInt();
            int base=parameters.get(3).asInt();
            int top=parameters.get(4).asInt();

            cout<<"--> "<<wBase<<" "<<wTop<<" "<<base<<" "<<top<<endl;

            //check consistenty
            if(wTop-wBase != top-base){
                cerr<<"Error: check skin port parameters in part description"<<endl;
                cerr<<"Numbers of mapped taxels do not match.\n";
                return false;
            }
            int taxels=top-base+1;

            tmpPorts[k].length = taxels;
            tmpPorts[k].offset = wBase;
            tmpPorts[k].port_name = root_name+":o"+string(ports->get(k).asString().c_str());
//.........这里部分代码省略.........
开发者ID:apaikan,项目名称:icub-main,代码行数:101,代码来源:analogServer.cpp

示例4: CPPUNIT_ASSERT

void BaseTestProperty::testIsValidEntity() {
    Property p = section.createProperty("testProperty", DataType::Double);
    CPPUNIT_ASSERT(p.isValidEntity());
    section.deleteProperty(p.name());
    CPPUNIT_ASSERT(!p.isValidEntity());
}
开发者ID:abhay447,项目名称:nix,代码行数:6,代码来源:BaseTestProperty.cpp

示例5: KDialog

/**
 *
 * @param object
 * @param parent
 * @return
 */
ClassDialog::ClassDialog( Object *object, QWidget *parent) :
	KDialog(parent)
{
	m_object = object;
	setModal( false );

	showButtonOK( true );
	showButtonCancel( true );
	showButtonApply( false );

	m_tab = new KTabWidget( this );
	setMainWidget( m_tab );
	QWidget *widget = new QWidget( this );
	
	m_tab->addTab( widget, object->classInfo()->name() );
	
	
	//connect( this, SIGNAL(okClicked()), SLOT(slotOkClicked()) );

	QVBoxLayout *layout = new QVBoxLayout( widget );

	LabelsMetaInfo *labels = dynamic_cast<LabelsMetaInfo*>( object->classInfo()->metaInfo( "labels" ) );

	QLabel *label;
	label = new QLabel( widget );
	label->setAlignment( Qt::AlignCenter );
	if ( labels )
		label->setText( "<b>"  + labels->label( object->classInfo()->name() ) + "</b>" );
	else
		label->setText( "<b>" + object->classInfo()->name() + "</b>" );

	if ( labels )
		setCaption( labels->label( object->classInfo()->name() )  + " (" + oidToString(object->oid()) + ")" );
	else
		setCaption( object->classInfo()->name() + " (" + oidToString(object->oid()) + ")" );

	layout->addWidget( label );
	layout->addSpacing( 10 );

	QGridLayout *gridLayout = new QGridLayout( layout, object->numProperties() + object->numObjects() + object->numCollections(), 2, 5 );

	int row = 0;
	PropertiesIterator it( object->propertiesBegin() );
	PropertiesIterator end( object->propertiesEnd() );
	for ( ; it != end; ++it, ++row ) {
		Property p = *it;
		label = new QLabel( widget );
		if ( labels )
			label->setText( labels->label( p.name() ) );
		else
			label->setText( p.name() );
		gridLayout->addWidget( label, row, 0 );
		PropertyWidget *tmp = new PropertyWidget( p, widget );
		m_mapProperties.insert( p.name(), tmp );
		gridLayout->addWidget( tmp, row, 1 );
	}

	const ClassInfo *classInfo = object->classInfo();
	RelationInfosConstIterator it2( classInfo->relationsBegin() );
	RelationInfosConstIterator end2( classInfo->relationsEnd() );
	for ( ; it2 != end2; ++it2, ++row ) {
		RelationInfo *relObj = it2.data();
		label = new QLabel( widget );
		if ( labels )
			label->setText( labels->label( it2.data()->name() ) );
		else
			label->setText( it2.data()->name() );
		gridLayout->addWidget( label, row, 0 );

		QHBoxLayout *lay = new QHBoxLayout();
		gridLayout->addLayout( lay, row, 1 );
		KurlLabel *objLabel = new KurlLabel(widget);
		objLabel->setAlignment( Qt::AlignCenter );
		Object* obj = object->object( relObj->name() );
		updateObjectLabel( objLabel, obj );
		connect( objLabel, SIGNAL(leftClickedURL(const QString&)), SLOT(slotObjectSelected(const QString&)) );
		m_mapObjects.insert( relObj->name(), objLabel );
		QPushButton *but = new QPushButton( widget );
		but->setText( i18n( "Change" ) );
		connect( but, SIGNAL(clicked()), SLOT(slotChangeClicked()) );
		m_mapChangeButtons.insert( but, relObj );
		lay->addWidget( objLabel );
		lay->addWidget( but );

		Notifier *notifier = dynamic_cast<Notifier*>( Manager::self()->notificationHandler() );
//		if ( notifier && obj )
//			notifier->registerSlot( this, SLOT( slotObjectModified(const ClassInfo*,const OidType&,const PropertyInfo*,const QVariant&) ), 0, obj->oid() );
	}
	
	CollectionInfosConstIterator it3( classInfo->collectionsBegin() );
	CollectionInfosConstIterator end3( classInfo->collectionsEnd() );
	for ( ; it3 != end3; ++it3 ) {
		const CollectionInfo *info = it3.data();
		CollectionChooser *chooser = new CollectionChooser( m_tab );
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kandau-svn,代码行数:101,代码来源:classdialog.cpp

示例6: QString


//.........这里部分代码省略.........
    pRes->AddAttribute( "duration"  , sDur      );
    pRes->AddAttribute( "size"      , QString::number( nFileSize) );

/*
    // ----------------------------------------------------------------------
    // Add Video Resource Element based on File extension (mythtv)
    // ----------------------------------------------------------------------

    sProtocol = QString( "myth:*:%1:*"     ).arg( sMimeType  );
    sURI      = QString( "myth://%1/%2" )
                   .arg( m_mapBackendIp  [ sHostName ] )
                   .arg( sBaseName );

    pRes = pItem->AddResource( sProtocol, sURI );

    pRes->AddAttribute( "duration"  , sDur      );
    pRes->AddAttribute( "size"      , QString::number( nFileSize) );
*/

    // ----------------------------------------------------------------------
    // Add Preview URI as <res>
    // MUST be _TN and 160px
    // ----------------------------------------------------------------------

    sURI = QString( "%1GetPreviewImage%2%3").arg( sURIBase   )
                                            .arg( sURIParams )
                                            .arg( "&amp;Width=160" );

    // TODO: Must be JPG for minimal compliance
    sProtocol = QString( "http-get:*:image/png:DLNA.ORG_PN=PNG_TN");
    pItem->AddResource( sProtocol, sURI );

    // ----------------------------------------------------------------------
    // Add Artwork URI as albumArt
    // ----------------------------------------------------------------------

    sURI = QString( "%1GetRecordingArtwork?Type=coverart&amp;Inetref=%3")
                                              .arg( sURIBase   )
                                              .arg( sInetRef   );

    QList<Property*> propList = pItem->GetProperties("albumArtURI");
    if (propList.size() >= 4)
    {
        // Prefer JPEG over PNG here, although PNG is allowed JPEG probably
        // has wider device support and crucially the filesizes are smaller
        // which speeds up loading times over the network

        // We MUST include the thumbnail size, but since some clients may use the
        // first image they see and the thumbnail is tiny, instead return the
        // medium first. The large could be very large, which is no good if the
        // client is pulling images for an entire list at once!

        // Medium
        Property *pProp = propList.at(0);
        if (pProp)
        {
            // Must be no more than 1024x768
            pProp->m_sValue = sURI;
            pProp->m_sValue.append("&amp;Width=1024&amp;Height=768");
            pProp->AddAttribute("dlna:profileID", "JPG_MED");
            pProp->AddAttribute("xmlns:dlna", "urn:schemas-dlna-org:metadata-1-0");
        }

        // Thumbnail
        pProp = propList.at(1);
        if (pProp)
        {
            // At least one albumArtURI must be a ThumbNail (TN) no larger
            // than 160x160, and it must also be a jpeg
            pProp->m_sValue = sURI;
            pProp->m_sValue.append("&amp;Width=160&amp;Height=160");
            pProp->AddAttribute("dlna:profileID", "JPG_TN");
            pProp->AddAttribute("xmlns:dlna", "urn:schemas-dlna-org:metadata-1-0");
        }

        // Medium
        pProp = propList.at(2);
        if (pProp)
        {
            // Must be no more than 1024x768
            pProp->m_sValue = sURI;
            pProp->m_sValue.append("&amp;Width=1024&amp;Height=768");
            pProp->AddAttribute("dlna:profileID", "JPG_MED");
            pProp->AddAttribute("xmlns:dlna", "urn:schemas-dlna-org:metadata-1-0");
        }

        // Large
        pProp = propList.at(3);
        if (pProp)
        {
            // Must be no more than 4096x4096 - for our purposes, just return
            // a fullsize image
            pProp->m_sValue = sURI;
            pProp->AddAttribute("dlna:profileID", "JPG_LRG");
            pProp->AddAttribute("xmlns:dlna", "urn:schemas-dlna-org:metadata-1-0");
        }
    }


}
开发者ID:ludvik-t,项目名称:mythtv,代码行数:101,代码来源:upnpcdstv.cpp

示例7: configure

    virtual bool configure(yarp::os::ResourceFinder &rf)
    {
        Property options;
        options.fromString(rf.toString());
        char robotName[255];
        Bottle *jointsList=0;
        std::string moduleName = "directPositionControl";
        Time::turboBoost();

        options.put("device", "remote_controlboard");
        if(options.check("robot"))
            strncpy(robotName, options.find("robot").asString().c_str(),sizeof(robotName));
        else
            strncpy(robotName, "icub", sizeof(robotName));

        if (options.check("name"))
        {
            moduleName = options.find("name").asString();
        }

        if(options.check("part"))
        {
            sprintf(partName, "%s", options.find("part").asString().c_str());

            char tmp[255];
            sprintf(tmp, "/%s/%s/%s/client", moduleName.c_str(), robotName, partName);
            options.put("local",tmp);
        
            sprintf(tmp, "/%s/%s", robotName, partName);
            options.put("remote", tmp);
        
            sprintf(tmp, "/%s/%s/rpc", moduleName.c_str(), partName);
            rpc_port.open(tmp);
            
            options.put("carrier", "tcp");
            
            attach(rpc_port);
        }
        else
        {
            yError("Please specify part (e.g. --part head)\n");
            return false;
        }

        if(options.check("joints"))
        {
            jointsList = options.find("joints").asList();
            if (jointsList==0) yError("Unable to parts 'joints' parameter\n");
        }
        else
        {
            yError("Please specify the joints to control (e.g. --joints ""(0 1 2)"" ");
            return false;
        }

        //opening the device driver
        if (!driver.open(options))
        {
            yError("Error opening device, check parameters\n");
            return false;
        }

        ///starting the thread
        int period = CONTROL_PERIOD;
        if(options.check("period"))
            period = options.find("period").asInt();
        
        yInfo("control rate is %d ms",period);

        pThread=new positionDirectControlThread(period);
        pThread->init(&driver, moduleName, partName, robotName, jointsList);
        pThread->start();

        return true;
    }
开发者ID:AbuMussabRaja,项目名称:icub-main,代码行数:75,代码来源:main.cpp

示例8: main

int main(int argc, char *argv[]) 
{
    // just list the devices if no argument given
    if (argc <= 2) {
        printf("You can call %s like this:\n", argv[0]);
        printf("   %s --robot ROBOTNAME --OPTION VALUE ...\n", argv[0]);
        printf("For example:\n");
        printf("   %s --robot icub --local /talkto/james --remote /controlboard/rpc\n", argv[0]);
        printf("Here are devices listed for your system:\n");
        printf("%s", Drivers::factory().toString().c_str());
        return 0;
    }

    // get command line options
    Property options;
    options.fromCommand(argc, argv);
    if (!options.check("robot") || !options.check("part")) {
        printf("Missing either --robot or --part options\n");
        return 0;
    }

    Network::init();
	Time::turboBoost();
    
    std::string name;
    Value& v = options.find("robot");
    Value& part = options.find("part");

    Value *val;
    if (!options.check("device", val)) {
        options.put("device", "remote_controlboard");
    }
    if (!options.check("local", val)) {
		name="/"+std::string(v.asString().c_str())+"/"+std::string(part.asString().c_str())+"/simpleclient";
        //sprintf(&name[0], "/%s/%s/client", v.asString().c_str(), part.asString().c_str());
        options.put("local", name.c_str());
    }
    if (!options.check("remote", val)) {
        name="/"+std::string(v.asString().c_str())+"/"+std::string(part.asString().c_str());    
		//sprintf(&name[0], "/%s/%s", v.asString().c_str(), part.asString().c_str());
        options.put("remote", name.c_str());
    }

	fprintf(stderr, "%s", options.toString().c_str());

    
    // create a device 
    PolyDriver dd(options);
    if (!dd.isValid()) {
        printf("Device not available.  Here are the known devices:\n");
        printf("%s", Drivers::factory().toString().c_str());
        Network::fini();
        return 1;
    }

    IPositionControl *pos;
    IPositionDirect  *posDir;
    IVelocityControl *vel;
    IEncoders *enc;
    IPidControl *pid;
    IAmplifierControl *amp;
    IControlLimits *lim;
//    IControlMode *icm;
    IControlMode2 *iMode2;
    ITorqueControl *itorque;
    IOpenLoopControl *iopenloop;
	IImpedanceControl *iimp;
    IInteractionMode *iInteract;

    bool ok;
    ok = dd.view(pos);
    ok &= dd.view(vel);
    ok &= dd.view(enc);
    ok &= dd.view(pid);
    ok &= dd.view(amp);
    ok &= dd.view(lim);
//    ok &= dd.view(icm);
    ok &= dd.view(itorque);
    ok &= dd.view(iopenloop);
	ok &= dd.view(iimp);
    ok &= dd.view(posDir);
    ok &= dd.view(iMode2);
    ok &= dd.view(iInteract);

    if (!ok) {
        printf("Problems acquiring interfaces\n");
        return 1;
    }

    pos->getAxes(&jnts);
    printf("Working with %d axes\n", jnts);
    double *tmp = new double[jnts];

    printf("Device active...\n");
    while (dd.isValid()) {
        std::string s;
        s.resize(1024);
        
        printf("-> ");
        char c = 0;
//.........这里部分代码省略.........
开发者ID:lorejam,项目名称:icub-main,代码行数:101,代码来源:main.cpp

示例9: main

int main(int argc, char *argv[]) {
    Property p;
    p.fromCommand(argc,argv);

    // check where to put description of device
    ConstString dest = "";
    dest = p.check("doc",Value("")).toString();

    ConstString fileName = p.check("file",Value("default.ini")).asString();

    if (p.check("file")) {
        p.fromConfigFile(fileName);
    }

    ConstString deviceName = p.check("device",Value("")).asString();

    // if no device given, we should be operating a completely
    // standard test harness like for libYARP_OS and libYARP_sig
    if (deviceName=="") {
        return harness_main(argc,argv);
    }

    // device name given - use special device testing procedure

#ifdef CHECK_FOR_LEAKS
    mtrace();
#endif

    int result = 0;

    Network::init();
    Network::setLocalMode(true);

    String seek = fileName.c_str();
    ConstString exampleName = "";
    int pos = seek.rfind('/');
    if (pos==-1) {
        pos = seek.rfind('\\');
    }
    if (pos==-1) {
        pos = 0;
    } else {
        pos++;
    }
    int len = seek.find('.',pos);
    if (len==-1) {
        len = seek.length();
    } else {
        len -= pos;
    }
    exampleName = seek.substr(pos,len).c_str();
    ConstString shortFileName = seek.substr(pos,seek.length()).c_str();

    PolyDriver dd;
	YARP_DEBUG(Logger::get(), "harness opening...");
	
    bool ok = dd.open(p);
    YARP_DEBUG(Logger::get(), "harness opened.");
    result = ok?0:1;

    ConstString wrapperName = "";
    ConstString codeName = "";

    DriverCreator *creator = 
        Drivers::factory().find(deviceName.c_str());
    if (creator!=NULL) {
        wrapperName = creator->getWrapper();
        codeName = creator->getCode();
    }


    if (dest!="") {
        String dest2 = dest.c_str();
        if (result!=0) {
            dest2 += ".fail";
        }
        FILE *fout = fopen(dest2.c_str(),"w");
        if (fout==NULL) {
            printf("Problem writing to %s\n", dest2.c_str());
            exit(1);
        }
        fprintf(fout,"/**\n");
        fprintf(fout," * \\ingroup dev_examples\n");
        fprintf(fout," *\n");
        fprintf(fout," * \\defgroup %s Example for %s (%s)\n\n",
                exampleName.c_str(),
                deviceName.c_str(),
                exampleName.c_str());
        fprintf(fout, "Instantiates \\ref cmd_device_%s \"%s\" device implemented by yarp::dev::%s.\n",
                deviceName.c_str(), deviceName.c_str(), codeName.c_str());
        fprintf(fout, "\\verbatim\n%s\\endverbatim\n",
                getFile(fileName.c_str()).c_str());
        fprintf(fout, "If this text is saved in a file called %s then the device can be created by doing:\n",
                shortFileName.c_str());
        fprintf(fout, "\\verbatim\nyarpdev --file %s\n\\endverbatim\n",
                shortFileName.c_str());
        fprintf(fout, "Of course, the configuration could be passed just as command line options, or as a yarp::os::Property object in a program:\n");
        fprintf(fout, "\\code\n");
        fprintf(fout, "Property p;\n");
        fprintf(fout, "p.fromConfigFile(\"%s\");\n",
//.........这里部分代码省略.........
开发者ID:JoErNanO,项目名称:yarp,代码行数:101,代码来源:harness.cpp

示例10: isPropertyDefault

/**
 * Determine if the property value is the same as the default value.
 * This can be used to determine if the property has not been set.
 * @param propertyName : Name of property to query
 * @return: True only if the property has it's default value.
 */
bool SpecularReflectionAlgorithm::isPropertyDefault(
    const std::string &propertyName) const {
  Property *property = this->getProperty(propertyName);
  return property->isDefault();
}
开发者ID:mantidproject,项目名称:mantid,代码行数:11,代码来源:SpecularReflectionAlgorithm.cpp

示例11: Property

void SGMExporter::CollectProperties(Scene3DMesh *mesh, IGameMesh *gMesh)
{
	IPropertyContainer *propsContainer = gMesh->GetIPropertyContainer();
	if (propsContainer == NULL || propsContainer->GetNumberOfProperties() == 0)
	{
		Log::LogT("Mesh %s has no properties", mesh->name.c_str());
		return;
	}
	
	Log::LogT("properties count: %d", propsContainer->GetNumberOfProperties());

	for (int i = 0; i < propsContainer->GetNumberOfProperties(); i++)
	{
		IGameProperty *gProp = propsContainer->GetProperty(i);
		if (gProp == NULL)
			continue;

		int propType = gProp->GetType();
		std::string propName = StringUtils::ToNarrow(gProp->GetName());

		Log::LogT("eporting %s with type %d", propName.c_str(), propType);

		if (propType == IGAME_UNKNOWN_PROP)
		{
			Log::LogT("property %s has unknown type", propName.c_str());
			continue;
		}

		Property::AnimationType propAnimType = Property::AnimationType_None;

		Property *prop = NULL; 

		if (!gProp->IsPropAnimated())
		{
			Log::LogT("property %s has no animation", propName.c_str());

			prop = new Property(propName, PropTypeConv(propType), Property::AnimationType_None);
			switch (propType)
			{
			case IGAME_FLOAT_PROP:
				{
					float val;	
					gProp->GetPropertyValue(val);
					prop->SetValue(val);
				}
				break;

			case IGAME_INT_PROP:
				{
					int val;
					gProp->GetPropertyValue(val);
					prop->SetValue(val);
				}
				break;

			case IGAME_POINT3_PROP:
				{
					Point3 val;
					gProp->GetPropertyValue(val);
					prop->SetValue(sm::Vec3(val.x, val.y, val.z));
				}
				break;
			}
		}
		else
		{
			IGameControl *ctrl = gProp->GetIGameControl();

			if (ctrl == NULL)
			{
				Log::LogT("%s IGameControl is NULL", propName.c_str());
				continue;
			}

			switch (propType)
			{
			case IGAME_FLOAT_PROP:
				{
					Control *maxControl = ctrl->GetMaxControl(IGAME_FLOAT);
					if (maxControl != NULL && maxControl->IsAnimated())
					{
						if (maxControl->ClassID() == Class_ID(LININTERP_FLOAT_CLASS_ID, 0))
						{	
							Log::LogT("%s float liniowe scierwo", propName.c_str());
							prop = new Property(propName, Property::PropertyType_Float, Property::AnimationType_Linear);
							IGameKeyTab keys;
							if (ctrl->GetLinearKeys(keys, IGAME_FLOAT))
							{
								for (int j = 0; j < keys.Count(); j++)
								{
									prop->SetValue(keys[j].linearKey.fval, TicksToSec(keys[j].t));
								}
							}
						}
						if (maxControl->ClassID() == Class_ID(TCBINTERP_FLOAT_CLASS_ID, 0))
						{
							Log::LogT("%s float tcb scierwo", propName.c_str());
							prop = new Property(propName, Property::PropertyType_Float, Property::AnimationType_TCB);
							IGameKeyTab keys;
							if (ctrl->GetTCBKeys(keys, IGAME_FLOAT))
//.........这里部分代码省略.........
开发者ID:asmCode,项目名称:rw2014-exporter,代码行数:101,代码来源:SGMExporter.cpp

示例12: return

bool V4l2Device::V4L2PropertyHandler::set_property (const Property& new_property)
{
    auto f = [&new_property] (const property_description& d)
        {
            return ((*d.prop).get_name().compare(new_property.get_name()) == 0);
        };

    auto desc = std::find_if(properties.begin(), properties.end(),f);

    if (desc == properties.end())
    {
        desc = std::find_if(special_properties.begin(), special_properties.end(), f);

        if (desc != special_properties.end())
        {
            desc->prop->set_struct(new_property.get_struct());

            if (device->changeV4L2Control(*desc))
            {
                return true;
            }
            return false;
        }


        tcam_log(TCAM_LOG_ERROR, "Unable to find Property \"%s\"", new_property.get_name().c_str());
        return false;
    }

    if (desc->id == EMULATED_PROPERTY)
    {
        if (new_property.get_ID() == TCAM_PROPERTY_OFFSET_AUTO)
        {
            auto props = create_property_vector();
            return handle_auto_center(new_property,
                                      props,
                                      device->get_sensor_size(),
                                      device->active_video_format.get_size());
        }
        else
        {
            tcam_log(TCAM_LOG_ERROR, "Emulated property not implemented \"%s\"", new_property.get_name().c_str());
            return false;
        }
    }
    else if (desc->mapped)
    {
        for (auto& m : mappings)
        {
            auto p = m.std_prop.lock();
            if (p == desc->prop)
            {
                if (p->get_type() == TCAM_PROPERTY_TYPE_BOOLEAN)
                {
                    auto value = new_property.get_struct().value.b.value;
                    p->set_value(value, false);
                    auto internal_p = m.internal_prop.lock();

                    internal_p->set_value(m.bool_map.at(value));
                }
                else
                {
                    tcam_error("mapping type not implemented");
                }
                break;
            }
        }
        desc->prop->set_struct(new_property.get_struct());

        if (device->changeV4L2Control(*desc))
        {
            return true;
        }
    }
    else
    {
        desc->prop->set_struct(new_property.get_struct());

        if (device->changeV4L2Control(*desc))
        {
            return true;
        }
    }
    return false;
}
开发者ID:TheImagingSource,项目名称:tiscamera,代码行数:85,代码来源:V4L2PropertyHandler.cpp

示例13: getProperty

 void PropertyHolder::setPropertyAsString(const Ogre::String& key, const CeGuiString& value)
 {
     Property prop = getProperty(key);
     prop.getFromString(value);
     setProperty(key, prop);
 }
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:6,代码来源:Properties.cpp

示例14: getPropertyMap

// Call back Declaration
ReturnType JoystickComp::onInitialize()
{
	//	XML에 저장된 프라퍼티를 parameter에 저장
	Property parameter;
	std::map<std::string, std::string> temp = getPropertyMap();
	parameter.SetProperty(temp);
	
	//	dll 파일이름을 확인하여 없으면 에러 리턴
	if(parameter.FindName("APIName") == false) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't find the APIName in property\n");
		return OPROS_FIND_PROPERTY_ERROR;
	}

#if defined(WIN32)
	//	DLL 로드
	hOprosAPI = LoadLibrary((LPCSTR)parameter.GetValue("APIName").c_str());
	if(hOprosAPI == NULL) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't find the %s\n", parameter.GetValue("APIName").c_str());
		return OPROS_FIND_DLL_ERROR;
	}
	
	//	API 로드
	GET_OPROS_API getOprosAPI;
	getOprosAPI = (GET_OPROS_API)GetProcAddress(hOprosAPI, "GetAPI");
	if(getOprosAPI == NULL) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't get a handle of GetAPI Funtion\n");
		FreeLibrary(hOprosAPI);
		hOprosAPI = NULL;
		return OPROS_LOAD_DLL_ERROR;
	}
#else
	hOprosAPI = dlopen(parameter.GetValue("APIName").c_str(), RTLD_LAZY);
	if(hOprosAPI == NULL) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't find the %s\n", parameter.GetValue("APIName").c_str());
		return OPROS_FIND_DLL_ERROR;
	}

	GET_OPROS_API getOprosAPI;
	getOprosAPI = (GET_OPROS_API)dlsym(hOprosAPI, "GetAPI");
	char *lastError = dlerror();
	if(lastError != NULL) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't get a handle of GetAPI Funtion\n");
		dlclose(hOprosAPI);
		hOprosAPI = NULL;
		return OPROS_LOAD_DLL_ERROR;
	}
#endif
	
	joystick = static_cast<Joystick *>(getOprosAPI());
	if(joystick == NULL) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't get a handle of Joystick API\n");
#if defined(WIN32)
		FreeLibrary(hOprosAPI);
#else
		dlclose(hOprosAPI);
#endif
		hOprosAPI = NULL;
		return OPROS_LOAD_DLL_ERROR;
	}

	//	API 초기화
	if(joystick->Initialize(parameter) != API_SUCCESS) {
		PrintMessage("ERROR : JoystickComp::onInitialize() -> Can't intilaize a Joystick API\n");
		
		delete joystick;
		joystick = NULL;

#if defined(WIN32)
		FreeLibrary(hOprosAPI);
#else
		dlclose(hOprosAPI);
#endif
		hOprosAPI = NULL;
		return OPROS_INITIALIZE_API_ERROR;
	}

	lastError = OPROS_SUCCESS;

	PrintMessage("SUCCESS : JoystickComp::onInitialize()\n");
	return OPROS_SUCCESS;
}
开发者ID:yudonguk,项目名称:RemoteRobot,代码行数:82,代码来源:JoystickComp.cpp

示例15: findPaths

 yarp::os::Bottle findPaths(Property& config, const char *name) {
     ConstString fname = config.check(name,Value(name)).asString();
     Bottle paths;
     findFileBase(config,fname,true,paths,false);
     return paths;
 }
开发者ID:johnty,项目名称:libYARP_OS,代码行数:6,代码来源:ResourceFinder.cpp


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