Changeset 294 for trunk/src


Ignore:
Timestamp:
Mar 7, 2006, 9:00:14 PM (18 years ago)
Author:
cxsong
Message:

reorg'ed files so consts not multiply defined.

Location:
trunk/src/mesh
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mesh/Makefile

    r289 r294  
    9494                  # RpValueDouble.o RpValueString.o
    9595RP_MESH_DEPS =  grid1d.o grid1d_reg.o grid2d.o node3d.o node2d.o \
    96                 element.o mesh.o serializer.o util.o \
    97                 #field.o
     96                element.o mesh.o serializable.o serializer.o util.o \
     97                const.o #field.o
    9898
    9999LDLIB_MACOSX = -dynamiclib -o $(LIB_DIR)/$@.dylib
     
    188188util.o: util.cc
    189189        $(CXX) $(CFLAGS) $(DEBUG) -c $?
     190const.o: const.cc
     191        $(CXX) $(CFLAGS) $(DEBUG) -c $?
    190192node2d.o: node2d.cc
    191193        $(CXX) $(CFLAGS) $(DEBUG) -c $?
     
    196198mesh.o: mesh.cc
    197199        $(CXX) $(CFLAGS) $(DEBUG) -c $?
    198 #serializable.o: serializable.cc
    199 #       $(CXX) $(CFLAGS) $(DEBUG) -c $?
     200serializable.o: serializable.cc
     201        $(CXX) $(CFLAGS) $(DEBUG) -c $?
    200202serializer.o: serializer.cc
    201203        $(CXX) $(CFLAGS) $(DEBUG) -c $?
  • trunk/src/mesh/grid1d.cc

    r293 r294  
    111111        char * ptr = buf;
    112112
    113         writeHeader(ptr, Grid1d_current_version, nbytes);
     113        writeHeader(ptr, RpGrid1d_current_version, nbytes);
    114114        ptr += HEADER_SIZE + sizeof(int);
    115115       
     
    140140        ptr += HEADER_SIZE and sizeof(int);
    141141       
    142         if (header ==  Grid1d_current_version)
     142        if (header == RpGrid1d_current_version)
    143143                return doDeserialize(ptr);
    144144
  • trunk/src/mesh/rp_types.h

    r282 r294  
    1818};
    1919
    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 };
     20extern const char* RpObjectTypes[];
    3421
    35 const int HEADER_SIZE = 16;
     22extern const int HEADER_SIZE;
    3623
    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";
     24extern const char* RpGrid1d_current_version;
     25extern const char* RpGrid2d_current_version;
     26extern const char* RpMesh3d_current_version;
     27extern const char* RpField_current_version;
     28extern const char* RpCurve_current_version;
     29extern const char* RpElement_current_version;
     30extern const char* RpNode2d_current_version;
     31extern const char* RpNode3d_current_version;
    4532
    4633#endif
  • trunk/src/mesh/serializer.cc

    r290 r294  
    55//
    66void
    7 Serializer::addObject(RpSerializable* obj)
     7RpSerializer::addObject(RpSerializable* obj)
    88{
    99        // add object pointer to object map
     
    1717// Input:
    1818//      a byte stream of a serialized object
    19 //              RV-<object-type>-A<numBytes>.....
     19//              RV-A-<object-type><numBytes>.....
    2020//
    2121void
    22 Serializer::addObject(const char* buf)
     22RpSerializer::addObject(const char* buf)
    2323{
    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       
    2926}
    3027
     
    3532//
    3633void
    37 Serializer::deleteObject(const char* name);
     34RpSerializer::deleteObject(const char* name)
    3835{
    3936        typeObjMap::iterator iter = m_objMap.find(name);
     
    4239                return;
    4340
    44         Serializable* obj_ptr = (*iter).second;
     41        RpSerializable* obj_ptr = (*iter).second;
    4542
    4643        // decrement object's reference count
     
    5653
    5754void
    58 Serializer::deleteObject(Serializable* obj)
     55RpSerializer::deleteObject(RpSerializable* obj)
    5956{
     57        const char* name = obj->objectName();
    6058        typeObjMap::iterator iter = m_objMap.find(name);
     59
    6160        if (iter == m_objMap.end())
    6261                // does not exist
    6362                return;
    6463
    65         Serializable* obj_ptr = (*iter).second;
     64        RpSerializable* obj_ptr = (*iter).second;
    6665
    6766        // decrement object's reference count
     
    7776
    7877void
    79 Serializer::deleteAllObjects()
     78RpSerializer::deleteAllObjects()
    8079{
    8180        typeObjMap::iterator iter;
     
    9796
    9897// retrieve object
    99 Serializable*
     98RpSerializable*
    10099RpSerializer::getObject(const char* objectName)
    101100{
    102         typeObjMap::iterator iter m_objMap.find(objectName);
     101        typeObjMap::iterator iter = m_objMap.find(objectName);
    103102       
    104103        if (iter != m_objMap.end()) {
     
    139138        // call each object to serialize itself
    140139        char* ptr = buf + headerSize;
     140        int nb;
    141141        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
    145146        }
    146147
     
    161162RpSerializer::deserialize(const char* buf)
    162163{
    163         //
     164       
    164165}
    165166
Note: See TracChangeset for help on using the changeset viewer.