Revision: 44724
http://brlcad.svn.sourceforge.net/brlcad/?rev=44724&view=rev
Author: davidloman
Date: 2011-06-02 16:05:38 +0000 (Thu, 02 Jun 2011)
Log Message:
-----------
Change some verbage for clarity.
Modified Paths:
--------------
geomcore/trunk/include/GeometryChunkMsg.h
geomcore/trunk/src/libNet/netMsg/GeometryChunkMsg.cxx
Modified: geomcore/trunk/include/GeometryChunkMsg.h
===================================================================
--- geomcore/trunk/include/GeometryChunkMsg.h 2011-06-02 13:48:20 UTC (rev
44723)
+++ geomcore/trunk/include/GeometryChunkMsg.h 2011-06-02 16:05:38 UTC (rev
44724)
@@ -27,16 +27,17 @@
#define __GEOMETRYCHUNKMSG_H__
#include "NetMsg.h"
+
#include <MinimalObject.h>
class GeometryChunkMsg : public NetMsg
{
public:
/* Normal Constructor */
- GeometryChunkMsg(std::string path, ByteBuffer* dataIn);
+ GeometryChunkMsg(std::string path, ByteBuffer* rawDataIn);
/* Reply Constructor */
- GeometryChunkMsg(NetMsg* msg, std::string path, ByteBuffer* dataIn);
+ GeometryChunkMsg(NetMsg* msg, std::string path, ByteBuffer* rawDataIn);
/* Deserializing Constructor */
GeometryChunkMsg(ByteBuffer* bb, Portal* origin);
@@ -51,13 +52,12 @@
std::string getPath();
ByteBuffer* getByteBuffer();
- static BRLCAD::MinimalObject* chunkToObj(GeometryChunkMsg* msg);
static GeometryChunkMsg* objToChunk(BRLCAD::MinimalObject* Obj, NetMsg*
replyMsg = 0);
protected:
uint32_t getDataLen();
- char* getData();
+
private:
std::string path;
ByteBuffer* data;
Modified: geomcore/trunk/src/libNet/netMsg/GeometryChunkMsg.cxx
===================================================================
--- geomcore/trunk/src/libNet/netMsg/GeometryChunkMsg.cxx 2011-06-02
13:48:20 UTC (rev 44723)
+++ geomcore/trunk/src/libNet/netMsg/GeometryChunkMsg.cxx 2011-06-02
16:05:38 UTC (rev 44724)
@@ -27,19 +27,19 @@
#include <raytrace.h>
/* Normal Constructor */
-GeometryChunkMsg::GeometryChunkMsg(std::string path, ByteBuffer* dataIn) :
+GeometryChunkMsg::GeometryChunkMsg(std::string path, ByteBuffer* rawDataIn) :
NetMsg(GEOMETRYCHUNK), path(path)
{
/* Deep copy */
- this->data = dataIn->duplicate();
+ this->data = rawDataIn->duplicate();
}
/* Reply Constructor */
-GeometryChunkMsg::GeometryChunkMsg(NetMsg* msg, std::string path, ByteBuffer*
dataIn) :
+GeometryChunkMsg::GeometryChunkMsg(NetMsg* msg, std::string path, ByteBuffer*
rawDataIn) :
NetMsg(GEOMETRYCHUNK, msg), path(path)
{
/* Deep copy */
- this->data = dataIn->duplicate();
+ this->data = rawDataIn->duplicate();
}
/* Deserializing Constructor */
@@ -106,7 +106,7 @@
return false;
for (uint32_t i = 0; i < gmsg.getDataLen(); ++i)
- if (this->getData()[i] != gmsg.getData()[i])
+ if (this->data->array()[i] != gmsg.data->array()[i])
return false;
if (this->path != gmsg.path)
@@ -118,10 +118,6 @@
/*
*Getters n Setters
*/
-char* GeometryChunkMsg::getData()
-{
- return this->data->array();
-}
uint32_t GeometryChunkMsg::getDataLen()
{
@@ -134,71 +130,7 @@
return new ByteBuffer(*this->data);
}
-GeometryChunkMsg*
-GeometryChunkMsg::objToChunk(BRLCAD::MinimalObject* obj, NetMsg* replyMsg)
-{
- bu_external* ext = obj->getBuExternal();
- // size_t len = ext->ext_nbytes;
- /* TODO investigate: We MIGHT be double copying here. Depends on if
ByteBuffer copies the data passed to its cstr */
- // char* buf = (char*)bu_malloc(len, "objToChunk buf malloc");
- // memcpy (buf, ext->ext_buf, len);
-
- ByteBuffer* bb = ByteBuffer::wrap( (char*)ext->ext_buf, ext->ext_nbytes);
- //free(buf);
-
- GeometryChunkMsg* out = NULL;
-
- if (replyMsg == NULL)
- out = new GeometryChunkMsg(obj->getFilePath(), bb);
- else
- out = new GeometryChunkMsg(replyMsg, obj->getFilePath(), bb);
-
- delete bb;
-
- return out;
-}
-
-BRLCAD::MinimalObject*
-GeometryChunkMsg::chunkToObj(GeometryChunkMsg* msg)
-{
- if (msg == NULL) {
- bu_log("NULL msg");
- return NULL;
- }
-
- ByteBuffer* bb = msg->getByteBuffer();
-
- if (bb == NULL){
- bu_log("NULL ByteBuffer");
- return NULL;
- }
-
- bu_external* ext = (bu_external*)bu_calloc(1,sizeof(bu_external),"chunkToExt
bu_external calloc");;
-
- size_t len = bb->position();
-
- /* Build bu_external */
- ext->ext_buf = (uint8_t*)bu_calloc(1,len,"chunkToExt bu_external calloc");
- memcpy(ext->ext_buf, bb->array(), len);
-
- /* Get object name */
- struct db5_raw_internal raw;
- if (db5_get_raw_internal_ptr(&raw, (const unsigned char *)bb->array()) ==
NULL) {
- bu_log("Corrupted serialized geometry? Could not deserialize.\n");
- return NULL;
- }
-
- if (raw.name.ext_nbytes < 1) {
- bu_log("Failed to retrieve object name. Could not deserialize.\n");
- return NULL;
- }
-
- std::string name((char*)raw.name.ext_buf);
-
- return new BRLCAD::MinimalObject(msg->getPath(), name, ext);
-}
-
/*
* Local Variables:
* mode: C
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