shared_ptr<ProbabilisticSvmClassifier> ProbabilisticSvmClassifier::load(const ptree& subtree)
{
	path classifierFile = subtree.get<path>("classifierFile");
	shared_ptr<ProbabilisticSvmClassifier> psvm;
	if (classifierFile.extension() == ".mat") {
		psvm = loadFromMatlab(classifierFile.string(), subtree.get<string>("thresholdsFile"));
	} else {
		shared_ptr<SvmClassifier> svm = SvmClassifier::loadFromText(classifierFile.string()); // Todo: Make a ProbabilisticSvmClassifier::loadFromText(...)
		if (subtree.get("logisticA", 0.0) == 0.0 || subtree.get("logisticB", 0.0) == 0.0) {
			std::cout << "Warning, one or both sigmoid parameters not set in config, using default sigmoid parameters." << std::endl; // TODO use logger
		}
		psvm = make_shared<ProbabilisticSvmClassifier>(svm);
	}

	// If the user sets the logistic parameters in the config, overwrite the current settings with it
	double logisticA = subtree.get("logisticA", 0.0); // TODO: This is not so good, better use the try/catch of get(...). Because: What if the user actually sets a value of 0.0 in the config...
	double logisticB = subtree.get("logisticB", 0.0);
	if (logisticA != 0.0 && logisticB != 0.0) {
		psvm->setLogisticParameters(logisticA, logisticB);
	}

	psvm->getSvm()->setThreshold(subtree.get("threshold", 0.0f));

	return psvm;
}
Ejemplo n.º 2
0
User::Ptr TgTypeParser::parseJsonAndGetUser(const ptree& data) const {
	User::Ptr result(new User);
	result->id = data.get<int32_t>("id");
	result->firstName = data.get<string>("first_name");
	result->lastName = data.get("last_name", "");
	result->username = data.get("username", "");
	return result;
}
Ejemplo n.º 3
0
Contact::Ptr TgTypeParser::parseJsonAndGetContact(const ptree& data) const {
	Contact::Ptr result(new Contact);
	result->phoneNumber = data.get<string>("phone_number");
	result->firstName = data.get<string>("first_name");
	result->lastName = data.get("last_name", "");
	result->userId = data.get("user_id", "");
	return result;
}
Ejemplo n.º 4
0
Audio::Ptr TgTypeParser::parseJsonAndGetAudio(const ptree& data) const {
	Audio::Ptr result(new Audio);
	result->fileId = data.get<string>("file_id");
	result->duration = data.get<int32_t>("duration");
	result->mimeType = data.get("mime_type", "");
	result->fileSize = data.get("file_size", 0);
	return result;
}
Ejemplo n.º 5
0
Document::Ptr TgTypeParser::parseJsonAndGetDocument(const ptree& data) const {
	Document::Ptr result(new Document);
	result->fileId = data.get<string>("file_id");
	result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
	result->fileName = data.get("file_name", "");
	result->mimeType = data.get("mime_type", "");
	result->fileSize = data.get("file_size", 0);
	return result;
}
Ejemplo n.º 6
0
Video::Ptr TgTypeParser::parseJsonAndGetVideo(const ptree& data) const {
	Video::Ptr result(new Video);
	result->fileId = data.get<string>("file_id");
	result->width = data.get<int32_t>("width");
	result->height = data.get<int32_t>("height");
	result->duration = data.get<int32_t>("duration");
	result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
	result->mimeType = data.get("mime_type", "");
	result->fileSize = data.get("file_size", 0);
	return result;
}
	/*!
	 * \copydoc Base::Props::load
	 */
	void load(const ptree & pt)
	{
		device = pt.get("dev.device", "/dev/video0");
		input = pt.get("dev.input", "Composite1");
		norm = pt.get("dev.norm", "PAL-BG");
		format = pt.get("dev.format", "BGR3");
		width = pt.get("dev.width", 640);
		height = pt.get("dev.height", 480);

		brightness = pt.get("image.brightness", 0.5);
		contrast = pt.get("image.contrast", 0.5);
		saturation = pt.get("image.saturation", 0.5);
		hue = pt.get("image.hue", 0.5);
	}
