Inheritance: OtpLocalNode
コード例 #1
0
 /**
  * package constructor: called by OtpNode:createMbox(name) to create a named mbox
  */
 internal OtpMbox(OtpNode home, OtpErlangPid self, string name)
 {
     Name      = name;
     Self      = self;
     this.home = home;
     links     = new Links(10);
 }
コード例 #2
0
 public Mailboxes(OtpNode node, OtpActorSched sched)
 {
     this.node  = node;
     this.sched = sched;
     byPid      = new Dictionary <OtpErlangPid, WeakReference>();
     byName     = new Dictionary <String, WeakReference>();
 }
コード例 #3
0
 /*
  * Intiate and open a connection to a remote node.
  *
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  *
  * @exception OtpAuthException if handshake resulted in an authentication
  * error.
  */
 // package scope
 internal OtpCookedConnection(OtpNode self, OtpPeer other)
     : base(self, other)
 {
     this.self = self;
     links     = new Links(25);
     start();
 }
コード例 #4
0
 /*
  * Accept an incoming connection from a remote node. Used by {@link
  * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
  * received when handshaking with the peer node, when the remote node is the
  * connection intitiator.
  *
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  *
  * @exception OtpAuthException if handshake resulted in an authentication
  * error
  */
 // package scope
 internal OtpCookedConnection(OtpNode self, BufferedTcpClient s)
     : base(self, s)
 {
     this.self = self;
     links     = new Links(25);
     start();
 }
コード例 #5
0
 // package constructor: called by OtpNode:createMbox(name)
 // to create a named mbox
 internal OtpMbox(OtpNode home, OtpErlangPid self, String name)
 {
     this.self = self;
     this.home = home;
     this.name = name;
     queue     = new GenericQueue();
     links     = new Links(10);
 }
コード例 #6
0
ファイル: ping.cs プロジェクト: takayuki/Erlang.NET
 public static void Main(string[] args)
 {
     OtpNode pingNode = new OtpNode("ping");
     OtpNode pongNode = new OtpNode("pong");
     bool ok = pingNode.ping("pong", 10000);
     pingNode.close();
     pongNode.close();
     Environment.Exit(ok ? 0 : 1);
 }
コード例 #7
0
            public Acceptor(OtpNode node, int port)
                : base("OtpNode.Acceptor", true)
            {
                this.node = node;

                sock = new TcpListener(new IPEndPoint(IPAddress.Any, port));
                sock.Start();
                this.port = ((IPEndPoint)sock.LocalEndpoint).Port;
                node.port = this.port;
                publishPort();
                base.start();
            }
コード例 #8
0
ファイル: echo.cs プロジェクト: stangelandcl/Erlang.NET
 public static void Main(string[] args)
 {
     OtpNode a = new OtpNode("a");
     OtpNode b = new OtpNode("b");
     OtpActorMbox echo = (OtpActorMbox)b.createMbox("echo", false);
     b.react(new OtpEchoActor(echo));
     OtpMbox echoback = a.createMbox("echoback", true);
     OtpErlangObject[] v = { echoback.Self, new OtpErlangString("Hello, World!") };
     echoback.send(echo.Self, new OtpErlangTuple(v));
     log.Debug("<- ECHO (back) " + echoback.receive());
     b.close();
     a.close();
 }
コード例 #9
0
        public PCVMActor(Scene scene, IConfigSource source, OtpNode node, OtpActorMbox mbox)
            : base(mbox)
        {
            m_scene = scene;
            m_source = source;
            m_node = node;
            m_mbox = mbox;

            m_dict = new PCDict();
            m_vm = new PCVM(m_scene, m_source, m_dict);
        }
コード例 #10
0
 public KernelActor(Scene scene, IConfigSource source, OtpNode node, OtpActorMbox mbox)
     : base(mbox)
 {
     m_scene = scene;
     m_source = source;
     m_node = node;
     m_mbox = mbox;
 }
コード例 #11
0
        public void Initialise(Scene scene, IConfigSource source)
        {
            m_scene = scene;
            m_source = source;

            try
            {
                m_node = new OtpNode("pc");
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[Distributed PC] Failed to create an Erlang Node: {0}", e.Message);
            }
        }
コード例 #12
0
 /*
  * Intiate and open a connection to a remote node.
  */
 internal OtpCookedConnection(OtpNode self, OtpPeer other)
     : base(self, other)
 {
     this.self = self;
     Start();
 }
