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


C++ runtime_configuration::get_entry方法代码示例

本文整理汇总了C++中util::runtime_configuration::get_entry方法的典型用法代码示例。如果您正苦于以下问题:C++ runtime_configuration::get_entry方法的具体用法?C++ runtime_configuration::get_entry怎么用?C++ runtime_configuration::get_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util::runtime_configuration的用法示例。


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

示例1: key

    parcelport::parcelport(util::runtime_configuration const& ini,
            std::string const& type)
      : parcels_(),
        here_(ini.get_parcelport_address()),
        max_message_size_(ini.get_max_message_size()),
        allow_array_optimizations_(true),
        allow_zero_copy_optimizations_(true),
        enable_security_(false),
        async_serialization_(false)
    {
        std::string key("hpx.parcel.");
        key += type;

        std::string array_optimization =
            ini.get_entry(key + ".array_optimization", "1");

        if (boost::lexical_cast<int>(array_optimization) == 0) {
            allow_array_optimizations_ = false;
            allow_zero_copy_optimizations_ = false;
        }
        else {
            std::string zero_copy_optimization =
                ini.get_entry(key + ".zero_copy_optimization", "1");
            if (boost::lexical_cast<int>(zero_copy_optimization) == 0)
                allow_zero_copy_optimizations_ = false;
        }

        std::string enable_security =
            ini.get_entry(key + ".enable_security", "0");
        if(boost::lexical_cast<int>(enable_security) != 0)
        {
            enable_security_ = true;
        }

        std::string async_serialization =
            ini.get_entry(key + ".async_serialization", "0");
        if(boost::lexical_cast<int>(async_serialization) != 0)
        {
            async_serialization_ = true;
        }
    }
开发者ID:adk9,项目名称:hpx,代码行数:41,代码来源:parcelport.cpp

示例2: create

    boost::shared_ptr<parcelport> parcelport::create_bootstrap(
        util::runtime_configuration const& cfg,
        HPX_STD_FUNCTION<void(std::size_t, char const*)> const& on_start_thread,
        HPX_STD_FUNCTION<void()> const& on_stop_thread)
    {
        std::string pptype = cfg.get_entry("hpx.parcel.bootstrap", "tcp");

        int type = get_connection_type_from_name(pptype);
        if (type == connection_unknown)
            type = connection_tcp;

        return create(type, cfg, on_start_thread, on_stop_thread);
    }
开发者ID:adk9,项目名称:hpx,代码行数:13,代码来源:parcelport.cpp

示例3: switch

    boost::shared_ptr<parcelport> parcelport::create(connection_type type,
        util::runtime_configuration const& cfg,
        HPX_STD_FUNCTION<void(std::size_t, char const*)> const& on_start_thread,
        HPX_STD_FUNCTION<void()> const& on_stop_thread)
    {
        switch(type) {
        case connection_tcpip:
            return boost::make_shared<parcelset::tcp::parcelport>(
                cfg, on_start_thread, on_stop_thread);

        case connection_shmem:
            {
#if defined(HPX_HAVE_PARCELPORT_SHMEM)
                // Create shmem based parcelport only if allowed by the 
                // configuration info.
                std::string enable_shmem = 
                    cfg.get_entry("hpx.parcel.shmem.enable", "0");

                if (boost::lexical_cast<int>(enable_shmem)) 
                {
                    return boost::make_shared<parcelset::shmem::parcelport>(
                        cfg, on_start_thread, on_stop_thread);
                }
#endif
                HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                    "unsupported connection type 'connection_shmem'");
            }
            break;

        case connection_portals4:
            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unsupported connection type 'connection_portals4'");
            break;

        default:
            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unknown connection type");
            break;
        }

        return boost::shared_ptr<parcelport>();
    }
开发者ID:fpelliccioni,项目名称:hpx,代码行数:42,代码来源:parcelport.cpp

示例4: detect_mpi_environment

        bool detect_mpi_environment(util::runtime_configuration const& cfg,
            char const* default_env)
        {
#if defined(__bgq__)
            // If running on BG/Q, we can safely assume to always run in an
            // MPI environment
            return true;
#else
            std::string mpi_environment_strings = cfg.get_entry(
                "hpx.parcel.mpi.env", default_env);

            typedef
                boost::tokenizer<boost::char_separator<char> >
                tokenizer;
            boost::char_separator<char> sep(";,: ");
            tokenizer tokens(mpi_environment_strings, sep);
            for(tokenizer::iterator it = tokens.begin(); it != tokens.end(); ++it)
            {
                char *env = std::getenv(it->c_str());
                if(env) return true;
            }
            return false;
#endif
        }
开发者ID:pra85,项目名称:hpx,代码行数:24,代码来源:mpi_environment.cpp

示例5: switch

    boost::shared_ptr<parcelport> parcelport::create(int type,
        util::runtime_configuration const& cfg,
        HPX_STD_FUNCTION<void(std::size_t, char const*)> const& on_start_thread,
        HPX_STD_FUNCTION<void()> const& on_stop_thread)
    {
        switch(type) {
        case connection_tcp:
            {
#if defined(HPX_HAVE_PARCELPORT_TCP)
                std::string enable_tcp =
                    cfg.get_entry("hpx.parcel.tcp.enable", "1");

                if (boost::lexical_cast<int>(enable_tcp))
                {
                    return boost::make_shared<policies::tcp::connection_handler>(
                        cfg, on_start_thread, on_stop_thread);
                }
#endif

                HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                    "unsupported connection type 'connection_tcp'");
            }

        case connection_ipc:
            {
#if defined(HPX_HAVE_PARCELPORT_IPC)
                // Create ipc based parcelport only if allowed by the
                // configuration info.
                std::string enable_ipc =
                    cfg.get_entry("hpx.parcel.ipc.enable", "0");

                if (boost::lexical_cast<int>(enable_ipc))
                {
                    return boost::make_shared<policies::ipc::connection_handler>(
                        cfg, on_start_thread, on_stop_thread);
                }
#endif
                HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                    "unsupported connection type 'connection_ipc'");
            }
            break;

        case connection_ibverbs:
#if defined(HPX_HAVE_PARCELPORT_IBVERBS)
            {
                // Create ibverbs based parcelport only if allowed by the
                // configuration info.
                std::string enable_ibverbs =
                    cfg.get_entry("hpx.parcel.ibverbs.enable", "0");

                if (boost::lexical_cast<int>(enable_ibverbs))
                {
                    return boost::make_shared<policies::ibverbs::connection_handler>(
                        cfg, on_start_thread, on_stop_thread);
                }
            }
#endif
            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unsupported connection type 'connection_ibverbs'");
            break;

        case connection_portals4:
            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unsupported connection type 'connection_portals4'");
            break;

        case connection_mpi:
#if defined(HPX_HAVE_PARCELPORT_MPI)
            {
                // Create MPI based parcelport only if allowed by the
                // configuration info.
                std::string enable_mpi =
                    cfg.get_entry("hpx.parcel.mpi.enable", "0");

                if (boost::lexical_cast<int>(enable_mpi))
                {
                    return boost::make_shared<policies::mpi::connection_handler>(
                        cfg, on_start_thread, on_stop_thread);
                }
            }
#endif

            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unsupported connection type 'connection_mpi'");
            break;

        default:
            HPX_THROW_EXCEPTION(bad_parameter, "parcelport::create",
                "unknown connection type");
            break;
        }

        return boost::shared_ptr<parcelport>();
    }
开发者ID:adk9,项目名称:hpx,代码行数:94,代码来源:parcelport.cpp


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