Ejemplo n.º 8
0
//------------------------------------------------------------------------------
void
Image::set(ptree pt)
{
    if(pt.get_child_optional("UV"))        this->setUV(Box(pt.get_child("UV")), getBoolFromPT(pt, "UV.normalized", false));
    if(pt.get_child_optional("NinePatch")) this->setNinePatchData(NinePatchData(pt.get_child("NinePatch")));
    if(pt.get_child_optional("color"))     this->color = Color(pt.get("color", "#FFF"));
};
Ejemplo n.º 9
0
//------------------------------------------------------------------------------
void
WText::_set(ptree n)
{
	if(n.get_child_optional("text.content"))
		this->setText(n.get("text.content", this->text));

	if(n.get_child_optional("text.padding"))
		this->padding = n.get<FNumber>("text.padding");

	if(n.get_child_optional("text.font"))
	{
		if(n.get_child_optional("text.font.path") && n.get_child_optional("text.font.size"))
			this->setFont(this->kernel->graphicsMgr->loadFont(
													n.get<string>("text.font.path"),
													n.get<int>  ("text.font.size")));

		else if(n.get_child_optional("text.font.size"))
			this->setFontSize(n.get<int>("text.font.size"));

		else if(n.get_child_optional("text.font.path"))
			this->setFont(this->kernel->graphicsMgr->loadFont(
													n.get<string>("text.font.path"),
													this->font.getSize()));

		if(n.get_child_optional("text.font.color"))
			this->setColor(Color(n.get<string>("text.font.color")));

		if(n.get_child_optional("text.font.background_color"))
			this->setBG(Color(n.get<string>("text.font.background_color")));

		/// TODO: transparent [bool]

		/// TODO: alignment
	}
};
Ejemplo n.º 10
0
void
SpriteLine::set(ptree params)
{
	this->to  = Vect(params, "toX", "toY", this->to);
	this->col = params.get("color", this->col.getString());
	setBoolFromPT(params, "AA", this->AA);
};
Ejemplo n.º 11
0
Archivo: main.cpp Proyecto: CCJY/coliru
 template<class Type , class Translator> inline
 typename boost::enable_if<detail::is_translator<Translator>, Type>::type
 get(const std::string &argPath, const Type &argDefault, Translator tr) const {
     Type value = ptree_.get(argPath, argDefault);
     parameters_.insert(std::make_pair(argPath, value));
     return value;
 }
Ejemplo n.º 12
0
PhotoSize::Ptr TgTypeParser::parseJsonAndGetPhotoSize(const ptree& data) const {
	PhotoSize::Ptr result(new PhotoSize);
	result->fileId = data.get<string>("file_id");
	result->width = data.get<int32_t>("width");
	result->height = data.get<int32_t>("height");
	result->fileSize = data.get("file_size", 0);
	return result;
}
Ejemplo n.º 13
0
Sticker::Ptr TgTypeParser::parseJsonAndGetSticker(const ptree& data) const {
	Sticker::Ptr result(new Sticker);
	result->fileId = data.get<string>("file_id");
	result->width = data.get<int32_t>("width");
	result->height = data.get<int32_t>("height");
	result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
	result->fileSize = data.get("file_size", 0);
	return result;
}
Ejemplo n.º 14
0
    bool ConfigTree::paramFromPtree(ptree fromPtree, ConfigParameter &toParam)
    {
        CONFIGSYS_DEBUG_CALLS;

        std::string typStr = fromPtree.get<std::string>("type");
        value_type vt = stringToValueType(typStr);
        
        toParam = ConfigParameter(vt);

        toParam.setDescription(fromPtree.get("desc", ""));

        std::string modStr = fromPtree.get("modified", "false");
        toParam.setModified(modStr.compare("true") == 0);

        std::string lockStr = fromPtree.get("locked", "false");
        toParam.setLocked(lockStr.compare("true") == 0);

        return addPtreeValueandRangeToParam(fromPtree, toParam);
    }
