Example #1
0
//
// write_impl_begin
//
void CUTS_EISA_Generator_Base::
write_impl_begin (const PICML::MonolithicImplementation & monoimpl,
                  const PICML::Component & type)
{
  this->out_
    << std::endl
    << "namespace CIDL_" << monoimpl.name () << "{";
}
//
// Visit_MonolithicImplementation
//
void QED_Deployment_Visitor::
Visit_MonolithicImplementation (const PICML::MonolithicImplementation & impl)
{
  typedef std::set <PICML::ConfigProperty> ConfigProperty_Set;
  ConfigProperty_Set configs = impl.dstConfigProperty ();

  std::for_each (configs.begin (),
                 configs.end (),
                 boost::bind (&ConfigProperty_Set::value_type::Accept,
                              _1,
                              boost::ref (*this)));
}
Example #3
0
//
// write_factory_impl_end
//
void CUTS_EISA_Header_Generator::
write_factory_impl_end (const PICML::ComponentFactory & factory,
                        const PICML::MonolithicImplementation & impl,
                        const PICML::Component & type)
{
  // Generate the export file for the implementation.
  PICML::ComponentImplementationContainer container =
    PICML::ComponentImplementationContainer::Cast (impl.parent ());

  CUTS_BE_Impl_Node::Artifact_Set::const_iterator iter_exec =
    std::find_if (this->node_->artifacts_.begin (),
                  this->node_->artifacts_.end (),
                  Element_Name_End_With <
                    CUTS_BE_Impl_Node::Artifact_Set::value_type> (
                    CUTS_BE_OPTIONS ()->exec_suffix_));

  // Close off the class definition.
  this->out_
    << "};";

  this->_super::write_factory_impl_end (factory, impl, type);

  // Construct the export macro and export filename.
  std::string exportfile =
    std::string (container.name ()) + CUTS_BE_OPTIONS ()->exec_suffix_;

  std::string export_macro = iter_exec->name ();
  std::transform (export_macro.begin (),
                  export_macro.end (),
                  export_macro.begin (),
                  &toupper);

  this->out_
    << "#include \"" << exportfile << "_export.h\"" << std::endl
    << std::endl
    << single_line_comment (this->entry_point_)
    << "extern \"C\" " << export_macro << "_Export" << std::endl
    << "::Components::HomeExecutorBase_ptr " << std::endl
    << this->entry_point_ + " (void);"
    << std::endl;
}
//
// Visit_MonolithicImplementation
//
void Set_Classpath_Script_Generator::
Visit_MonolithicImplementation (const PICML::MonolithicImplementation & mono)
{
  this->impls_.insert (mono.name ());
}
//
// Visit_Component
//
void QED_Deployment_Visitor::
Visit_Component (const PICML::Component & component)
{
  // Create the XML document.
  if (this->doc_ != 0)
    this->doc_->release();

  this->doc_ =
    this->impl_->createDocument (
      Utils::XStr ("http://www.springframework.org/schema/beans"),
      Utils::XStr ("beans"),
      0);

  this->doc_->setXmlVersion (Utils::XStr("1.0"));

  xercesc::DOMElement * root = this->doc_->getDocumentElement ();

  root->setAttributeNS (
    Utils::XStr ("http://www.w3.org/2000/xmlns/"),
    Utils::XStr ("xmlns:xsi"),
    Utils::XStr ("http://www.w3.org/2001/XMLSchema-instance"));

  root->setAttribute (
    Utils::XStr ("xsi:schemaLocation"),
    Utils::XStr ("http://www.springframework.org/schema/beans "
                 "http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"));

  // Create the filename for the configuration.
  std::string name = component.name ();

  // Define the instance information.
  std::ostringstream unique_id;
  unique_id << this->scope_.top () << "." << name;

  xercesc::DOMElement * element =
    this->doc_->createElementNS (Utils::XStr ("http://www.springframework.org/schema/beans"),
                                 Utils::XStr ("bean"));

  element->setAttribute (Utils::XStr ("id"),
                         Utils::XStr (unique_id.str ().c_str ()));

  // Save the unique id for later usage.
  this->instance_names_[component] = unique_id.str ();

  // Find the implementation for this component.
  QED_Implementation_Finder finder;
  PICML::Component (component).Accept (finder);

  // Remove all the default properties.
  if (!this->default_props_.empty ())
    this->default_props_.empty ();

  if (finder.is_found ())
  {
    PICML::MonolithicImplementation impl = finder.implementation ();
    std::string type = impl.name ();

    element->setAttribute (Utils::XStr ("class"), Utils::XStr (type));
    impl.Accept (*this);
  }

  // Overwrite the default properties, if there are any.
  typedef std::set <PICML::AssemblyConfigProperty> ConfigProperty_Set;
  ConfigProperty_Set configs = component.dstAssemblyConfigProperty ();

  std::for_each (configs.begin (),
                 configs.end (),
                 boost::bind (&ConfigProperty_Set::value_type::Accept,
                              _1,
                              boost::ref (*this)));

  root->appendChild (element);
  this->root_.push (element);

  // Write the default properties to the XML document.
  std::for_each (this->default_props_.begin (),
                 this->default_props_.end (),
                 boost::bind (&QED_Deployment_Visitor::write_property,
                              this,
                              _1));

  // Get all the attributes for the component. We need to visit them
  // and add them to the XML document.
  typedef std::vector <PICML::Attribute> Attribute_Set;
  Attribute_Set attributes = component.Attribute_kind_children ();

  std::for_each (attributes.begin (),
                 attributes.end (),
                 boost::bind (&Attribute_Set::value_type::Accept,
                              _1,
                              boost::ref (*this)));

  this->root_.pop ();

  // Construct the filename for the XML document.
  std::ostringstream filename;
  filename << this->path_.top () << "/" << name << ".qic";

  // Serialize the XML to file.
  this->serialize_xml_to_file (filename.str ());
}