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


C++ ptree::add_child方法代码示例

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


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

示例1: logMutationDistribution

void logMutationDistribution( boost::property_tree::ptree & p, std::map< size_t, size_t > & freq_dist ) {
    boost::property_tree::ptree v, _v0, _v1;
    _v0.put("", "Frequency");
    _v1.put("", "Count");
    v.push_back( std::make_pair("", _v0));
    v.push_back( std::make_pair("", _v1));
    p.add_child("distribution.y.smps", v);

    boost::property_tree::ptree x, _x0, _x1;
    _x0.put("", "Region relative position of Allele" );
    _x1.put("", "Frequency of allele in population" );
    x.push_back( std::make_pair("", _x0 ) );
    x.push_back( std::make_pair("", _x1 ) );
    p.add_child( "distribution.x.Description", x);
    boost::property_tree::ptree d,s;

    unsigned int i = 0;
    for( std::map< size_t, size_t >::iterator it = freq_dist.begin(); it != freq_dist.end(); ++it ) {
        boost::property_tree::ptree x,y,z, _s;
        x.put( "", it->first);
        y.put( "", it->second);

        z.push_back( std::make_pair("", x ) );
        z.push_back( std::make_pair("", y ) );

        std::ostringstream oss;
        oss << i++;

        _s.put("", oss.str());
        s.push_back( std::make_pair("", _s));
        d.push_back( std::make_pair("", z ));
    }

    p.add_child( "distribution.y.vars", s );
    p.add_child( "distribution.y.data", d );

    boost::property_tree::ptree graph_opts;
    graph_opts.put("graphType", "Scatter2D");
    {
        boost::property_tree::ptree tmp, t;
        t.put("", "Frequency");
        tmp.push_back( std::make_pair("", t ) );
        graph_opts.add_child("xAxis", tmp);
    }
    {
        boost::property_tree::ptree tmp, t;
        t.put("", "Count");
        tmp.push_back( std::make_pair( "",t));
        graph_opts.add_child("yAxis", tmp);
    }
    graph_opts.put( "title", "Allele Frequency Distribution" );
    p.add_child( "distribution.graph_opts", graph_opts );
}
开发者ID:putnampp,项目名称:clotho,代码行数:53,代码来源:population_graphs.cpp

示例2:

void rai_daemon::daemon_config::serialize_json (boost::property_tree::ptree & tree_a)
{
	tree_a.put ("version", "2");
	tree_a.put ("rpc_enable", rpc_enable);
	boost::property_tree::ptree rpc_l;
	rpc.serialize_json (rpc_l);
	tree_a.add_child ("rpc", rpc_l);
	boost::property_tree::ptree node_l;
	node.serialize_json (node_l);
	tree_a.add_child ("node", node_l);
	tree_a.put ("opencl_enable", opencl_enable);
	boost::property_tree::ptree opencl_l;
	opencl.serialize_json (opencl_l);
	tree_a.add_child ("opencl", opencl_l);
}
开发者ID:icocountdown,项目名称:raiblocks,代码行数:15,代码来源:daemon.cpp

示例3: serialize

    void PCSCDataTransport::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getTransportType());
        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:siowkiat,项目名称:liblogicalaccess,代码行数:7,代码来源:pcscdatatransport.cpp

示例4: writeProjectionMetaData

        void TF_Datasource::writeProjectionMetaData(boost::property_tree::ptree& propertyTree, std::string metaDataFileName, std::vector<ScannerGeometry*> projectionProperties, const std::vector<std::string>& filenames)
        {
            for(unsigned int i = 0; i < projectionProperties.size(); i++)
            {
                STEMScannerGeometry* geometry = dynamic_cast<STEMScannerGeometry*>(projectionProperties[i]);
                if (geometry == nullptr)
                    throw Exception("TF_Datasource requires STEMScannerGeometry data");

                ptree& projectionNode = propertyTree.add_child("projection", ptree());
                ptree& imageNode = projectionNode.add_child("image", ptree());
                imageNode.add("<xmlattr>.filename", filenames[i]);

                ptree& tiltNode = projectionNode.add_child("tiltAngle", ptree());
                tiltNode.add("<xmlattr>.value", geometry->getTiltAngle());

                projectionNode.add_child("convergent", ptree());

                ptree& openingNode = projectionNode.add_child("beamOpeningAngle", ptree());
                openingNode.add("<xmlattr>.value", geometry->getConfocalOpeningHalfAngle());

                ptree& focalNode = projectionNode.add_child("focalDistance", ptree());
                focalNode.add("<xmlattr>.value", geometry->getFocalDepth());

                ptree& focalDifferenceNode = projectionNode.add_child("focalDistanceBetweenImages", ptree());
                focalDifferenceNode.add("<xmlattr>.value", geometry->getFocalDifferenceBetweenImages());
            }
        }