shared_ptr<ProbabilisticWvmClassifier> ProbabilisticWvmClassifier::load(const ptree& subtree)
{
	pair<double, double> sigmoidParams = loadSigmoidParamsFromMatlab(subtree.get<string>("thresholdsFile"));
	// Load the detector and thresholds:
	shared_ptr<WvmClassifier> wvm = WvmClassifier::loadFromMatlab(subtree.get<string>("classifierFile"), subtree.get<string>("thresholdsFile"));
	shared_ptr<ProbabilisticWvmClassifier> pwvm = make_shared<ProbabilisticWvmClassifier>(wvm, sigmoidParams.first, sigmoidParams.second);

	pwvm->getWvm()->setLimitReliabilityFilter(subtree.get("threshold", 0.0f));

	return pwvm;
}
Ejemplo n.º 16
0
void ProjectConfiguration::ReadPtree(const ptree& pt,
									 const wxString& proj_path)
{
	project_title = pt.get("project.title", "");
	
	const ptree& subtree = pt.get_child("project.layers.layer");
	LayerConfiguration* layer_conf = new LayerConfiguration(subtree,
                                                            proj_path);
	layer_confs.push_back(layer_conf);

}
Ejemplo n.º 17
0
Chat::Ptr TgTypeParser::parseJsonAndGetChat(const ptree& data) const {
	Chat::Ptr result(new Chat);
	result->id = data.get<int64_t>("id");
	string type = data.get<string>("type");
	if (type == "private") {
		result->type = Chat::Type::Private;
	} else if (type == "group") {
		result->type = Chat::Type::Group;
	} else if (type == "supergroup") {
		result->type = Chat::Type::Supergroup;
	} else if (type == "channel") {
		result->type = Chat::Type::Channel;
	}
	result->title = data.get("title", "");
	result->username = data.get("username", "");
	result->firstName = data.get<string>("first_name", "");
	result->lastName = data.get("last_name", "");

	return result;
}
Ejemplo n.º 18
0
void CompPhysics::loadFromPropertyTree(const ptree& propTree)
{
    float linearDamping = propTree.get("damping.linear", 0.0f);
    float angularDamping = propTree.get("damping.angular", 0.0f);

    bool fixedRotation = propTree.get("isFixedRotation", false);

    bool isBullet = propTree.get("isBullet", false);

    Vector2D gravitationPoint;
    gravitationPoint.x = propTree.get("gravitationPoint.x", 0.0f);
    gravitationPoint.y = propTree.get("gravitationPoint.y", 0.0f);

    BodyDef body_def;
    body_def.angularDamping = angularDamping;
    body_def.fixedRotation = fixedRotation;
    body_def.bullet = isBullet;
    body_def.linearDamping = linearDamping;

    setLocalGravitationPoint(gravitationPoint);

    m_shapeInfos.clear();
    foreach(const ptree::value_type &v, propTree)
    {
        if (v.first != "shape")
            continue;

        const ptree& shapeProps = v.second;
        std::string shapeName = shapeProps.get<std::string>("comp_id");

        float density = shapeProps.get("density", 0.0f);
        float friction = shapeProps.get("friction", 0.0f);
        float restitution = shapeProps.get("restitution", 0.0f);

        bool isSensor = shapeProps.get("isSensor", false);

        addShapeDef(boost::make_shared<ShapeDef>(shapeName, density, friction, restitution, isSensor));
    }

    setBodyDef(body_def);
}
Ejemplo n.º 19
0
Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const {
	Message::Ptr result(new Message);
	result->messageId = data.get<int32_t>("message_id");
	result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
	result->date = data.get<int32_t>("date");
	result->chat = parseJsonAndGetChat(data.find("chat")->second);
	result->forwardFrom = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "forward_from");
	result->forwardDate = data.get("forward_date", 0);
	result->replyToMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message");
	result->text = data.get("text", "");
	result->audio = tryParseJson<Audio>(&TgTypeParser::parseJsonAndGetAudio, data, "audio");
	result->document = tryParseJson<Document>(&TgTypeParser::parseJsonAndGetDocument, data, "document");
	result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");
	result->sticker = tryParseJson<Sticker>(&TgTypeParser::parseJsonAndGetSticker, data, "sticker");
	result->video = tryParseJson<Video>(&TgTypeParser::parseJsonAndGetVideo, data, "video");
	result->contact = tryParseJson<Contact>(&TgTypeParser::parseJsonAndGetContact, data, "contact");
	result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
	result->newChatParticipant = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "new_chat_participant");
	result->leftChatParticipant = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "left_chat_participant");
	result->newChatTitle = data.get("new_chat_title", "");
	result->newChatPhoto = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "new_chat_photo");
	result->deleteChatPhoto = data.get("delete_chat_photo", false);
	result->groupChatCreated = data.get("group_chat_created", false);
	result->caption = data.get("caption", false);
	return result;
}
Ejemplo n.º 20
0
void LayerConfiguration::ReadPtree(const ptree& pt,
								   const wxString& proj_path)
{
    layer_title = pt.get("title", "");
	
	// create DataSource instance from <datasource>...
	const ptree& subtree = pt.get_child("datasource");
	string type_str = subtree.get<string>("type");
	datasource = IDataSource::CreateDataSource(type_str, subtree, proj_path);

	layer_name = pt.get("layername", "");

	// create VarOrderPtree instance from <variable_order>...
	if (!variable_order) variable_order = new VarOrderPtree(pt, proj_path);
	// create CustomClassifPtree instance from <custom_classifications>...
	if (!custom_classifs) custom_classifs = new CustomClassifPtree(pt,
																   proj_path);
	// create WeightsManPtree instance from <spatial_weights>...
	if (!spatial_weights) spatial_weights = new WeightsManPtree(pt, proj_path);
	// create DefaultVarsPtree instance from <default_vars>...
	if (!default_vars) default_vars = new DefaultVarsPtree(pt, proj_path);
}
Ejemplo n.º 21
0
void CameraProps::load(const ptree & pt) {
	LOG(LINFO) << "Loading settings for CameraV4L\n";
	device   =              pt.get("device.device", "/dev/video0");
	io       = convIOMethod(pt.get("device.io", "MMAP"));
	standard = convStandard(pt.get("device.video_standard", "PAL"));
	width    =              pt.get("device.width", 640);
	height   =              pt.get("device.height", 480);
	channel  =              pt.get("device.channel", "Composite");
}
Ejemplo n.º 22
0
	void load(const ptree & pt) {
		directory = pt.get("directory", ".");
		pattern = pt.get("pattern", ".*\\.(jpg|png|bmp)");

		sort = pt.get("sort", true);
		prefetch = pt.get("prefetch", false);


		triggered = pt.get("triggered", false);

		loop = pt.get("loop", false);
	}
