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
00027 #ifndef _DSC_INTERFACE_HXX_
00028 #define _DSC_INTERFACE_HXX_
00029
00030 #include <iostream>
00031 #include <map>
00032 #include <string.h>
00033 #include <assert.h>
00034
00035 #include "DSC_Callbacks.hxx"
00036
00043 class Engines_DSC_interface:
00044 public DSC_Callbacks
00045 {
00046 public:
00047 Engines_DSC_interface();
00048 virtual ~Engines_DSC_interface();
00049
00053 virtual void add_provides_port(Ports::Port_ptr ref,
00054 const char* provides_port_name,
00055 Ports::PortProperties_ptr port_prop)
00056 throw (Engines::DSC::PortAlreadyDefined,
00057 Engines::DSC::NilPort,
00058 Engines::DSC::BadProperty);
00059
00063 virtual void add_uses_port(const char* repository_id,
00064 const char* uses_port_name,
00065 Ports::PortProperties_ptr port_prop)
00066 throw (Engines::DSC::PortAlreadyDefined,
00067 Engines::DSC::BadProperty);
00068
00072 virtual Ports::Port_ptr get_provides_port(const char* provides_port_name,
00073 const CORBA::Boolean connection_error)
00074 throw (Engines::DSC::PortNotDefined,
00075 Engines::DSC::PortNotConnected,
00076 Engines::DSC::BadPortType);
00077
00081 virtual Engines::DSC::uses_port * get_uses_port(const char* uses_port_name)
00082 throw (Engines::DSC::PortNotDefined,
00083 Engines::DSC::PortNotConnected,
00084 Engines::DSC::BadPortType);
00085
00094 virtual void connect_provides_port(const char* provides_port_name)
00095 throw (Engines::DSC::PortNotDefined);
00096
00103 virtual void connect_uses_port(const char* uses_port_name,
00104 Ports::Port_ptr provides_port_ref)
00105 throw (Engines::DSC::PortNotDefined,
00106 Engines::DSC::BadPortType,
00107 Engines::DSC::NilPort);
00108
00112 virtual CORBA::Boolean is_connected(const char* port_name)
00113 throw (Engines::DSC::PortNotDefined);
00114
00123 virtual void disconnect_provides_port(const char* provides_port_name,
00124 const Engines::DSC::Message message)
00125 throw (Engines::DSC::PortNotDefined,
00126 Engines::DSC::PortNotConnected);
00127
00139 virtual void disconnect_uses_port(const char* uses_port_name,
00140 Ports::Port_ptr provides_port_ref,
00141 const Engines::DSC::Message message)
00142 throw (Engines::DSC::PortNotDefined,
00143 Engines::DSC::PortNotConnected,
00144 Engines::DSC::BadPortReference);
00145
00149 virtual Ports::PortProperties_ptr get_port_properties(const char* port_name)
00150 throw (Engines::DSC::PortNotDefined);
00151
00152 static void writeEvent(const char* request,const std::string& containerName, const char* instance_name,
00153 const char* port_name, const char* error, const char* message);
00154
00155 protected:
00156
00157
00158
00159
00160 enum port_type {uses, provides, none};
00161
00162 struct port_t {
00163 port_type type;
00164 int connection_nbr;
00165
00166
00167 Engines::DSC::uses_port uses_port_refs;
00168 std::string repository_id;
00169
00170
00171 Ports::Port_var provides_port_ref;
00172
00173 Ports::PortProperties_var port_prop;
00174 };
00175
00176 typedef std::map<std::string, port_t *> ports;
00177
00178
00179
00180
00181 ports my_ports;
00182 ports::iterator my_ports_it;
00183 };
00184
00185 #endif