00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _DSC_INTERFACE_HXX_
00027 #define _DSC_INTERFACE_HXX_
00028
00029 #include <iostream>
00030 #include <map>
00031 #include <string.h>
00032 #include <assert.h>
00033
00034 #include "DSC_Callbacks.hxx"
00035
00042 class Engines_DSC_interface:
00043 public DSC_Callbacks
00044 {
00045 public:
00046 Engines_DSC_interface();
00047 virtual ~Engines_DSC_interface();
00048
00052 virtual void add_provides_port(Ports::Port_ptr ref,
00053 const char* provides_port_name,
00054 Ports::PortProperties_ptr port_prop)
00055 throw (Engines::DSC::PortAlreadyDefined,
00056 Engines::DSC::NilPort,
00057 Engines::DSC::BadProperty);
00058
00062 virtual void add_uses_port(const char* repository_id,
00063 const char* uses_port_name,
00064 Ports::PortProperties_ptr port_prop)
00065 throw (Engines::DSC::PortAlreadyDefined,
00066 Engines::DSC::BadProperty);
00067
00071 virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
00072 const CORBA::Boolean connection_error)
00073 throw (Engines::DSC::PortNotDefined,
00074 Engines::DSC::PortNotConnected,
00075 Engines::DSC::BadPortType);
00076
00080 virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
00081 throw (Engines::DSC::PortNotDefined,
00082 Engines::DSC::PortNotConnected,
00083 Engines::DSC::BadPortType);
00084
00093 virtual void connect_provides_port(const char* provides_port_name)
00094 throw (Engines::DSC::PortNotDefined);
00095
00102 virtual void connect_uses_port(const char* uses_port_name,
00103 Ports::Port_ptr provides_port_ref)
00104 throw (Engines::DSC::PortNotDefined,
00105 Engines::DSC::BadPortType,
00106 Engines::DSC::NilPort);
00107
00111 virtual CORBA::Boolean is_connected(const char* port_name)
00112 throw (Engines::DSC::PortNotDefined);
00113
00122 virtual void disconnect_provides_port(const char* provides_port_name,
00123 const Engines::DSC::Message message)
00124 throw (Engines::DSC::PortNotDefined,
00125 Engines::DSC::PortNotConnected);
00126
00138 virtual void disconnect_uses_port(const char* uses_port_name,
00139 Ports::Port_ptr provides_port_ref,
00140 const Engines::DSC::Message message)
00141 throw (Engines::DSC::PortNotDefined,
00142 Engines::DSC::PortNotConnected,
00143 Engines::DSC::BadPortReference);
00144
00148 virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
00149 throw (Engines::DSC::PortNotDefined);
00150
00151 static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
00152 const char* port_name, const char* error, const char* message);
00153
00154 protected:
00155
00156
00157
00158
00159 enum port_type {uses, provides, none};
00160
00161 struct port_t {
00162 port_type type;
00163 int connection_nbr;
00164
00165
00166 Engines::DSC::uses_port uses_port_refs;
00167 std::string repository_id;
00168
00169
00170 Ports::Port_var provides_port_ref;
00171
00172 Ports::PortProperties_var port_prop;
00173 };
00174
00175 typedef std::map<std::string, port_t *> ports;
00176
00177
00178
00179
00180 ports my_ports;
00181 ports::iterator my_ports_it;
00182 };
00183
00184 #endif