Ejemplo n.º 23
0
bool Config::save(const std::string &filename)
{
    // Save stuff
    pt_config.put("video.mode",               video.mode);
    pt_config.put("video.window.scale",       video.scale);
    pt_config.put("video.scanlines",          video.scanlines);
    pt_config.put("video.fps",                video.fps);
    pt_config.put("video.widescreen",         video.widescreen);
    pt_config.put("video.hires",              video.hires);

    pt_config.put("sound.enable",             sound.enabled);
    pt_config.put("sound.advertise",          sound.advertise);
    pt_config.put("sound.preview",            sound.preview);
    pt_config.put("sound.fix_samples",        sound.fix_samples);

    pt_config.put("controls.gear",            controls.gear);
    pt_config.put("controls.steerspeed",      controls.steer_speed);
    pt_config.put("controls.pedalspeed",      controls.pedal_speed);
    pt_config.put("controls.keyconfig.up",    controls.keyconfig[0]);
    pt_config.put("controls.keyconfig.down",  controls.keyconfig[1]);
    pt_config.put("controls.keyconfig.left",  controls.keyconfig[2]);
    pt_config.put("controls.keyconfig.right", controls.keyconfig[3]);
    pt_config.put("controls.keyconfig.acc",   controls.keyconfig[4]);
    pt_config.put("controls.keyconfig.brake", controls.keyconfig[5]);
    pt_config.put("controls.keyconfig.gear1", controls.keyconfig[6]);
    pt_config.put("controls.keyconfig.gear2", controls.keyconfig[7]);
    pt_config.put("controls.keyconfig.start", controls.keyconfig[8]);
    pt_config.put("controls.keyconfig.coin",  controls.keyconfig[9]);
    pt_config.put("controls.keyconfig.menu",  controls.keyconfig[10]);
    pt_config.put("controls.keyconfig.view",  controls.keyconfig[11]);
    pt_config.put("controls.padconfig.acc",   controls.padconfig[0]);
    pt_config.put("controls.padconfig.brake", controls.padconfig[1]);
    pt_config.put("controls.padconfig.gear1", controls.padconfig[2]);
    pt_config.put("controls.padconfig.gear2", controls.padconfig[3]);
    pt_config.put("controls.padconfig.start", controls.padconfig[4]);
    pt_config.put("controls.padconfig.coin",  controls.padconfig[5]);
    pt_config.put("controls.padconfig.menu",  controls.padconfig[6]);
    pt_config.put("controls.padconfig.view",  controls.padconfig[7]);
    pt_config.put("controls.analog.<xmlattr>.enabled", controls.analog);

    pt_config.put("engine.time", engine.freeze_timer ? 4 : engine.dip_time);
    pt_config.put("engine.traffic", engine.disable_traffic ? 4 : engine.dip_traffic);
    pt_config.put("engine.japanese_tracks", engine.jap);
    pt_config.put("engine.prototype", engine.prototype);
    pt_config.put("engine.levelobjects", engine.level_objects);
    pt_config.put("engine.new_attract", engine.new_attract);

    pt_config.put("time_trial.laps",    ttrial.laps);
    pt_config.put("time_trial.traffic", ttrial.traffic);
    pt_config.put("continuous.traffic", cont_traffic), 

    ttrial.laps    = pt_config.get("time_trial.laps",    5);
    ttrial.traffic = pt_config.get("time_trial.traffic", 3);
    cont_traffic   = pt_config.get("continuous.traffic", 3);

    try
    {
        write_xml(filename, pt_config, std::locale(), xml_writer_settings('\t', 1)); // Tab space 1
    }
    catch (std::exception &e)
    {
        std::cout << "Error saving config: " << e.what() << "\n";
        return false;
    }
    return true;
}
Ejemplo n.º 24
0
	/*!
	 * \copydoc Base::Props::load
	 */
	void load(const ptree & pt)
	{
		type = str2type(pt.get("type", "binary"));
		maxval = pt.get("maxval", 1.0);
		thresh = pt.get("thresh", 0.5);
	}