コード例 #13
0
 // package constructor: called by OtpNode:createMbox(name)
 // to create a named mbox
 internal OtpMbox(OtpNode home, OtpErlangPid self, String name)
 {
     this.self = self;
     this.home = home;
     this.name = name;
     queue = new GenericQueue();
     links = new Links(10);
 }
コード例 #14
0
ファイル: OtpActorMbox.cs プロジェクト: tarachom/Erlang.NET
 internal OtpActorMbox(OtpActorSched sched, OtpNode home, OtpErlangPid self)
     : base(home, self, null)
 {
     this.sched = sched;
 }
コード例 #15
0
 /*
  * Intiate and open a connection to a remote node.
  *
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  *
  * @exception OtpAuthException if handshake resulted in an authentication
  * error.
  */
 // package scope
 internal OtpCookedConnection(OtpNode self, OtpPeer other)
     : base(self, other)
 {
     this.self = self;
     links = new Links(25);
     start();
 }
コード例 #16
0
 // package constructor: called by OtpNode:createMbox()
 // to create an anonymous
 internal OtpMbox(OtpNode home, OtpErlangPid self)
     : this(home, self, null)
 {
 }
コード例 #17
0
 internal OtpActorMbox(OtpActorSched sched, OtpNode home, OtpErlangPid self)
     : base(home, self, null)
 {
     this.sched = sched;
 }
コード例 #18
0
ファイル: Maze.cs プロジェクト: takayuki/opensim-pcproject
        public static void Main(string[] args)
        {
            OtpNode node = new OtpNode("gen");
            OtpMbox mbox = node.createMbox(true);
            OtpErlangObject message = new OtpErlangTuple(new OtpErlangObject[] { mbox.Self, new OtpErlangAtom("new") });

            mbox.send("kernel", "pc@3di0050d", message);
            OtpErlangTuple reply = (OtpErlangTuple)mbox.receive();

            OtpErlangPid self = (OtpErlangPid)reply.elementAt(0);
            OtpErlangAtom ok = (OtpErlangAtom)reply.elementAt(1);
            OtpErlangPid pid = (OtpErlangPid)reply.elementAt(2);

            Console.WriteLine("New: {0}", ok);
            if (ok.ToString() != "ok")
            {
                return;
            }

            mbox.link(pid);

            Maze m = new Maze(50, 50);
            m.Generate();

            string script = String.Empty;
            double z = 25.0;
            double w = 5.0;
            double h = 5.0;
            double d = 0.5;

            script += String.Format("/L {{moveto createbox dup <{0},{1},{2}> setsize dup show}} def\n", d, (w + d), h);
            script += String.Format("/B {{moveto createbox dup <{0},{1},{2}> setsize dup show}} def\n", (w + d), d, h);

            foreach (Cell c in m.Cell)
            {
                double x = ((float)c.X) * w + 3.0;
                double y = ((float)c.Y) * w + 3.0;

                if (c.Left)
                {
                    script += String.Format("<{0},{1},{2}> L\n", x, (y + w / 2.0), (z + h / 2.0));
                }
                if (c.Bottom)
                {
                    script += String.Format("<{0},{1},{2}> B\n", (x + w / 2.0), y, (z + h / 2.0));
                }
            }

            Load(mbox, pid, script);

            Console.WriteLine("Hit return key to continue");
            Console.ReadLine();

            mbox.send(pid, new OtpErlangTuple(new OtpErlangObject[] { mbox.Self, new OtpErlangAtom("exit") }));
            reply = (OtpErlangTuple)mbox.receive();

            mbox.close();
            node.close();
        }
