本文整理汇总了C++中boost::property_tree::ptree::put方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::put方法的具体用法?C++ ptree::put怎么用?C++ ptree::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::property_tree::ptree
的用法示例。
在下文中一共展示了ptree::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serialize
void Key::serialize(boost::property_tree::ptree& node)
{
node.put("<xmlattr>.keyStorageType", d_key_storage->getType());
node.put("IsCiphered", (d_storeCipheredData && !d_isEmpty));
cipherKeyData(node);
d_key_storage->serialize(node);
}
示例2: cipherKeyData
void Key::cipherKeyData(boost::property_tree::ptree& node)
{
if (!d_storeCipheredData || d_isEmpty)
{
node.put("Data", toString());
}
else
{
std::string secureKey = ((d_cipherKey == "") ? Key::secureAiKey : d_cipherKey);
openssl::AESSymmetricKey aes = openssl::AESSymmetricKey::createFromPassphrase(secureKey);
openssl::AESInitializationVector iv = openssl::AESInitializationVector::createNull();
openssl::AESCipher aescipher;
std::vector<unsigned char> divaesbuf;
std::string strdata = "Data";
std::vector<unsigned char> keynamebuf = std::vector<unsigned char>(strdata.begin(), strdata.end());
keynamebuf.resize(32, 0x00);
aescipher.cipher(keynamebuf, divaesbuf, aes, iv, false);
openssl::AESSymmetricKey divaes = openssl::AESSymmetricKey::createFromData(divaesbuf);
strdata = toString();
std::vector<unsigned char> keybuf = std::vector<unsigned char>(strdata.begin(), strdata.end());
std::vector<unsigned char> cipheredkey;
aescipher.cipher(keybuf, cipheredkey, divaes, iv, true);
node.put("Data", BufferHelper::toBase64(cipheredkey));
}
}
示例3: save
void ServerOptions::save(boost::property_tree::ptree& pt) const
{
pt.put("hashaid.charset", this->get<std::string>("charset"));
pt.put("hashaid.length", this->get<unsigned int>("length"));
if (this->is_set("salt"))
pt.put("hashaid.salt", this->get<std::string>("salt"));
pt.put("hashaid.type", this->get<std::string>("type"));
}
示例4: serialize
void ValueDataField::serialize(boost::property_tree::ptree& node)
{
DataField::serialize(node);
node.put("IsFixedField", d_isFixedField);
node.put("IsIdentifier", d_isIdentifier);
node.put("DataRepresentation", d_dataRepresentation->getType());
node.put("DataType", d_dataType->getType());
node.put("Length", d_length);
}
示例5:
void
OpusComponent::save( boost::property_tree::ptree& pt )
{
pt.put( "opus.eads.component." + M_name + ".name", M_name );
pt.put( "opus.eads.component." + M_name + ".k", M_k );
pt.put( "opus.eads.component." + M_name + ".rhoC", M_rhoC );
pt.put( "opus.eads.component." + M_name + ".Q", M_Q );
pt.put( "opus.eads.component." + M_name + ".h", M_h );
pt.put( "opus.eads.component." + M_name + ".e", M_e );
}
示例6:
void ISO7816ReaderUnitConfiguration::serialize(boost::property_tree::ptree& node)
{
node.put("SAMType", d_sam_type);
node.put("SAMReaderName", d_sam_reader_name);
boost::property_tree::ptree knode;
knode.put("KeyNo", d_keyno_unlock);
if (d_sam_key_unlock)
{
d_sam_key_unlock->serialize(knode);
}
node.add_child("SAMKey", knode);
}
示例7: while
void SortedAlleleAlphabet2::logState( boost::property_tree::ptree & log ) {
std::string key = "symbol_database";
log.put( key + ".count", m_db.size() );
log.put( key + ".active_count", m_db.size() - m_free_list.count());
log.put( key + ".symbol_per_block", bitset_type::bits_per_block );
log.put( key + ".max_block_per_region", (m_db.size() / bitset_type::bits_per_block) + 1 );
std::ostringstream oss;
for( unsigned int i = 0; i < m_db.size(); ++i ) {
if( !m_free_list[i] ) {
oss.str("");
oss.clear();
oss << ".symbol." << i;
log.put( key + oss.str(), m_db[i].first );
}
}
variant_db_t::iterator first = m_db.begin();
/*
free_ranges::iterator it = m_free_ranges.begin();
boost::property_tree::ptree fr;
while( it != m_free_ranges.end() ) {
boost::property_tree::ptree p, q, r, s, t;
p.put("", it->first.lower() );
q.put("", it->first.upper() );
r.push_back( std::make_pair("", p));
r.push_back( std::make_pair("", q));
index_interval_type::iterator idx_it = it->second.begin();
while( idx_it != it->second.end() ) {
boost::property_tree::ptree _p, _q, _s;
_p.put("", idx_it->lower() );
_q.put("", idx_it->upper() );
_s.push_back( std::make_pair( "", _p ) );
_s.push_back( std::make_pair( "", _q ) );
s.push_back( std::make_pair("", _s));
++idx_it;
}
t.push_back( std::make_pair( "", r ) );
t.push_back( std::make_pair( "", s ) );
fr.push_back( std::make_pair( "", t ));
++it;
}
log.add_child( key + ".free_ranges", fr );
*/
}
示例8:
void ISO7816ReaderUnitConfiguration::serialize(boost::property_tree::ptree& node)
{
node.put("SAMType", d_sam_type);
node.put("SAMReaderName", d_sam_reader_name);
boost::property_tree::ptree knode;
knode.put("KeyNo", d_keyno_unlock);
if (d_sam_key_unlock)
{
d_sam_key_unlock->serialize(knode);
}
node.add_child("SAMKey", knode);
node.put("CheckSAMReaderIsAvailable", d_check_sam_reader_available);
node.put("AutoConnectToSAMReader", d_auto_connect_sam_reader);
}
示例9: parseConfig
void linear_population_growth_generator::parseConfig( boost::property_tree::ptree & config ) {
if( config.get_child_optional( "A" ) == boost::none ) {
config.put( "A", m_A);
} else {
m_A = config.get<double>( "A", m_A );
}
if( config.get_child_optional( "B" ) == boost::none ) {
config.put("B", m_B );
} else {
m_B = config.get<double>( "B", m_B );
}
}
示例10: saveToPropertyTree
void CTopoRequirement::saveToPropertyTree(boost::property_tree::ptree& _pt)
{
try
{
std::string tag("topology.declrequirement.<xmlattr>");
_pt.put(tag + ".name", getName());
_pt.put(tag + ".value", getValue());
_pt.put(tag + ".type", RequirementTypeToTag(getRequirementType()));
}
catch (exception& error) // ptree_error, runtime_error
{
throw logic_error("Unable to save requirement " + getName() + " error:" + error.what());
}
}
示例11: serialize
void Key::serialize(boost::property_tree::ptree& node)
{
node.put("<xmlattr>.keyStorageType", d_key_storage->getType());
if (d_key_diversification)
{
boost::property_tree::ptree newnode;
newnode.put("<xmlattr>.keyDiversificationType", d_key_diversification->getType());
d_key_diversification->serialize(newnode);
node.add_child("KeyDiversification", newnode);
}
node.put("IsCiphered", (d_storeCipheredData && !d_isEmpty));
cipherKeyData(node);
d_key_storage->serialize(node);
}
示例12: serialize
void ReaderUnit::serialize(boost::property_tree::ptree& node)
{
node.put("<xmlattr>.type", getReaderProvider()->getRPType());
d_readerUnitConfig->serialize(node);
if (getDataTransport())
{
node.put("TransportType", getDataTransport()->getTransportType());
getDataTransport()->serialize(node);
}
else
{
node.put("TransportType", "");
}
}
示例13: recordResults
void recordResults( boost::property_tree::ptree & log ) {
typedef ac::accumulator_set< size_type, ac::stats< ac::tag::min, ac::tag::mean, ac::tag::max, ac::tag::variance, ac::tag::median, ac::tag::count > > accumulator_t;
accumulator_t col_accum, row_accum;
boost::property_tree::ptree dist, lfreq;
// maximum frequency for an allele is bounded by the number of sequences (rows) in the population
std::vector< size_type > freq( m_indices.size(), 0 );
// evaluate allele (column) statistics
size_type i = 0;
while( i < m_column_margin_size ) {
size_type v = m_column_margin[i++];
clotho::utility::add_value_array( dist, v );
col_accum( v );
freq[v]++;
}
clotho::utility::add_value_array(lfreq, freq.begin(), freq.end() );
log.put_child( "distribution", dist );
log.put_child( "frequency_distribution", lfreq );
log.put( "stats.sequences_per_allele.min", ac::min( col_accum ) );
log.put( "stats.sequences_per_allele.max", ac::max( col_accum ) );
log.put( "stats.sequences_per_allele.mean", ac::mean( col_accum ) );
log.put( "stats.sequences_per_allele.median", ac::median( col_accum ) );
log.put( "stats.sequences_per_allele.variance", ac::variance( col_accum ) );
log.put( "stats.sequences_per_allele.total", ac::count(col_accum) );
// evaluate sequence (row) statistics
i = 0;
while( i < m_row_margin_size ) {
if( m_indices.test(i) ) {
row_accum( m_row_margin[ i ] );
}
++i;
}
log.put( "stats.alleles_per_sequence.min", ac::min( row_accum ) );
log.put( "stats.alleles_per_sequence.max", ac::max( row_accum ) );
log.put( "stats.alleles_per_sequence.mean", ac::mean( row_accum ) );
log.put( "stats.alleles_per_sequence.median", ac::median( row_accum ) );
log.put( "stats.alleles_per_sequence.variance", ac::variance( row_accum ) );
log.put( "stats.alleles_per_sequence.total", ac::count(row_accum) );
}
示例14:
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);
}
示例15: ParseItem
void CContentParser::ParseItem(std::string& sSource, boost::property_tree::ptree& xmlResult)
{
static boost::regex expression(Settings::Instance().GetItemExpression());
// Контейнер для значений
std::vector< std::string > vecRawValues;
if (!boost::regex_split(std::back_inserter(vecRawValues), sSource, expression))
throw std::runtime_error("Failed to parse item.");
for (unsigned int i = 0; i < vecRawValues.size(); ++i)
{
std::string sName = ms_pNames[i];
if (sName.empty())
continue;
std::string& sToken = vecRawValues[i];
if (!sToken.empty())
{
if (sName == "phone")
ParsePhone(sToken);
else
{
boost::algorithm::trim(sToken);
if (sToken[sToken.size() - 1] == ',')
boost::algorithm::erase_last(sToken, ",");
}
xmlResult.put(sName, sToken);
}
}
}