Revision: 44664
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44664&view=rev
Author:   davidloman
Date:     2011-05-24 17:55:12 +0000 (Tue, 24 May 2011)

Log Message:
-----------
The directory list response needs to carry the requested path back to the 
caller.

Modified Paths:
--------------
    geomcore/trunk/include/DirListResMsg.h
    geomcore/trunk/src/GS/DataManager.cxx
    geomcore/trunk/src/libNet/netMsg/DirListResMsg.cxx

Modified: geomcore/trunk/include/DirListResMsg.h
===================================================================
--- geomcore/trunk/include/DirListResMsg.h      2011-05-24 17:39:25 UTC (rev 
44663)
+++ geomcore/trunk/include/DirListResMsg.h      2011-05-24 17:55:12 UTC (rev 
44664)
@@ -34,10 +34,10 @@
 {
 public:
        /* Normal Constructor */
-       DirListResMsg(std::list<std::string>* items);
+       DirListResMsg(std::string path, std::list<std::string>* items);
 
        /* Reply Constructor */
-       DirListResMsg(NetMsg* msg, std::list<std::string>* items);
+       DirListResMsg(NetMsg* msg, std::string path, std::list<std::string>* 
items);
 
        /* Deserializing Constructor */
        DirListResMsg(ByteBuffer* bb, Portal* origin);
@@ -50,10 +50,12 @@
        /*
         *Getters n Setters
         */
-       uint32_t getNumOfItems();
+       std::string getPath();
+        uint32_t getNumOfItems();
        uint32_t getItems(std::list<std::string>* items);
 
 private:
+       std::string path;
        std::list<std::string>* itemData;
 
        bool _serialize(ByteBuffer* bb);

Modified: geomcore/trunk/src/GS/DataManager.cxx
===================================================================
--- geomcore/trunk/src/GS/DataManager.cxx       2011-05-24 17:39:25 UTC (rev 
44663)
+++ geomcore/trunk/src/GS/DataManager.cxx       2011-05-24 17:55:12 UTC (rev 
44664)
@@ -111,7 +111,7 @@
   std::list<std::string> items;
   this->datasource->getListing(path, &items);
 
-  DirListResMsg response(msg, &items);
+  DirListResMsg response(msg, path, &items);
   origin->send(&response);
 }
 

Modified: geomcore/trunk/src/libNet/netMsg/DirListResMsg.cxx
===================================================================
--- geomcore/trunk/src/libNet/netMsg/DirListResMsg.cxx  2011-05-24 17:39:25 UTC 
(rev 44663)
+++ geomcore/trunk/src/libNet/netMsg/DirListResMsg.cxx  2011-05-24 17:55:12 UTC 
(rev 44664)
@@ -29,15 +29,15 @@
 
 /* Normal Constructor */
 DirListResMsg::DirListResMsg(
-    std::list<std::string>* items) :
-    NetMsg(GEOMETRYMANIFEST)
+    std::string path, std::list<std::string>* items) :
+    NetMsg(GEOMETRYMANIFEST), path(path)
 {
     this->itemData = new std::list<std::string> (*items);
 }
 
 /* Reply Constructor */
-DirListResMsg::DirListResMsg(NetMsg* msg, std::list<std::string>* items) :
-       NetMsg(GEOMETRYMANIFEST, msg)
+DirListResMsg::DirListResMsg(NetMsg* msg, std::string path, 
std::list<std::string>* items) :
+       NetMsg(GEOMETRYMANIFEST, msg), path(path)
 {
   this->itemData = new std::list<std::string> (*items);
 }
@@ -46,6 +46,8 @@
 DirListResMsg::DirListResMsg(ByteBuffer* bb, Portal* origin) :
   NetMsg(bb, origin)
 {
+  this->path = bb->getString();
+
   this->itemData = new std::list<std::string>();
   uint32_t numOfItems = bb->get32bit();
   std::string tstr;
@@ -67,6 +69,8 @@
 bool
 DirListResMsg::_serialize(ByteBuffer* bb)
 {
+  bb->putString(this->path);
+
   /* put in placeholder for count */
   int start = bb->position();
   bb->put32bit(0);
@@ -98,6 +102,9 @@
 DirListResMsg::_equals(const NetMsg& msg)
 {
   DirListResMsg& gmsg = (DirListResMsg&) msg;
+  if (this->path != gmsg.path)
+    return false;
+
   if (this->itemData->size() != gmsg.itemData->size())
     return false;
   std::list<std::string>::iterator it = this->itemData->begin(), git =
@@ -110,17 +117,25 @@
 }
 
 std::string
+DirListResMsg::getPath()
+{
+  return this->path;
+}
+
+std::string
 DirListResMsg::toString()
 {
-  std::string out = "Number of items: " + this->itemData->size();
+  std::stringstream ss;
+  ss << "path: " << this->path << ", ";
+  ss << "items count: " << this->itemData->size();
 
   std::list<std::string>::iterator it;
   for (it = this->itemData->begin(); it != this->itemData->end(); ++it)
     {
-      out += "{" + *it + "} ";
+      ss << "{" << *it << "} ";
     }
 
-  return out;
+  return ss.str();
 }
 
 /*


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