Mercurial > hg > Members > kono > Cerium
changeset 859:e39f320c4411
linda connection init
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 17 Jun 2010 04:46:25 +0900 |
parents | fdc24fbeaedc |
children | 649e4cb84683 c26aa4e52258 |
files | Renderer/Test/aquarium.cc Renderer/Test/aquarium.h |
diffstat | 2 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Test/aquarium.cc Thu Jun 17 02:36:21 2010 +0900 +++ b/Renderer/Test/aquarium.cc Thu Jun 17 04:46:25 2010 +0900 @@ -4,9 +4,10 @@ #include "lindaapi.h" #include "aquarium.h" -const char *aquarium::linda_server = "localhost"; +linda_t aquarium::linda_addr = { "localhost", 10000 }; +int aquarium::linda; +const char *usr_help_str = "Usage: ./aquarium -linda LINDA_SERVER_NAME\n"; void TMend(TaskManager *manager); -const char *usr_help_str = "Usage: ./aquarium -linda LINDA_SERVER_NAME\n"; extern void task_initialize(); extern int init(TaskManager *manager, int argc, char *argv[]); @@ -15,12 +16,23 @@ return new aquarium(); } +void init_network() { + aquarium::linda_connect(); + +} + MainLoopPtr aquarium::init(Viewer *sgroot, int screen_w, int screen_h) { + init_network(); return sgroot; } +void +aquarium::linda_connect() { + init_linda(); // セレクタの初期化 + linda = open_linda_java(linda_addr.hostname, linda_addr.port); +} int TMmain(TaskManager *manager, int argc, char *argv[]) @@ -30,8 +42,10 @@ for (int i = 0; i < argc; i++) { if (strcmp(argv[i],"-linda") == 0 && i + 1 <= argc) { - aquarium::linda_server = argv[i+1]; - } + aquarium::linda_addr.hostname = argv[i+1]; + } else if (strcmp(argv[i],"-port") == 0 && i + 1 <= argc) { + aquarium::linda_addr.port = atoi(argv[i+1]); + } } return init(manager, argc, argv); }
--- a/Renderer/Test/aquarium.h Thu Jun 17 02:36:21 2010 +0900 +++ b/Renderer/Test/aquarium.h Thu Jun 17 04:46:25 2010 +0900 @@ -3,9 +3,15 @@ #include "SceneGraphRoot.h" #include "Application.h" #include "MainLoop.h" +typedef struct { + const char *hostname; + int port; +} linda_t; class aquarium : public Application { public: - static const char *linda_server; + static linda_t linda_addr; + static int linda; + static void linda_connect(); MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); };