コード例 #19
0
ファイル: NBody.cs プロジェクト: takayuki/opensim-pcproject
        public static void Main(string[] args)
        {
            OtpNode node = new OtpNode("gen");
            OtpMbox mbox = node.createMbox(true);
            OtpErlangObject message = new OtpErlangTuple(new OtpErlangObject[] { mbox.Self, new OtpErlangAtom("new") });

            mbox.send("kernel", "pc@3di0050d", message);
            OtpErlangTuple reply = (OtpErlangTuple)mbox.receive();

            OtpErlangPid self = (OtpErlangPid)reply.elementAt(0);
            OtpErlangAtom ok = (OtpErlangAtom)reply.elementAt(1);
            OtpErlangPid pid = (OtpErlangPid)reply.elementAt(2);

            Console.WriteLine("New: {0}", ok);
            if (ok.ToString() != "ok")
            {
                return;
            }

            mbox.link(pid);

            using (CUDA cuda = new CUDA(0, true))
            {
                float deltaTime = 0.1f;
                int nextTickCount;

                using (NBody nbody = new NBody(cuda, deltaTime, 1.0f, 32))
                {
                    string script = String.Empty;

                    nbody.Initialize();

                    script += String.Format("<128,128,50> translate\n");
                    script += String.Format("/C {{moveto createsphere dup <1,1,1> setsize dup show }} def\n");

                    for (int i = 0; i < nbody.HostOldPos.Length; i++)
                    {
                        Float4 pos = nbody.HostOldPos[i];
                        script += String.Format("<{0},{1},{2}> C /b{3} exch def\n", pos.x, pos.y, pos.z, i);
                    }

                    Load(mbox, pid, script);
                    script = String.Empty;

                    nextTickCount = System.Environment.TickCount;
                    for (ulong frame = 0; frame < 300; frame++)
                    {
                        while (System.Environment.TickCount < nextTickCount);
                        nextTickCount = nextTickCount + (int)(deltaTime * 1000);

                        nbody.Update(0);
                        nbody.Swap();

                        for (int i = 0; i < nbody.HostOldPos.Length; i++)
                        {
                            Float4 pos = nbody.HostOldPos[i];
                            script += String.Format("b{3} <{0},{1},{2}> setposition \n", pos.x, pos.y, pos.z, i);
                        }

                        Load(mbox, pid, script);
                        script = String.Empty;
                    }
                }
            }

            Console.WriteLine("Hit return key to continue");
            Console.ReadLine();

            mbox.send(pid, new OtpErlangTuple(new OtpErlangObject[] { mbox.Self, new OtpErlangAtom("exit") }));
            reply = (OtpErlangTuple)mbox.receive();

            mbox.close();
            node.close();
        }
コード例 #20
0
 /**
  * package constructor: called by OtpNode:createMbox() to create an anonymous mbox
  */
 internal OtpMbox(OtpNode home, OtpErlangPid self)
     : this(home, self, null)
 {
 }
コード例 #21
0
ファイル: OtpNode.cs プロジェクト: takayuki/opensim-pcproject
            public Acceptor(OtpNode node, int port)
                : base("OtpNode.Acceptor", true)
            {
                this.node = node;

                sock = new TcpListener(new IPEndPoint(IPAddress.Any, port));
                sock.Start();
                this.port = ((IPEndPoint)sock.LocalEndpoint).Port;
                node.port = this.port;
                publishPort();
                base.start();
            }
コード例 #22
0
 /*
  * Accept an incoming connection from a remote node. Used by {@link
  * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
  * received when handshaking with the peer node, when the remote node is the
  * connection intitiator.
  */
 internal OtpCookedConnection(OtpNode self, IOtpTransport s)
     : base(self, s)
 {
     this.self = self;
     Start();
 }
コード例 #23
0
ファイル: OtpNode.cs プロジェクト: takayuki/opensim-pcproject
 public Mailboxes(OtpNode node, OtpActorSched sched)
 {
     this.node = node;
     this.sched = sched;
     byPid = new Dictionary<OtpErlangPid, WeakReference>();
     byName = new Dictionary<String, WeakReference>();
 }
コード例 #24
0
 /*
  * Accept an incoming connection from a remote node. Used by {@link
  * OtpSelf#accept() OtpSelf.accept()} to create a connection based on data
  * received when handshaking with the peer node, when the remote node is the
  * connection intitiator.
  *
  * @exception java.io.IOException if it was not possible to connect to the
  * peer.
  *
  * @exception OtpAuthException if handshake resulted in an authentication
  * error
  */
 // package scope
 internal OtpCookedConnection(OtpNode self, BufferedTcpClient s)
     : base(self, s)
 {
     this.self = self;
     links = new Links(25);
     start();
 }
コード例 #25
0
ファイル: OtpActorMbox.cs プロジェクト: tarachom/Erlang.NET
 internal OtpActorMbox(OtpActorSched sched, OtpNode home, OtpErlangPid self, String name)
     : base(home, self, name)
 {
     this.sched = sched;
 }
コード例 #26
0
 internal OtpActorMbox(OtpActorSched sched, OtpNode home, OtpErlangPid self, String name)
     : base(home, self, name)
 {
     this.sched = sched;
 }