开发者ID:c3di,项目名称:ettention,代码行数:27,代码来源:TF_Datasource.cpp

示例5: serializeDiffResults

Status serializeDiffResults(const DiffResults& d, pt::ptree& tree) {
  pt::ptree added;
  auto status = serializeQueryData(d.added, added);
  if (!status.ok()) {
    return status;
  }
  tree.add_child("added", added);

  pt::ptree removed;
  status = serializeQueryData(d.removed, removed);
  if (!status.ok()) {
    return status;
  }
  tree.add_child("removed", removed);
  return Status(0, "OK");
}
开发者ID:AidHamza,项目名称:osquery,代码行数:16,代码来源:database.cpp

示例6: serialize

    void NFCReaderUnit::serialize(boost::property_tree::ptree& parentNode)
    {
		boost::property_tree::ptree node;
		ReaderUnit::serialize(node);
		node.put("Name", d_name);
		parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:islog,项目名称:liblogicalaccess-libnfc,代码行数:7,代码来源:nfcreaderunit.cpp

示例7: serialize

 /**
  * \brief Serialize the current object to XML.
  * \param parentNode The parent node.
  */
 void serialize(boost::property_tree::ptree& parentNode)
 {
     boost::property_tree::ptree node;
     SerialPortDataTransport::serialize(node);
     node.put("Checksum", d_checksum);
     parentNode.add_child(getDefaultXmlNodeName(), node);
 }
开发者ID:joobn72,项目名称:liblogicalaccess,代码行数:11,代码来源:gunnebodatatransport.hpp

示例8: merge

void Settings::merge(const boost::property_tree::ptree& from,
                     boost::property_tree::ptree& to,
                     bool overwrite)
{
    // Is this a single value or a subtree?
    if (!from.data().empty()) {
        // Single value
        if (overwrite || to.data().empty()) {
            to.put_value(from.data());
        }
        return;
    }

    // Subtree
    for (const auto& fromEntry : from) {
        // Does the key exist in the destination?
        auto toIt = to.find(fromEntry.first);
        if (toIt == to.not_found()) {
            ptree::ptree child;

            // Recurse into the new child
            merge(fromEntry.second, child, overwrite);

            // Create a path object because ptree uses '.' as a path delimiter
            // when strings are used
            ptree::ptree::path_type treePath = createPath(fromEntry.first);
            to.add_child(treePath, child);
        } else {
            // Recurse into the subtrees
            merge(fromEntry.second, toIt->second, overwrite);
        }
    }
}
开发者ID:icyerasor,项目名称:joynr,代码行数:33,代码来源:Settings.cpp

示例9: serialize

    void SAMKeyStorage::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;
        node.put("KeySlot", d_key_slot);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:jpod,项目名称:liblogicalaccess,代码行数:7,代码来源:samkeystorage.cpp

示例10: add_rewards

 void RewardXML::add_rewards(boost::property_tree::ptree& reward_element) const {
     for (auto &r : reward_values) {
         boost::property_tree::ptree reward_value;
         reward_value.put("<xmlattr>.dimension", r.first);
         reward_value.put("<xmlattr>.value", r.second);
         reward_element.add_child("Rewards.Value", reward_value);
     }
 }
开发者ID:Microsoft,项目名称:malmo,代码行数:8,代码来源:RewardXML.cpp

示例11: serialize

	void IdOnDemandReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("AuthenticateCode", d_authCode);

		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
开发者ID:BobLC,项目名称:liblogicalaccess,代码行数:8,代码来源:idondemandreaderunitconfiguration.cpp

示例12:

    void A3MLGM5600ReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("LocalPort", d_localPort);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:Rick0124,项目名称:liblogicalaccess,代码行数:8,代码来源:a3mlgm5600readerunitconfiguration.cpp

示例13:

    void ISO15693Location::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("Block", block);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:Rick0124,项目名称:liblogicalaccess,代码行数:8,代码来源:iso15693location.cpp

示例14: serialize

    void ReaderMemoryKeyStorage::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("KeySlot", d_key_slot);
        node.put("Volatile", d_volatile);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:drewet,项目名称:liblogicalaccess,代码行数:9,代码来源:readermemorykeystorage.cpp

示例15: serialize

    void RawFormat::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getType());
        node.put("RawData", BufferHelper::getHex(getRawData()));

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
开发者ID:siowkiat,项目名称:liblogicalaccess,代码行数:9,代码来源:rawformat.cpp


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