Ejemplo n.º 25
0
void Config::load(const std::string &filename)
{
    // Load XML file and put its contents in property tree. 
    // No namespace qualification is needed, because of Koenig 
    // lookup on the second argument. If reading fails, exception
    // is thrown.
    try
    {
        read_xml(filename, pt_config, boost::property_tree::xml_parser::trim_whitespace);
    }
    catch (... /*std::exception &e*/)
    {
        //std::cout << "Error: " << e.what() << "\n";
        return;
    }

    // ------------------------------------------------------------------------
    // Menu Settings
    // ------------------------------------------------------------------------

    menu.enabled           = pt_config.get("menu.enabled",   1);
    menu.road_scroll_speed = pt_config.get("menu.roadspeed", 50);

    // ------------------------------------------------------------------------
    // Video Settings
    // ------------------------------------------------------------------------
   
    video.mode       = pt_config.get("video.mode",               0); // Video Mode: Default is Windowed 
    video.scale      = pt_config.get("video.window.scale",       2); // Video Scale: Default is 2x    
    video.scanlines  = pt_config.get("video.scanlines",          0); // Scanlines
    video.fps        = pt_config.get("video.fps",                2); // Default is 60 fps
    video.fps_count  = pt_config.get("video.fps_counter",        0); // FPS Counter
    video.widescreen = pt_config.get("video.widescreen",         1); // Enable Widescreen Mode
    video.hires      = pt_config.get("video.hires",              0); // Hi-Resolution Mode
    video.filtering  = pt_config.get("video.filtering",          0); // Open GL Filtering Mode
          
    set_fps(video.fps);

    // ------------------------------------------------------------------------
    // Sound Settings
    // ------------------------------------------------------------------------
    sound.enabled     = pt_config.get("sound.enable",      1);
    sound.advertise   = pt_config.get("sound.advertise",   1);
    sound.preview     = pt_config.get("sound.preview",     1);
    sound.fix_samples = pt_config.get("sound.fix_samples", 1);

    // Custom Music
    for (int i = 0; i < 4; i++)
    {
        std::string xmltag = "sound.custom_music.track";
        xmltag += Utils::to_string(i+1);  

        sound.custom_music[i].enabled = pt_config.get(xmltag + ".<xmlattr>.enabled", 0);
        sound.custom_music[i].title   = pt_config.get(xmltag + ".title", "TRACK " +Utils::to_string(i+1));
        sound.custom_music[i].filename= pt_config.get(xmltag + ".filename", "track"+Utils::to_string(i+1)+".wav");
    }

    // ------------------------------------------------------------------------
    // CannonBoard Settings
    // ------------------------------------------------------------------------
    cannonboard.enabled = pt_config.get("cannonboard.<xmlattr>.enabled", 0);
    cannonboard.port    = pt_config.get("cannonboard.port", "COM6");
    cannonboard.baud    = pt_config.get("cannonboard.baud", 57600);
    cannonboard.debug   = pt_config.get("cannonboard.debug", 0);
    cannonboard.cabinet = pt_config.get("cannonboard.cabinet", 0);

    // ------------------------------------------------------------------------
    // Controls
    // ------------------------------------------------------------------------
    controls.gear          = pt_config.get("controls.gear", 0);
    controls.steer_speed   = pt_config.get("controls.steerspeed", 3);
    controls.pedal_speed   = pt_config.get("controls.pedalspeed", 4);
    controls.keyconfig[0]  = pt_config.get("controls.keyconfig.up",    273);
    controls.keyconfig[1]  = pt_config.get("controls.keyconfig.down",  274);
    controls.keyconfig[2]  = pt_config.get("controls.keyconfig.left",  276);
    controls.keyconfig[3]  = pt_config.get("controls.keyconfig.right", 275);
    controls.keyconfig[4]  = pt_config.get("controls.keyconfig.acc",   122);
    controls.keyconfig[5]  = pt_config.get("controls.keyconfig.brake", 120);
    controls.keyconfig[6]  = pt_config.get("controls.keyconfig.gear1", 32);
    controls.keyconfig[7]  = pt_config.get("controls.keyconfig.gear2", 32);
    controls.keyconfig[8]  = pt_config.get("controls.keyconfig.start", 49);
    controls.keyconfig[9]  = pt_config.get("controls.keyconfig.coin",  53);
    controls.keyconfig[10] = pt_config.get("controls.keyconfig.menu",  286);
    controls.keyconfig[11] = pt_config.get("controls.keyconfig.view",  304);
    controls.padconfig[0]  = pt_config.get("controls.padconfig.acc",   0);
    controls.padconfig[1]  = pt_config.get("controls.padconfig.brake", 1);
    controls.padconfig[2]  = pt_config.get("controls.padconfig.gear1", 2);
    controls.padconfig[3]  = pt_config.get("controls.padconfig.gear2", 2);
    controls.padconfig[4]  = pt_config.get("controls.padconfig.start", 3);
    controls.padconfig[5]  = pt_config.get("controls.padconfig.coin",  4);
    controls.padconfig[6]  = pt_config.get("controls.padconfig.menu",  5);
    controls.padconfig[7]  = pt_config.get("controls.padconfig.view",  6);
    controls.analog        = pt_config.get("controls.analog.<xmlattr>.enabled", 0);
    controls.pad_id        = pt_config.get("controls.pad_id", 0);
    controls.axis[0]       = pt_config.get("controls.analog.axis.wheel", 0);
    controls.axis[1]       = pt_config.get("controls.analog.axis.accel", 2);
    controls.axis[2]       = pt_config.get("controls.analog.axis.brake", 3);
    controls.asettings[0]  = pt_config.get("controls.analog.wheel.zone", 75);
    controls.asettings[1]  = pt_config.get("controls.analog.wheel.dead", 0);
    controls.asettings[2]  = pt_config.get("controls.analog.pedals.dead", 0);
    
    controls.haptic        = pt_config.get("controls.analog.haptic.<xmlattr>.enabled", 0);
    controls.max_force     = pt_config.get("controls.analog.haptic.max_force", 9000);
    controls.min_force     = pt_config.get("controls.analog.haptic.min_force", 8500);
    controls.force_duration= pt_config.get("controls.analog.haptic.force_duration", 20);

    // ------------------------------------------------------------------------
    // Engine Settings
    // ------------------------------------------------------------------------

    engine.dip_time      = pt_config.get("engine.time",    0);
    engine.dip_traffic   = pt_config.get("engine.traffic", 1);
    
    engine.freeze_timer    = engine.dip_time == 4;
    engine.disable_traffic = engine.dip_traffic == 4;
    engine.dip_time    &= 3;
    engine.dip_traffic &= 3;

    engine.freeplay      = pt_config.get("engine.freeplay",        0) != 0;
    engine.jap           = pt_config.get("engine.japanese_tracks", 0);
    engine.prototype     = pt_config.get("engine.prototype",       0);
    
    // Additional Level Objects
    engine.level_objects   = pt_config.get("engine.levelobjects", 1);
    engine.randomgen       = pt_config.get("engine.randomgen",    1);
    engine.fix_bugs_backup = 
    engine.fix_bugs        = pt_config.get("engine.fix_bugs",     1) != 0;
    engine.fix_timer       = pt_config.get("engine.fix_timer",    0) != 0;
    engine.layout_debug    = pt_config.get("engine.layout_debug", 0) != 0;
    engine.new_attract     = pt_config.get("engine.new_attract", 1) != 0;

    // ------------------------------------------------------------------------
    // Time Trial Mode
    // ------------------------------------------------------------------------

    ttrial.laps    = pt_config.get("time_trial.laps",    5);
    ttrial.traffic = pt_config.get("time_trial.traffic", 3);

    cont_traffic   = pt_config.get("continuous.traffic", 3);
}
Ejemplo n.º 26
0
	virtual void load(const ptree & pt) {
		sigma = pt.get("sigma", 0.1);
		mean = pt.get("mean", 0.0);
	}
