Revision: 44673
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44673&view=rev
Author:   davidloman
Date:     2011-05-24 19:32:11 +0000 (Tue, 24 May 2011)

Log Message:
-----------
Add in handling of DirectoryList request and response messages into the test 
client.

Modified Paths:
--------------
    geomcore/trunk/src/GS/GSClient.cxx
    geomcore/trunk/src/GS/GSCmdLineClient.cxx

Modified: geomcore/trunk/src/GS/GSClient.cxx
===================================================================
--- geomcore/trunk/src/GS/GSClient.cxx  2011-05-24 19:29:45 UTC (rev 44672)
+++ geomcore/trunk/src/GS/GSClient.cxx  2011-05-24 19:32:11 UTC (rev 44673)
@@ -20,6 +20,7 @@
 /** @file GSClient.cxx
  *
  */
+#include "raytrace.h"
 
 #include "GSClient.h"
 #include "Portal.h"
@@ -29,8 +30,9 @@
 #include "PongMsg.h"
 #include "GeometryManifestMsg.h"
 #include "GeometryChunkMsg.h"
-#include "raytrace.h"
+#include "DirListResMsg.h"
 
+
 GSClient::GSClient(std::string localNodeName)
 {
     this->log = Logger::getInstance();
@@ -61,6 +63,8 @@
     router->registerType(PONG, this);
     router->registerType(GEOMETRYMANIFEST, this);
     router->registerType(GEOMETRYCHUNK, this);
+    router->registerType(DIRLISTREQ, this);
+    router->registerType(DIRLISTRES, this);
 }
 
 bool
@@ -192,7 +196,43 @@
       delete bb;
       return true;
     }
+  case DIRLISTREQ:
+    {
+      Portal* p = msg->getOrigin();
+      std::string remNodeName("unknown");
+
+      if (p != NULL)
+        remNodeName = p->getRemoteNodeName();
+
+       log->logINFO("GSClient", "Got a directory list *REQUEST* (?) from " + 
remNodeName);
+
+      return true;
     }
+  case DIRLISTRES:
+    {
+      Portal* p = msg->getOrigin();
+      std::string remNodeName("unknown");
+
+      if (p != NULL)
+        remNodeName = p->getRemoteNodeName();
+
+       DirListResMsg* dir = (DirListResMsg*)msg;
+       std::list<std::string> items;
+       std::list<std::string>::iterator it;
+       std::cout << "\nListing for: " << dir->getPath() << "\n";
+       dir->getItems(&items);
+       it = items.begin();
+
+       if (items.size() == 0)
+         std::cout << "\t -- EMPTY -- \n";
+
+       for(;it != items.end();++it)
+           std::cout << "\t" << (*it) << "\n";
+
+       std::cout << std::endl;
+      return true;
+    }
+    }
   return false;
 }
 

Modified: geomcore/trunk/src/GS/GSCmdLineClient.cxx
===================================================================
--- geomcore/trunk/src/GS/GSCmdLineClient.cxx   2011-05-24 19:29:45 UTC (rev 
44672)
+++ geomcore/trunk/src/GS/GSCmdLineClient.cxx   2011-05-24 19:32:11 UTC (rev 
44673)
@@ -29,13 +29,14 @@
 #include <algorithm>
 
 #include "AbstractClientCmd.h"
+#include "Portal.h"
+#include "ListCmd.h"
 #include "ExitCmd.h"
 #include "HelpCmd.h"
 #include "LoginCmd.h"
 #include "LogoutCmd.h"
 #include "ShutdownCmd.h"
 #include "PingCmd.h"
-#include "Portal.h"
 #include "GetCmd.h"
 
 const std::string GSCmdLineClient::defaultPrompt ="geoclient> ";
@@ -133,6 +134,7 @@
     this->ccReg->registerCmd(new ShutdownCmd());
     this->ccReg->registerCmd(new PingCmd());
     this->ccReg->registerCmd(new GetCmd());
+    this->ccReg->registerCmd(new ListCmd());
 }
 
 bool


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to