예제 #1
0
 /**
  * Write an Erlang port to the stream.
  */
 public void WritePort(OtpErlangPort port)
 {
     Write1(OtpExternal.newPortTag);
     WriteAtom(port.Node);
     Write4BE(port.Id);
     Write4BE(port.Creation);
 }
예제 #2
0
        /**
         * Create an Erlang port from a stream containing a port encoded in Erlang
         * external format.
         *
         * @param buf
         *                the stream containing the encoded port.
         *
         * @exception OtpErlangDecodeException
         *                    if the buffer does not contain a valid external
         *                    representation of an Erlang port.
         */
        public OtpErlangPort(OtpInputStream buf)
        {
            OtpErlangPort p = buf.read_port();

            node     = p.Node;
            id       = p.Id;
            creation = p.Creation;
        }
예제 #3
0
        /*
         * Create a unique Erlang port belonging to the local node. Since it isn't
         * meaninful to do so, this constructor is private...
         *
         * @param self the local node.
         *
         * @deprecated use OtpLocalNode:createPort() instead
         */
        private OtpErlangPort(OtpSelf self)
        {
            OtpErlangPort p = self.createPort();

            id       = p.id;
            creation = p.creation;
            node     = p.node;
        }
예제 #4
0
        /**
         * Determine if two ports are equal. Ports are equal if their components are
         * equal.
         *
         * @param o
         *                the other port to compare to.
         *
         * @return true if the ports are equal, false otherwise.
         */
        public override bool Equals(Object o)
        {
            if (!(o is OtpErlangPort))
            {
                return(false);
            }

            OtpErlangPort port = (OtpErlangPort)o;

            return(creation == port.creation && id == port.id &&
                   node.CompareTo(port.node) == 0);
        }
예제 #5
0
        /**
         * Create an Erlang {@link OtpErlangPort port}. Erlang ports are based upon
         * some node specific information; this method creates a port using the
         * information in this node. Each call to this method produces a unique
         * port. It may not be meaningful to create a port in a non-Erlang
         * environment, but this method is provided for completeness.
         *
         * @return an Erlang port.
         */
        public OtpErlangPort createPort()
        {
            lock (this)
            {
                OtpErlangPort p = new OtpErlangPort(base.Node, portCount, base.Creation);

                portCount++;
                if (portCount > 0xfffffff) /* 28 bits */
                {
                    portCount = 0;
                }

                return(p);
            }
        }
예제 #6
0
        /**
         * Create an Erlang {@link OtpErlangPort port}. Erlang ports are based upon
         * some node specific information; this method creates a port using the
         * information in this node. Each call to this method produces a unique
         * port. It may not be meaningful to create a port in a non-Erlang
         * environment, but this method is provided for completeness.
         */
        public OtpErlangPort CreatePort()
        {
            lock (lockObj)
            {
                OtpErlangPort newPort = new OtpErlangPort(OtpExternal.newPortTag, Node, portCount, Creation);

                portCount++;
                if (portCount > 0xfffffff) /* 28 bits */
                {
                    portCount = 0;
                }

                return(newPort);
            }
        }
예제 #7
0
        /**
         * Create an Erlang {@link OtpErlangPort port}. Erlang ports are based upon
         * some node specific information; this method creates a port using the
         * information in this node. Each call to this method produces a unique
         * port. It may not be meaningful to create a port in a non-Erlang
         * environment, but this method is provided for completeness.
         *
         * @return an Erlang port.
         */
        public OtpErlangPort createPort()
        {
            lock (this)
            {
                OtpErlangPort p = new OtpErlangPort(base.Node, portCount, base.Creation);

                portCount++;
                if (portCount > 0xfffffff) /* 28 bits */
                {
                    portCount = 0;
                }

                return p;
            }
        }