Ejemplo n.º 27
0
	/*!
	 * Load executor settings from given configuration node
	 */
	void load(const ptree & pt) {
		max_iter = pt.get("iterations", -1);
		mk_name = pt.get("main_component", "");
	}
Ejemplo n.º 28
0
		return false;
	}
	m_root = r;
	return true;
}

TEST_CASE("Validate basic ptree functionality", "[ptree]") {
        ptree a;
        ptree b;
        ptree c;

	// Verify basic get woks
        a.set("Hello", "World");
        a.set("foo", "bar");
        a.set("baz", "quxx");
	REQUIRE(a.get("foo") == "bar");
	// Verify copies are distinct
        b = a;
        a.set("foo", "");
        REQUIRE(b.get("foo") == "bar");
        REQUIRE(a.get("foo") == "");
	// Verify merkle hashes are canonical and unique
        c.set("Hello", "World");
        c.set("baz", "quxx");
        REQUIRE(a.merkle() == c.merkle());
        REQUIRE(a.merkle() != b.merkle());
	// Verify size works
	REQUIRE(a.size() == 2);
	REQUIRE(b.size() == 3);
	REQUIRE(c.size() == 2);
}
Ejemplo n.º 29
0
	virtual void load(const ptree & pt) {
		mask = pt.get("mask", 0xFF);
	}
Ejemplo n.º 30
0
ImageToFeatures::ImageToFeatures(const ptree& ini)
{
	m_numOfFeatures = ini.get("ImageToFeatures.NumberOfFeatures", 200);
	m_minimalMatchDistance = ini.get("ImageToFeatures.Distance", 150.0f);
}