Example #1
0
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 );
}
Example #2
0
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);
}
    void PCSCDataTransport::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getTransportType());
        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
Example #4
0
        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());
            }
        }
Example #5
0
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");
}
    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);
    }
 /**
  * \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);
 }
Example #8
0
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);
        }
    }
}
Example #9
0
    void SAMKeyStorage::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;
        node.put("KeySlot", d_key_slot);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
Example #10
0
 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);
     }
 }
	void IdOnDemandReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("AuthenticateCode", d_authCode);

		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
    void A3MLGM5600ReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("LocalPort", d_localPort);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
    void ISO15693Location::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("Block", block);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
    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);
    }
Example #15
0
    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);
    }
Example #16
0
    void TwicLocation::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("DataObject", dataObject);
        node.put("Tag", tag);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
Example #17
0
	void SAMKeyEntry::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("KeyType", d_keyType);
		node.put("Diversify", d_diversify);

		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
    void MifareUltralightLocation::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("Page", page);
        node.put("Byte", byte);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
    void Wiegand37Format::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getType());
        node.put("Uid", getUid());

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
    void RFIDeasReaderUnit::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getReaderProvider()->getRPType());
        d_readerUnitConfig->serialize(node);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
Example #21
0
	void serialize_json (boost::property_tree::ptree & tree_a)
	{
		std::string wallet_string;
		wallet.encode_hex (wallet_string);
		tree_a.put ("version", "4");
		tree_a.put ("wallet", wallet_string);
		tree_a.put ("account", account.to_account ());
		boost::property_tree::ptree node_l;
		node.serialize_json (node_l);
		tree_a.add_child ("node", node_l);
		boost::property_tree::ptree rpc_l;
		rpc.serialize_json (rpc_l);
		tree_a.add_child ("rpc", rpc_l);
		tree_a.put ("rpc_enable", rpc_enable);
		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);
	}
	void SerialPortDataTransport::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("<xmlattr>.type", getTransportType());
		node.put("PortBaudRate", d_portBaudRate);
		d_port->serialize(node);

		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
	void OSDPReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("RS485Address", d_rs485Address);
		d_scbk_d_key_aes->serialize(node);
		d_scbk_key_aes->serialize(node);
		d_master_key_aes->serialize(node);
		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
Example #24
0
    void DESFireKey::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;
        Key::serialize(node);

        node.put("KeyType", d_keyType);
        node.put("KeyVersion", d_key_version);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
    void PCSCReaderUnitConfiguration::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;
        ISO7816ReaderUnitConfiguration::serialize(node);

        node.put("TransmissionProtocol", d_protocol);
        node.put("ShareMode", d_share_mode);

        parentNode.add_child(PCSCReaderUnitConfiguration::getDefaultXmlNodeName(), node);
    }
Example #26
0
    void ASCIIFormat::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        node.put("<xmlattr>.type", getType());
        node.put("ASCIILength", getASCIILength());
        node.put("Padding", getPadding());

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
	void UdpDataTransport::serialize(boost::property_tree::ptree& parentNode)
	{
		boost::property_tree::ptree node;

		node.put("<xmlattr>.type", getTransportType());
		node.put("IpAddress", d_ipAddress);
		node.put("Port", d_port);

		parentNode.add_child(getDefaultXmlNodeName(), node);
	}
void ACSACR1222LReaderUnitConfiguration::serialize(
        boost::property_tree::ptree &parentNode)
{
    boost::property_tree::ptree node;

    PCSCReaderUnitConfiguration::serialize(node);

    node.put("UserFeedbackReader", user_feedback_reader_);
    parentNode.add_child(getDefaultXmlNodeName(), node);
}
    void BinaryDataField::serialize(boost::property_tree::ptree& parentNode)
    {
        boost::property_tree::ptree node;

        ValueDataField::serialize(node);
        node.put("Value", d_value.toString());
        node.put("Padding", d_padding);

        parentNode.add_child(getDefaultXmlNodeName(), node);
    }
Example #30
0
void Plugin::getResponse(const std::string& key,
                         const PluginResponse& response,
                         boost::property_tree::ptree& tree) {
  for (const auto& item : response) {
    boost::property_tree::ptree child;
    for (const auto& item_detail : item) {
      child.put(item_detail.first, item_detail.second);
    }
    tree.add_child(key, child);
  }
}