Revision: 44729
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44729&view=rev
Author:   davidloman
Date:     2011-06-02 16:14:29 +0000 (Thu, 02 Jun 2011)

Log Message:
-----------
Cascading changes from the mods to FileDataSource, BrlcadDb and ExtObject

Modified Paths:
--------------
    geomcore/trunk/src/GS/DataManager.cxx

Modified: geomcore/trunk/src/GS/DataManager.cxx
===================================================================
--- geomcore/trunk/src/GS/DataManager.cxx       2011-06-02 16:12:54 UTC (rev 
44728)
+++ geomcore/trunk/src/GS/DataManager.cxx       2011-06-02 16:14:29 UTC (rev 
44729)
@@ -143,6 +143,7 @@
 void
 DataManager::handleGeometryReqMsg(GeometryReqMsg* originalMsg)
 {
+  int retVal = 0;
   bool recurse = originalMsg->getRecurse();
   std::string path = originalMsg->getPath();
   Portal* origin = originalMsg->getOrigin();
@@ -173,47 +174,63 @@
   log->logINFO("DataManager", ss.str());
 
   /* pull all objects */
-  std::list<BRLCAD::MinimalObject*>* objs = this->datasource->getObjs(path, 
recurse);
-  if (objs == NULL || objs->size() < 1) {
+  std::list<ExtObject*> objs;
+  retVal = this->datasource->getObjs(path, &objs, recurse);
+
+  if (retVal < 0) {
       FailureMsg fm(originalMsg, COULD_NOT_FIND_GEOMETRY);
       origin->send(&fm);
-      log->logERROR("DataManager", "handleGeometryReqMsg(): No objects 
returned on lookup.");
-      if (objs != NULL)
-        delete objs;
+      ss.str("");
+      ss << "handleGeometryReqMsg(): No objects returned on lookup. ret:";
+      ss << retVal;
+      log->logERROR("DataManager", ss.str());
       return;
   }
 
-  log->logDEBUG("DataManager", "Got object list, converting to chunks.");
+  ss.str("");
+  ss << "handleGeometryReqMsg(): Got object list, converting to chunks. 
children count:";
+  ss << retVal;
 
+  log->logDEBUG("DataManager", ss.str());
+  std::list<std::string> items;
+
+  /* Make a quick exit for "no children but good path" case */
+  if (retVal == 0) {
+      GeometryManifestMsg man(originalMsg, items);
+      origin->send(&man);
+      return;
+  }
+
   /* Prep for send */
   std::list<GeometryChunkMsg*> msgs;
-  std::list<std::string> items;
   GeometryChunkMsg* chunk = NULL;
-  BRLCAD::MinimalObject* obj = NULL;
+  ExtObject* obj = NULL;
+  std::list<ExtObject*>::iterator it;
 
+
   /* build manifest & Chunks to send*/
-  for (std::list<BRLCAD::MinimalObject*>::iterator it = objs->begin(); it!= 
objs->end(); it++) {
+  for (it = objs.begin(); it!= objs.end(); it++) {
       obj = *it;
-      chunk = GeometryChunkMsg::objToChunk(obj, originalMsg);
+
+      chunk = obj->toGeometryChunkMsg(originalMsg);
       msgs.push_back(chunk);
-      items.push_back(obj->getFilePath() + "/" + obj->getObjectName());
+
+      //TODO change manifest msg, add 'prepath' to it.
+      items.push_back(obj->getFullPath());
       delete obj;
   }
 
-  delete objs;
-
   /* Send manifest */
-  GeometryManifestMsg* man = new GeometryManifestMsg(originalMsg, items);
-
-  ByteBuffer* temp = man->serialize();
+  GeometryManifestMsg man(originalMsg, items);
+/*
+  ByteBuffer* temp = man.serialize();
   std::stringstream ss2;
   ss2 << "Manifest byte size: " << temp->position();
   log->logDEBUG("DataManager", ss2.str());
   delete temp;
+*/
+  origin->send(&man);
 
-  origin->send(man);
-  delete man;
-
   log->logDEBUG("DataManager", "Manifest send complete, sending chunks.");
 
   /* Send chunks */


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

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to