From a5fffddd70ab601c8584fddec564b52c734f9bab Mon Sep 17 00:00:00 2001 From: Helge Norberg Date: Wed, 2 Dec 2015 20:17:45 +0100 Subject: [PATCH] Started using ptree_get, ptree_get_value, witerate_children and welement_context_iteration where it is relevant --- core/frame/audio_channel_layout.cpp | 22 ++-- core/producer/scene/scene_cg_proxy.cpp | 10 +- core/producer/scene/xml_scene_producer.cpp | 120 ++++++++++-------- .../bluefish/consumer/bluefish_consumer.cpp | 2 + .../decklink/consumer/decklink_consumer.cpp | 2 + modules/ffmpeg/consumer/ffmpeg_consumer.cpp | 3 +- .../ffmpeg/consumer/streaming_consumer.cpp | 3 +- modules/oal/consumer/oal_consumer.cpp | 2 + shell/main.cpp | 7 +- shell/server.cpp | 31 +++-- 10 files changed, 125 insertions(+), 77 deletions(-) diff --git a/core/frame/audio_channel_layout.cpp b/core/frame/audio_channel_layout.cpp index 40f43a018..956830d85 100644 --- a/core/frame/audio_channel_layout.cpp +++ b/core/frame/audio_channel_layout.cpp @@ -23,6 +23,8 @@ #include "audio_channel_layout.h" +#include + #include #include #include @@ -128,13 +130,13 @@ void audio_channel_layout_repository::register_all_layouts(const boost::property auto& self = *impl_; boost::lock_guard lock(self.mutex_); - for (auto& layout : layouts) + for (auto& layout : layouts | welement_context_iteration) { - CASPAR_VERIFY(layout.first == L"channel-layout"); + ptree_verify_element_name(layout, L"channel-layout"); - auto name = layout.second.get(L".name"); - auto type = layout.second.get(L".type"); - auto num_channels = layout.second.get(L".num-channels"); + auto name = ptree_get(layout.second, L".name"); + auto type = ptree_get(layout.second, L".type"); + auto num_channels = ptree_get(layout.second, L".num-channels"); auto channel_order = layout.second.get(L".channel-order", L""); boost::to_upper(name); @@ -192,13 +194,13 @@ void audio_mix_config_repository::register_all_configs(const boost::property_tre auto& self = *impl_; boost::lock_guard lock(self.mutex_); - for (auto& config : configs) + for (auto& config : configs | welement_context_iteration) { - CASPAR_VERIFY(config.first == L"mix-config"); + ptree_verify_element_name(config, L"mix-config"); - auto from_type = config.second.get(L".from-type"); - auto to_types_str = config.second.get(L".to-types"); - auto mix_config = config.second.get(L".mix"); + auto from_type = ptree_get(config.second, L".from-type"); + auto to_types_str = ptree_get(config.second, L".to-types"); + auto mix_config = ptree_get(config.second, L".mix"); boost::to_upper(from_type); std::vector to_types; diff --git a/core/producer/scene/scene_cg_proxy.cpp b/core/producer/scene/scene_cg_proxy.cpp index a741aae5e..5e6d05235 100644 --- a/core/producer/scene/scene_cg_proxy.cpp +++ b/core/producer/scene/scene_cg_proxy.cpp @@ -23,6 +23,8 @@ #include "scene_cg_proxy.h" +#include + #include #include @@ -95,10 +97,12 @@ void scene_cg_proxy::update(int layer, const std::wstring& data) std::vector parameters; - for (auto value : root.get_child(L"templateData")) + for (auto value : root | witerate_children(L"templateData") | welement_context_iteration) { - auto id = value.second.get(L".id"); - auto val = value.second.get(L"data..value"); + ptree_verify_element_name(value, L"componentData"); + + auto id = ptree_get(value.second, L".id"); + auto val = ptree_get(value.second, L"data..value"); parameters.push_back(std::move(id)); parameters.push_back(std::move(val)); diff --git a/core/producer/scene/xml_scene_producer.cpp b/core/producer/scene/xml_scene_producer.cpp index bc97a3f6c..592fc172d 100644 --- a/core/producer/scene/xml_scene_producer.cpp +++ b/core/producer/scene/xml_scene_producer.cpp @@ -31,6 +31,8 @@ #include #include +#include +#include #include #include #include @@ -88,6 +90,8 @@ spl::shared_ptr create_xml_scene_producer( std::wstring filename = *found; + CASPAR_SCOPED_CONTEXT_MSG(get_relative(filename, env::template_folder()).string() + ": "); + boost::property_tree::wptree root; boost::filesystem::wifstream file(filename); boost::property_tree::read_xml( @@ -96,17 +100,19 @@ spl::shared_ptr create_xml_scene_producer( boost::property_tree::xml_parser::trim_whitespace | boost::property_tree::xml_parser::no_comments); - int width = root.get(L"scene..width"); - int height = root.get(L"scene..height"); + int width = ptree_get(root, L"scene..width"); + int height = ptree_get(root, L"scene..height"); auto scene = spl::make_shared(L"scene", width, height, dependencies.format_desc); - for (auto elem : root.get_child(L"scene.variables")) + for (auto elem : root | witerate_children(L"scene.variables") | welement_context_iteration) { - auto type = elem.second.get(L".type"); - auto id = elem.second.get(L".id"); - auto is_public = elem.second.get(L".public", false); - auto expr = elem.second.get_value(); + ptree_verify_element_name(elem, L"variable"); + + auto type = ptree_get(elem.second, L".type"); + auto id = ptree_get(elem.second, L".id"); + auto is_public = elem.second.get(L".public", false); + auto expr = ptree_get_value(elem.second); if (!is_public) id = L"variable." + id; @@ -119,40 +125,47 @@ spl::shared_ptr create_xml_scene_producer( scene->create_variable(id, is_public, expr); } - for (auto& elem : root.get_child(L"scene.layers")) + for (auto& elem : root | witerate_children(L"scene.layers") | welement_context_iteration) { - auto id = elem.second.get(L".id"); - auto producer = dependencies.producer_registry->create_producer(dependencies, elem.second.get(L"producer")); - auto& layer = scene->create_layer(producer, 0, 0, id); - auto variable_prefix = L"layer." + id + L"."; - - layer.hidden = scene->create_variable(variable_prefix + L"hidden", false, elem.second.get(L"hidden", L"false")); - layer.position.x = scene->create_variable(variable_prefix + L"x", false, elem.second.get(L"x")); - layer.position.y = scene->create_variable(variable_prefix + L"y", false, elem.second.get(L"y")); - layer.anchor.x = scene->create_variable(variable_prefix + L"anchor_x", false, elem.second.get(L"anchor_x", L"0.0")); - layer.anchor.y = scene->create_variable(variable_prefix + L"anchor_y", false, elem.second.get(L"anchor_y", L"0.0")); - layer.rotation = scene->create_variable(variable_prefix + L"rotation", false, elem.second.get(L"rotation", L"0.0")); - layer.crop.upper_left.x = scene->create_variable(variable_prefix + L"crop_upper_left_x", false, elem.second.get(L"crop_upper_left_x", L"0.0")); - layer.crop.upper_left.y = scene->create_variable(variable_prefix + L"crop_upper_left_y", false, elem.second.get(L"crop_upper_left_y", L"0.0")); - layer.crop.lower_right.x = scene->create_variable(variable_prefix + L"crop_lower_right_x", false, elem.second.get(L"crop_lower_right_x", layer.producer.get()->pixel_constraints().width.as().get())); - layer.crop.lower_right.y = scene->create_variable(variable_prefix + L"crop_lower_right_y", false, elem.second.get(L"crop_lower_right_y", layer.producer.get()->pixel_constraints().height.as().get())); - layer.perspective.upper_left.x = scene->create_variable(variable_prefix + L"perspective_upper_left_x", false, elem.second.get(L"perspective_upper_left_x", L"0.0")); - layer.perspective.upper_left.y = scene->create_variable(variable_prefix + L"perspective_upper_left_y", false, elem.second.get(L"perspective_upper_left_y", L"0.0")); - layer.perspective.upper_right.x = scene->create_variable(variable_prefix + L"perspective_upper_right_x", false, elem.second.get(L"perspective_upper_right_x", layer.producer.get()->pixel_constraints().width.as().get())); - layer.perspective.upper_right.y = scene->create_variable(variable_prefix + L"perspective_upper_right_y", false, elem.second.get(L"perspective_upper_right_y", L"0.0")); - layer.perspective.lower_right.x = scene->create_variable(variable_prefix + L"perspective_lower_right_x", false, elem.second.get(L"perspective_lower_right_x", layer.producer.get()->pixel_constraints().width.as().get())); - layer.perspective.lower_right.y = scene->create_variable(variable_prefix + L"perspective_lower_right_y", false, elem.second.get(L"perspective_lower_right_y", layer.producer.get()->pixel_constraints().height.as().get())); - layer.perspective.lower_left.x = scene->create_variable(variable_prefix + L"perspective_lower_left_x", false, elem.second.get(L"perspective_lower_left_x", L"0.0")); - layer.perspective.lower_left.y = scene->create_variable(variable_prefix + L"perspective_lower_left_y", false, elem.second.get(L"perspective_lower_left_y", layer.producer.get()->pixel_constraints().height.as().get())); - - layer.adjustments.opacity = scene->create_variable(variable_prefix + L"adjustment.opacity", false, elem.second.get(L"adjustments.opacity", L"1.0")); - layer.is_key = scene->create_variable(variable_prefix + L"is_key", false, elem.second.get(L"is_key", L"false")); - layer.use_mipmap = scene->create_variable(variable_prefix + L"use_mipmap", false, elem.second.get(L"use_mipmap", L"false")); - layer.blend_mode = scene->create_variable(variable_prefix + L"blend_mode", false, elem.second.get(L"blend_mode", L"normal")).transformed([](const std::wstring& b) { return get_blend_mode(b); }); - layer.chroma_key.key = scene->create_variable(variable_prefix + L"chroma_key.key", false, elem.second.get(L"chroma_key.key", L"none")).transformed([](const std::wstring& k) { return get_chroma_mode(k); }); - layer.chroma_key.threshold = scene->create_variable(variable_prefix + L"chroma_key.threshold", false, elem.second.get(L"chroma_key.threshold", L"0.0")); - layer.chroma_key.softness = scene->create_variable(variable_prefix + L"chroma_key.softness", false, elem.second.get(L"chroma_key.softness", L"0.0")); - layer.chroma_key.spill = scene->create_variable(variable_prefix + L"chroma_key.spill", false, elem.second.get(L"chroma_key.spill", L"0.0")); + ptree_verify_element_name(elem, L"layer"); + + auto id = ptree_get(elem.second, L".id"); + auto producer_string = ptree_get(elem.second, L"producer"); + auto producer = [&] + { + CASPAR_SCOPED_CONTEXT_MSG(" -> "); + return dependencies.producer_registry->create_producer(dependencies, producer_string); + }(); + auto& layer = scene->create_layer(producer, 0, 0, id); + auto variable_prefix = L"layer." + id + L"."; + + layer.hidden = scene->create_variable(variable_prefix + L"hidden", false, elem.second.get(L"hidden", L"false")); + layer.position.x = scene->create_variable(variable_prefix + L"x", false, ptree_get(elem.second, L"x")); + layer.position.y = scene->create_variable(variable_prefix + L"y", false, ptree_get(elem.second, L"y")); + layer.anchor.x = scene->create_variable(variable_prefix + L"anchor_x", false, elem.second.get(L"anchor_x", L"0.0")); + layer.anchor.y = scene->create_variable(variable_prefix + L"anchor_y", false, elem.second.get(L"anchor_y", L"0.0")); + layer.rotation = scene->create_variable(variable_prefix + L"rotation", false, elem.second.get(L"rotation", L"0.0")); + layer.crop.upper_left.x = scene->create_variable(variable_prefix + L"crop_upper_left_x", false, elem.second.get(L"crop_upper_left_x", L"0.0")); + layer.crop.upper_left.y = scene->create_variable(variable_prefix + L"crop_upper_left_y", false, elem.second.get(L"crop_upper_left_y", L"0.0")); + layer.crop.lower_right.x = scene->create_variable(variable_prefix + L"crop_lower_right_x", false, elem.second.get(L"crop_lower_right_x", layer.producer.get()->pixel_constraints().width.as().get())); + layer.crop.lower_right.y = scene->create_variable(variable_prefix + L"crop_lower_right_y", false, elem.second.get(L"crop_lower_right_y", layer.producer.get()->pixel_constraints().height.as().get())); + layer.perspective.upper_left.x = scene->create_variable(variable_prefix + L"perspective_upper_left_x", false, elem.second.get(L"perspective_upper_left_x", L"0.0")); + layer.perspective.upper_left.y = scene->create_variable(variable_prefix + L"perspective_upper_left_y", false, elem.second.get(L"perspective_upper_left_y", L"0.0")); + layer.perspective.upper_right.x = scene->create_variable(variable_prefix + L"perspective_upper_right_x", false, elem.second.get(L"perspective_upper_right_x", layer.producer.get()->pixel_constraints().width.as().get())); + layer.perspective.upper_right.y = scene->create_variable(variable_prefix + L"perspective_upper_right_y", false, elem.second.get(L"perspective_upper_right_y", L"0.0")); + layer.perspective.lower_right.x = scene->create_variable(variable_prefix + L"perspective_lower_right_x", false, elem.second.get(L"perspective_lower_right_x", layer.producer.get()->pixel_constraints().width.as().get())); + layer.perspective.lower_right.y = scene->create_variable(variable_prefix + L"perspective_lower_right_y", false, elem.second.get(L"perspective_lower_right_y", layer.producer.get()->pixel_constraints().height.as().get())); + layer.perspective.lower_left.x = scene->create_variable(variable_prefix + L"perspective_lower_left_x", false, elem.second.get(L"perspective_lower_left_x", L"0.0")); + layer.perspective.lower_left.y = scene->create_variable(variable_prefix + L"perspective_lower_left_y", false, elem.second.get(L"perspective_lower_left_y", layer.producer.get()->pixel_constraints().height.as().get())); + + layer.adjustments.opacity = scene->create_variable(variable_prefix + L"adjustment.opacity", false, elem.second.get(L"adjustments.opacity", L"1.0")); + layer.is_key = scene->create_variable(variable_prefix + L"is_key", false, elem.second.get(L"is_key", L"false")); + layer.use_mipmap = scene->create_variable(variable_prefix + L"use_mipmap", false, elem.second.get(L"use_mipmap", L"false")); + layer.blend_mode = scene->create_variable(variable_prefix + L"blend_mode", false, elem.second.get(L"blend_mode", L"normal")).transformed([](const std::wstring& b) { return get_blend_mode(b); }); + layer.chroma_key.key = scene->create_variable(variable_prefix + L"chroma_key.key", false, elem.second.get(L"chroma_key.key", L"none")).transformed([](const std::wstring& k) { return get_chroma_mode(k); }); + layer.chroma_key.threshold = scene->create_variable(variable_prefix + L"chroma_key.threshold", false, elem.second.get(L"chroma_key.threshold", L"0.0")); + layer.chroma_key.softness = scene->create_variable(variable_prefix + L"chroma_key.softness", false, elem.second.get(L"chroma_key.softness", L"0.0")); + layer.chroma_key.spill = scene->create_variable(variable_prefix + L"chroma_key.spill", false, elem.second.get(L"chroma_key.spill", L"0.0")); scene->create_variable(variable_prefix + L"width", false) = layer.producer.get()->pixel_constraints().width; scene->create_variable(variable_prefix + L"height", false) = layer.producer.get()->pixel_constraints().height; @@ -173,32 +186,38 @@ spl::shared_ptr create_xml_scene_producer( if (root.get_child_optional(L"scene.marks")) { - for (auto& mark : root.get_child(L"scene.marks")) + for (auto& mark : root | witerate_children(L"scene.marks") | welement_context_iteration) { - auto at = mark.second.get(L".at"); - auto type = get_mark_action(mark.second.get(L".type")); - auto label = mark.second.get(L".label", L""); + ptree_verify_element_name(mark, L"mark"); + + auto at = ptree_get(mark.second, L".at"); + auto type = get_mark_action(ptree_get(mark.second, L".type")); + auto label = mark.second.get(L".label", L""); scene->add_mark(at, type, label); } } - for (auto& elem : root.get_child(L"scene.timelines")) + for (auto& elem : root | witerate_children(L"scene.timelines") | welement_context_iteration) { - auto& variable = scene->get_variable(elem.second.get(L".variable")); + ptree_verify_element_name(elem, L"timeline"); + + auto& variable = scene->get_variable(ptree_get(elem.second, L".variable")); for (auto& k : elem.second) { if (k.first == L"") continue; - auto easing = k.second.get(L".easing", L""); - auto at = k.second.get(L".at"); + ptree_verify_element_name(k, L"keyframe"); + + auto easing = k.second.get(L".easing", L""); + auto at = ptree_get(k.second, L".at"); if (variable.is()) - scene->add_keyframe(variable.as(), k.second.get_value(), at, easing); + scene->add_keyframe(variable.as(), ptree_get_value(k.second), at, easing); else if (variable.is()) - scene->add_keyframe(variable.as(), k.second.get_value(), at, easing); + scene->add_keyframe(variable.as(), ptree_get_value(k.second), at, easing); } } @@ -209,6 +228,7 @@ spl::shared_ptr create_xml_scene_producer( for (auto& var_name : scene->get_variables()) { + CASPAR_SCOPED_CONTEXT_MSG(L"/scene/variables/variable[@id=" + var_name + L"]/text()"); deduce_expression(scene->get_variable(var_name), repo); } diff --git a/modules/bluefish/consumer/bluefish_consumer.cpp b/modules/bluefish/consumer/bluefish_consumer.cpp index 17d2f2db8..50529d9f1 100644 --- a/modules/bluefish/consumer/bluefish_consumer.cpp +++ b/modules/bluefish/consumer/bluefish_consumer.cpp @@ -498,6 +498,8 @@ spl::shared_ptr create_preconfigured_consumer( if (channel_layout) { + CASPAR_SCOPED_CONTEXT_MSG("/channel-layout") + auto found_layout = core::audio_channel_layout_repository::get_default()->get_layout(*channel_layout); if (!found_layout) diff --git a/modules/decklink/consumer/decklink_consumer.cpp b/modules/decklink/consumer/decklink_consumer.cpp index 7d5454255..2031d19d6 100644 --- a/modules/decklink/consumer/decklink_consumer.cpp +++ b/modules/decklink/consumer/decklink_consumer.cpp @@ -866,6 +866,8 @@ spl::shared_ptr create_preconfigured_consumer( if (channel_layout) { + CASPAR_SCOPED_CONTEXT_MSG("/channel-layout") + auto found_layout = core::audio_channel_layout_repository::get_default()->get_layout(*channel_layout); if (!found_layout) diff --git a/modules/ffmpeg/consumer/ffmpeg_consumer.cpp b/modules/ffmpeg/consumer/ffmpeg_consumer.cpp index 40a192924..84c7aa15c 100644 --- a/modules/ffmpeg/consumer/ffmpeg_consumer.cpp +++ b/modules/ffmpeg/consumer/ffmpeg_consumer.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -926,7 +927,7 @@ spl::shared_ptr create_consumer( spl::shared_ptr create_preconfigured_consumer( const boost::property_tree::wptree& ptree, core::interaction_sink*) { - auto filename = ptree.get(L"path"); + auto filename = ptree_get(ptree, L"path"); auto codec = ptree.get(L"vcodec", L"libx264"); auto separate_key = ptree.get(L"separate-key", false); diff --git a/modules/ffmpeg/consumer/streaming_consumer.cpp b/modules/ffmpeg/consumer/streaming_consumer.cpp index f8daf9199..2ba5f0329 100644 --- a/modules/ffmpeg/consumer/streaming_consumer.cpp +++ b/modules/ffmpeg/consumer/streaming_consumer.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -1299,7 +1300,7 @@ spl::shared_ptr create_preconfigured_streaming_consumer( const boost::property_tree::wptree& ptree, core::interaction_sink*) { return spl::make_shared( - u8(ptree.get(L"path")), + u8(ptree_get(ptree, L"path")), u8(ptree.get(L"args", L"")), false); } diff --git a/modules/oal/consumer/oal_consumer.cpp b/modules/oal/consumer/oal_consumer.cpp index 1458b128a..da6108c69 100644 --- a/modules/oal/consumer/oal_consumer.cpp +++ b/modules/oal/consumer/oal_consumer.cpp @@ -323,6 +323,8 @@ spl::shared_ptr create_preconfigured_consumer(const boost: if (channel_layout_spec) { + CASPAR_SCOPED_CONTEXT_MSG("/channel-layout") + auto found_layout = core::audio_channel_layout_repository::get_default()->get_layout(*channel_layout_spec); if (!found_layout) diff --git a/shell/main.cpp b/shell/main.cpp index 5cfbb4d15..ffac2a4cd 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -212,7 +212,7 @@ bool run(const std::wstring& config_file_name, tbb::atomic& should_wait_fo // Create server object which initializes channels, protocols and controllers. std::unique_ptr caspar_server(new server(shutdown_server_now)); - + // Print environment information. print_system_info(caspar_server->get_system_info_provider_repo()); @@ -221,7 +221,10 @@ bool run(const std::wstring& config_file_name, tbb::atomic& should_wait_fo boost::property_tree::write_xml(str, env::properties(), w); CASPAR_LOG(info) << config_file_name << L":\n-----------------------------------------\n" << str.str() << L"-----------------------------------------"; - caspar_server->start(); + { + CASPAR_SCOPED_CONTEXT_MSG(config_file_name + L": ") + caspar_server->start(); + } // Create a dummy client which prints amcp responses to console. auto console_client = spl::make_shared(); diff --git a/shell/server.cpp b/shell/server.cpp index 9f9c15947..409ddf3ed 100644 --- a/shell/server.cpp +++ b/shell/server.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -232,17 +233,25 @@ struct server::impl : boost::noncopyable auto custom_mix_configs = pt.get_child_optional(L"configuration.audio.mix-configs"); if (custom_channel_layouts) + { + CASPAR_SCOPED_CONTEXT_MSG("/configuration/audio/channel-layouts"); audio_channel_layout_repository::get_default()->register_all_layouts(*custom_channel_layouts); + } if (custom_mix_configs) + { + CASPAR_SCOPED_CONTEXT_MSG("/configuration/audio/mix-configs"); audio_mix_config_repository::get_default()->register_all_configs(*custom_mix_configs); + } } void setup_channels(const boost::property_tree::wptree& pt) { using boost::property_tree::wptree; - for (auto& xml_channel : pt.get_child(L"configuration.channels")) + for (auto& xml_channel : pt | witerate_children(L"configuration.channels") | welement_context_iteration) { + ptree_verify_element_name(xml_channel, L"channel"); + auto format_desc_str = xml_channel.second.get(L"video-mode", L"PAL"); auto format_desc = video_format_desc(format_desc_str); if(format_desc.format == video_format::invalid) @@ -258,8 +267,8 @@ struct server::impl : boost::noncopyable core::diagnostics::scoped_call_context save; core::diagnostics::call_context::for_thread().video_channel = channel->index(); - - for (auto& xml_consumer : xml_channel.second.get_child(L"consumers")) + + for (auto& xml_consumer : xml_channel.second | witerate_children(L"consumers") | welement_context_iteration) { auto name = xml_consumer.first; @@ -271,7 +280,7 @@ struct server::impl : boost::noncopyable catch (const user_error& e) { CASPAR_LOG_CURRENT_EXCEPTION_AT_LEVEL(debug); - CASPAR_LOG(error) << *boost::get_error_info(e) << L". Error found in " << name << L" consumer configuration. Turn on log level debug for stacktrace."; + CASPAR_LOG(error) << get_message_and_context(e) << " Turn on log level debug for stacktrace."; } catch (...) { @@ -311,12 +320,14 @@ struct server::impl : boost::noncopyable if (predefined_clients) { - for (auto& predefined_client : *predefined_clients) + for (auto& predefined_client : pt | witerate_children(L"configuration.osc.predefined-clients") | welement_context_iteration) { + ptree_verify_element_name(predefined_client, L"predefined_client"); + const auto address = - predefined_client.second.get(L"address"); + ptree_get(predefined_client.second, L"address"); const auto port = - predefined_client.second.get(L"port"); + ptree_get(predefined_client.second, L"port"); predefined_osc_subscriptions_.push_back( osc_client_->get_subscription_token(udp::endpoint( address_v4::from_string(u8(address)), @@ -380,14 +391,14 @@ struct server::impl : boost::noncopyable amcp::register_commands(*amcp_command_repo_); using boost::property_tree::wptree; - for (auto& xml_controller : pt.get_child(L"configuration.controllers")) + for (auto& xml_controller : pt | witerate_children(L"configuration.controllers") | welement_context_iteration) { auto name = xml_controller.first; - auto protocol = xml_controller.second.get(L"protocol"); + auto protocol = ptree_get(xml_controller.second, L"protocol"); if(name == L"tcp") { - unsigned int port = xml_controller.second.get(L"port", 5250); + auto port = ptree_get(xml_controller.second, L"port"); auto asyncbootstrapper = spl::make_shared( io_service_, create_protocol(protocol, L"TCP Port " + boost::lexical_cast(port)), -- 2.39.2