Exemplo n.º 1
0
  Implementation(const URI& file) :
    filename(build_filename(file, PE::Comm::instance().rank())),
    xml_filename(file),
    index(0),
    xml_doc("1.0", "ISO-8859-1"),
    m_total_count(0)
  {
    const Uint v = version();
    out_file.open(filename, std::ios_base::out | std::ios_base::binary);
    out_file.write(reinterpret_cast<const char*>(&v), sizeof(Uint));

    PE::Comm& comm = PE::Comm::instance();
    // Rank 0 writes out an XML file that lists all filenames for all CPUs
    if(comm.rank() == 0)
    {
      XmlNode cfbinary = xml_doc.add_node("cfbinary");
      cfbinary.set_attribute("version", to_str(version()));
      node_xml_data.reserve(comm.size());
      XmlNode node_list = cfbinary.add_node("nodes");
      for(Uint i = 0; i != comm.size(); ++i)
      {
        XmlNode node = node_list.add_node("node");
        node.set_attribute("filename", build_filename(file, i));
        node.set_attribute("rank", to_str(i));
        node_xml_data.push_back(node);
      }
    }
  }
Exemplo n.º 2
0
  XmlNode Protocol::add_signal_frame ( XmlNode& node, const std::string & target,
                                       const URI & sender, const URI & receiver,
                                       bool user_trans )
  {
    cf3_assert(sender.scheme() == URI::Scheme::CPATH);
    cf3_assert(receiver.scheme() == URI::Scheme::CPATH);

    XmlNode signalnode = node.add_node( Tags::node_frame() );

    signalnode.set_attribute( "type", Tags::node_type_signal() );
    signalnode.set_attribute( "target", target );
    signalnode.set_attribute( "sender", sender.string() );
    signalnode.set_attribute( "receiver", receiver.string() );
    signalnode.set_attribute( "transaction", user_trans ? "user" : "auto" );
    signalnode.set_attribute( "frameid", common::UUCount().string() );

    return signalnode;
  }
Exemplo n.º 3
0
  XmlNode Protocol::add_signal_frame ( XmlNode& node, const std::string & target,
                                       const URI & sender, const URI & receiver,
                                       bool user_trans )
  {
    cf_assert(sender.scheme() == URI::Scheme::CPATH);
    cf_assert(receiver.scheme() == URI::Scheme::CPATH);

    std::string uuid = boost::lexical_cast<std::string>(boost::uuids::random_generator()());

    XmlNode signalnode = node.add_node( Tags::node_frame() );

    signalnode.set_attribute( "type", Tags::node_type_signal() );
    signalnode.set_attribute( "target", target );
    signalnode.set_attribute( "sender", sender.string() );
    signalnode.set_attribute( "receiver", receiver.string() );
    signalnode.set_attribute( "transaction", user_trans ? "user" : "auto" );
    signalnode.set_attribute( "frameid", uuid );

    return signalnode;
  }
Exemplo n.º 4
0
XmlNode CJournal::copy_node(const XmlNode & in, XmlNode & out) const
{
  rapidxml::xml_node<>* content = in.content;

  XmlNode copy = out.add_node(content->name(), content->value());
  rapidxml::xml_attribute<>* attr = content->first_attribute();
  XmlNode node( content->first_node() );

  while( attr != nullptr )
  {
    copy.set_attribute(attr->name(), attr->value());
    attr = attr->next_attribute();
  }


  while( node.is_valid() )
  {
    copy_node(node, copy);

    node = node.content->next_sibling();
  }

  return copy;
}