- Timestamp:
- Mar 7, 2006, 9:00:14 PM (18 years ago)
- Location:
- trunk/src/mesh
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mesh/Makefile
r289 r294 94 94 # RpValueDouble.o RpValueString.o 95 95 RP_MESH_DEPS = grid1d.o grid1d_reg.o grid2d.o node3d.o node2d.o \ 96 element.o mesh.o serializ er.o util.o \97 #field.o96 element.o mesh.o serializable.o serializer.o util.o \ 97 const.o #field.o 98 98 99 99 LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib … … 188 188 util.o: util.cc 189 189 $(CXX) $(CFLAGS) $(DEBUG) -c $? 190 const.o: const.cc 191 $(CXX) $(CFLAGS) $(DEBUG) -c $? 190 192 node2d.o: node2d.cc 191 193 $(CXX) $(CFLAGS) $(DEBUG) -c $? … … 196 198 mesh.o: mesh.cc 197 199 $(CXX) $(CFLAGS) $(DEBUG) -c $? 198 #serializable.o: serializable.cc199 #$(CXX) $(CFLAGS) $(DEBUG) -c $?200 serializable.o: serializable.cc 201 $(CXX) $(CFLAGS) $(DEBUG) -c $? 200 202 serializer.o: serializer.cc 201 203 $(CXX) $(CFLAGS) $(DEBUG) -c $? -
trunk/src/mesh/grid1d.cc
r293 r294 111 111 char * ptr = buf; 112 112 113 writeHeader(ptr, Grid1d_current_version, nbytes);113 writeHeader(ptr, RpGrid1d_current_version, nbytes); 114 114 ptr += HEADER_SIZE + sizeof(int); 115 115 … … 140 140 ptr += HEADER_SIZE and sizeof(int); 141 141 142 if (header == 142 if (header == RpGrid1d_current_version) 143 143 return doDeserialize(ptr); 144 144 -
trunk/src/mesh/rp_types.h
r282 r294 18 18 }; 19 19 20 const char* RpObjectTypes[] = { 21 "BOOLEAN", 22 "NUMBER", 23 "STRING", 24 "FIELD", 25 "MESH3D", 26 "ELEMENT", 27 "NODE2D", 28 "NODE3D", 29 "GRID1D", 30 "GRID2D", 31 "GRID3D", 32 "CURVE2D" 33 }; 20 extern const char* RpObjectTypes[]; 34 21 35 const int HEADER_SIZE = 16;22 extern const int HEADER_SIZE; 36 23 37 const char* Grid1d_current_version = "RV-A-GRID1D";38 const char* Grid2d_current_version = "RV-A-GRID2D";39 const char* Mesh3d_current_version = "RV-A-MESH3D";40 const char* Field_current_version = "RV-A-FIELD";41 const char* Curve_current_version = "RV-A-CURVE";42 const char* Element_current_version = "RV-A-ELEMENT";43 const char* Node2d_current_version = "RV-A-NODE2D";44 const char* Node3d_current_version = "RV-A-NODE3D";24 extern const char* RpGrid1d_current_version; 25 extern const char* RpGrid2d_current_version; 26 extern const char* RpMesh3d_current_version; 27 extern const char* RpField_current_version; 28 extern const char* RpCurve_current_version; 29 extern const char* RpElement_current_version; 30 extern const char* RpNode2d_current_version; 31 extern const char* RpNode3d_current_version; 45 32 46 33 #endif -
trunk/src/mesh/serializer.cc
r290 r294 5 5 // 6 6 void 7 Serializer::addObject(RpSerializable* obj)7 RpSerializer::addObject(RpSerializable* obj) 8 8 { 9 9 // add object pointer to object map … … 17 17 // Input: 18 18 // a byte stream of a serialized object 19 // RV- <object-type>-A<numBytes>.....19 // RV-A-<object-type><numBytes>..... 20 20 // 21 21 void 22 Serializer::addObject(const char* buf)22 RpSerializer::addObject(const char* buf) 23 23 { 24 // add object pointer to object map 25 m_objMap[obj->objectName()] = obj; 26 27 // add object entry to reference count table 28 m_refCount[obj->objectName()] = 0; 24 // todo 25 29 26 } 30 27 … … 35 32 // 36 33 void 37 Serializer::deleteObject(const char* name); 34 RpSerializer::deleteObject(const char* name) 38 35 { 39 36 typeObjMap::iterator iter = m_objMap.find(name); … … 42 39 return; 43 40 44 Serializable* obj_ptr = (*iter).second;41 RpSerializable* obj_ptr = (*iter).second; 45 42 46 43 // decrement object's reference count … … 56 53 57 54 void 58 Serializer::deleteObject(Serializable* obj)55 RpSerializer::deleteObject(RpSerializable* obj) 59 56 { 57 const char* name = obj->objectName(); 60 58 typeObjMap::iterator iter = m_objMap.find(name); 59 61 60 if (iter == m_objMap.end()) 62 61 // does not exist 63 62 return; 64 63 65 Serializable* obj_ptr = (*iter).second;64 RpSerializable* obj_ptr = (*iter).second; 66 65 67 66 // decrement object's reference count … … 77 76 78 77 void 79 Serializer::deleteAllObjects()78 RpSerializer::deleteAllObjects() 80 79 { 81 80 typeObjMap::iterator iter; … … 97 96 98 97 // retrieve object 99 Serializable*98 RpSerializable* 100 99 RpSerializer::getObject(const char* objectName) 101 100 { 102 typeObjMap::iterator iter m_objMap.find(objectName);101 typeObjMap::iterator iter = m_objMap.find(objectName); 103 102 104 103 if (iter != m_objMap.end()) { … … 139 138 // call each object to serialize itself 140 139 char* ptr = buf + headerSize; 140 int nb; 141 141 for (iter = m_objMap.begin(); iter != m_objMap.end(); iter++) { 142 Serializable* obj = (*iter).second; 143 obj->serialize(ptr); // object serialization 144 ptr += obj->numBytes(); // advance buffer pointer 142 RpSerializable* obj = (*iter).second; 143 nb = obj->numBytes(); 144 obj->doSerialize(ptr, nb); // object serialization 145 ptr += nb; // advance buffer pointer 145 146 } 146 147 … … 161 162 RpSerializer::deserialize(const char* buf) 162 163 { 163 //164 164 165 } 165 166
Note: See TracChangeset
for help on using the changeset viewer.