package RTT.corba; /** * RTT/corba/_CDataFlowInterfaceStub.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from DataFlow.idl * Wednesday, July 11, 2012 5:26:42 PM CEST */ /** * An interface to access the dataflow * of a CControlTask object. Data ports are exported as * assignable expressions (Set/Get). Buffer ports are * exported as buffer channels. * @ingroup CompIDL */ public class _CDataFlowInterfaceStub extends org.omg.CORBA.portable.ObjectImpl implements RTT.corba.CDataFlowInterface { /** * Returns the names of the ports of this component. */ public String[] getPorts () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("getPorts", true); $in = _invoke ($out); String $result[] = RTT.corba.CDataFlowInterfacePackage.CPortNamesHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return getPorts ( ); } finally { _releaseReply ($in); } } // getPorts /** * Returns the names of the ports of this component. */ public RTT.corba.CPortDescription[] getPortDescriptions () { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("getPortDescriptions", true); $in = _invoke ($out); RTT.corba.CPortDescription $result[] = RTT.corba.CDataFlowInterfacePackage.CPortDescriptionsHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return getPortDescriptions ( ); } finally { _releaseReply ($in); } } // getPortDescriptions /** * Returns the type of the given port */ public RTT.corba.CPortType getPortType (String port_name) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("getPortType", true); $out.write_string (port_name); $in = _invoke ($out); RTT.corba.CPortType $result = RTT.corba.CPortTypeHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return getPortType (port_name ); } finally { _releaseReply ($in); } } // getPortType /** * Returns the data type for the given port */ public String getDataType (String port_name) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("getDataType", true); $out.write_string (port_name); $in = _invoke ($out); String $result = $in.read_string (); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return getDataType (port_name ); } finally { _releaseReply ($in); } } // getDataType /** * Check if the given port is already connected to something */ public boolean isConnected (String port_name) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("isConnected", true); $out.write_string (port_name); $in = _invoke ($out); boolean $result = $in.read_boolean (); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return isConnected (port_name ); } finally { _releaseReply ($in); } } // isConnected /** * Disconnects this port from all connections it is part of. * @see CChannelElement::disconnect() to disconnect a single Channel. */ public void disconnectPort (String port_name) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("disconnectPort", true); $out.write_string (port_name); $in = _invoke ($out); return; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { disconnectPort (port_name ); } finally { _releaseReply ($in); } } // disconnectPort /** * Use this to write to an input port with * the given policy. * Some protocols may adjust the policy, or pass additional information * into the policy, such as the name of the newly created connection. * * The returned channel element will not be functional until * channelReady() has been called for it */ public RTT.corba.CChannelElement buildChannelOutput (String input_port, RTT.corba.CConnPolicyHolder policy) throws RTT.corba.CNoCorbaTransport, RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("buildChannelOutput", true); $out.write_string (input_port); RTT.corba.CConnPolicyHelper.write ($out, policy.value); $in = _invoke ($out); RTT.corba.CChannelElement $result = RTT.corba.CChannelElementHelper.read ($in); policy.value = RTT.corba.CConnPolicyHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoCorbaTransport:1.0")) throw RTT.corba.CNoCorbaTransportHelper.read ($in); else if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return buildChannelOutput (input_port, policy ); } finally { _releaseReply ($in); } } // buildChannelOutput /** * Use this to read from an output port with * the given policy. * Some protocols may adjust the policy, or pass additional information * into the policy, such as the name of the newly created connection. */ public RTT.corba.CChannelElement buildChannelInput (String output_port, RTT.corba.CConnPolicyHolder policy) throws RTT.corba.CNoCorbaTransport, RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("buildChannelInput", true); $out.write_string (output_port); RTT.corba.CConnPolicyHelper.write ($out, policy.value); $in = _invoke ($out); RTT.corba.CChannelElement $result = RTT.corba.CChannelElementHelper.read ($in); policy.value = RTT.corba.CConnPolicyHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoCorbaTransport:1.0")) throw RTT.corba.CNoCorbaTransportHelper.read ($in); else if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return buildChannelInput (output_port, policy ); } finally { _releaseReply ($in); } } // buildChannelInput /** * Connect the given named port to the given remote port. * Use this method to connect two Orocos data flow ports. * * The local port needs to be the output, while the remote port is the * input. In case you only want to write a port without using this function, * use buildChannelOutput. For only reading a port, use buildChannelInput. * * This method combines both buildChannelOutput() and buildChannelInput() and is * generally better in setting up and checking a data flow connection between * two ports than the separate methods. * * This method will call the \a remote_ports interface back to orchestrate * the connection building. * * @see removeConnection() to remove this connection again. */ public boolean createConnection (String local_port, RTT.corba.CDataFlowInterface remote_ports, String remote_port, RTT.corba.CConnPolicyHolder policy) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("createConnection", true); $out.write_string (local_port); RTT.corba.CDataFlowInterfaceHelper.write ($out, remote_ports); $out.write_string (remote_port); RTT.corba.CConnPolicyHelper.write ($out, policy.value); $in = _invoke ($out); boolean $result = $in.read_boolean (); policy.value = RTT.corba.CConnPolicyHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return createConnection (local_port, remote_ports, remote_port, policy ); } finally { _releaseReply ($in); } } // createConnection /** * Removes the specified connection created with createConnection. */ public boolean removeConnection (String local_port, RTT.corba.CDataFlowInterface remote_ports, String remote_port) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("removeConnection", true); $out.write_string (local_port); RTT.corba.CDataFlowInterfaceHelper.write ($out, remote_ports); $out.write_string (remote_port); $in = _invoke ($out); boolean $result = $in.read_boolean (); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return removeConnection (local_port, remote_ports, remote_port ); } finally { _releaseReply ($in); } } // removeConnection /** * Create an out-of-band data stream with a given policy. * You may specify a name_id in the policy object, or if left empty, * a name will be chosen for you. */ public boolean createStream (String local_port, RTT.corba.CConnPolicyHolder policy) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("createStream", true); $out.write_string (local_port); RTT.corba.CConnPolicyHelper.write ($out, policy.value); $in = _invoke ($out); boolean $result = $in.read_boolean (); policy.value = RTT.corba.CConnPolicyHelper.read ($in); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return createStream (local_port, policy ); } finally { _releaseReply ($in); } } // createStream /** * Removes a stream added with createStream. * @param local_port The port to remove the stream from. * @param stream_name The name_id returned in the CConnPolicy object * after the call to createStream. */ public void removeStream (String local_port, String stream_name) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("removeStream", true); $out.write_string (local_port); $out.write_string (stream_name); $in = _invoke ($out); return; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { removeStream (local_port, stream_name ); } finally { _releaseReply ($in); } } // removeStream /** * Checks if the connection channel elements are ready for a given * input port. * This is typically called by the createConnection setup logic to see * if the input side agrees with the connection and can use it. * For example, the input port can use this opportunity to check the * * @throw CNoSuchPortException if input_port is not an input port * or not present in this interface. * @return false if the connection could not be used. */ public boolean channelReady (String input_port, RTT.corba.CChannelElement channel) throws RTT.corba.CNoSuchPortException { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("channelReady", true); $out.write_string (input_port); RTT.corba.CChannelElementHelper.write ($out, channel); $in = _invoke ($out); boolean $result = $in.read_boolean (); return $result; } catch (org.omg.CORBA.portable.ApplicationException $ex) { $in = $ex.getInputStream (); String _id = $ex.getId (); if (_id.equals ("IDL:RTT/corba/CNoSuchPortException:1.0")) throw RTT.corba.CNoSuchPortExceptionHelper.read ($in); else throw new org.omg.CORBA.MARSHAL (_id); } catch (org.omg.CORBA.portable.RemarshalException $rm) { return channelReady (input_port, channel ); } finally { _releaseReply ($in); } } // channelReady // Type-specific CORBA::Object operations private static String[] __ids = { "IDL:RTT/corba/CDataFlowInterface:1.0"}; public String[] _ids () { return (String[])__ids.clone (); } private void readObject (java.io.ObjectInputStream s) throws java.io.IOException { String str = s.readUTF (); String[] args = null; java.util.Properties props = null; org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props); try { org.omg.CORBA.Object obj = orb.string_to_object (str); org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); _set_delegate (delegate); } finally { orb.destroy() ; } } private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException { String[] args = null; java.util.Properties props = null; org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props); try { String str = orb.object_to_string (this); s.writeUTF (str); } finally { orb.destroy() ; } } } // class _CDataFlowInterfaceStub