Back to index

salome-kernel  6.5.0
Functions
Calcium.cxx File Reference
#include "Calcium.hxx"
#include "CalciumInterface.hxx"
#include "calcium.h"
#include <iostream>
#include <sstream>
#include <string>
#include <exception>

Go to the source code of this file.

Functions

void cp_exit (int)
void setDependency (provides_port *, char *, CalciumTypes::DependencyType)
void create_calcium_port (Superv_Component_i *compo, char *name, char *type, char *mode, char *depend)

Function Documentation

void cp_exit ( int  err)

Definition at line 48 of file Calcium.cxx.

    {
      throw CalciumException(err,LOC("Abort coupling"));
    }
void create_calcium_port ( Superv_Component_i compo,
char *  name,
char *  type,
char *  mode,
char *  depend 
)

Definition at line 89 of file Calcium.cxx.

  {
    std::stringstream msg;
    msg << type << " " << mode << " " << depend;
    CORBA::String_var componentName=compo->instanceName();
    std::string containerName=compo->getContainerName();
    Engines_DSC_interface::writeEvent("create_calcium_port",containerName,componentName,name,"",msg.str().c_str());

    if(std::string(mode) == "IN")
      {
        provides_port * port ;
        //provides port
        try
          {
            port = compo->create_provides_data_port(type);
            compo->add_port(port, name);
            if(std::string(depend) == "I")
              setDependency(port,type,CalciumTypes::ITERATION_DEPENDENCY);
            else if(std::string(depend) == "T")
              setDependency(port,type,CalciumTypes::TIME_DEPENDENCY);
            else
              {
                std::cerr << "create_calcium_port:unknown dependency: " << depend << std::endl;
              }
          }
        catch(const Superv_Component_i::PortAlreadyDefined& ex)
          {
            //Port already defined : we use the old one
            delete port;
            std::cerr << "create_calcium_port: " << ex.what() << std::endl;
          }
        catch ( ... )
          {
            std::cerr << "create_calcium_port: unknown exception" << std::endl;
          }
      }
    else if(std::string(mode) == "OUT")
      {
        uses_port * uport ;
        try
          {
            uport = compo->create_uses_data_port(type);
            compo->add_port(uport, name);
          }
        catch(const Superv_Component_i::PortAlreadyDefined& ex)
          {
            //Port already defined : we use the old one
            delete uport;
            std::cerr << "create_calcium_port: " << ex.what() << std::endl;
          }
        catch ( ... )
          {
            std::cerr << "create_calcium_port: unknown exception" << std::endl;
          }
      }
    else
      {
        //Unknown mode
        std::cerr << "create_calcium_port:Unknown mode: " << mode << std::endl;
      }
  }

Here is the call graph for this function:

void setDependency ( provides_port port,
char *  type,
CalciumTypes::DependencyType  depend 
)

Definition at line 53 of file Calcium.cxx.

  {
    if(std::string(type)=="CALCIUM_real")
      {
        dynamic_cast<calcium_real_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_double")
      {
        dynamic_cast<calcium_double_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_integer")
      {
        dynamic_cast<calcium_integer_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_long")
      {
        dynamic_cast<calcium_long_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_string")
      {
        dynamic_cast<calcium_string_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_logical")
      {
        dynamic_cast<calcium_logical_port_provides *>(port)->setDependencyType(depend);
      }
    else if(std::string(type)=="CALCIUM_complex")
      {
        dynamic_cast<calcium_complex_port_provides *>(port)->setDependencyType(depend);
      }
    else
      {
        std::cerr << "unknown type:" << std::endl;
      }
  }

Here is the caller graph for this function: