1,411c1,366
< // Group.cpp: implementation of the Group class.
< //
< ////////////////////////////////////
< 
< #include <iostream>
< //#include <fstream>
< #include <string>
< #include <cstring> // strcpy
< 
< #include "Group.h"
< #include "Serializer.h"
< #include "Transfer.h"
< #include "GroupDef.h"
< #include "AxsDef.h"
< 
< #include "init.h"
< 
< using namespace std;
< using namespace tsb; // timber supply branch namespace
< 
< ////////////////////////////////////
< // Construction/Destruction
< ////////////////////////////////////
< 
< // GROUP struct has built-in index (m_pStruct->id)
< //map<string, int> Group::m_labelIndex = map<string, int>();
< 
< vector<GROUP*> Group::m_structMemoryAddresses = vector<GROUP*>();
< 
< /* inlined
< Group::Group(GROUP* pGroupStruct)
<     : m_pStruct(pGroupStruct)
< {
< }
< */
< 
< Group::~Group()
< {
<     // do nothing yet, but may need to clean up m_pStruct
< }
< 
< // write contents to binary file
< void Group::serialize( Serializer& binaryArchive ) //throw (FileException)
< {
<     if (binaryArchive.isWriting())
<     {
<         // write group index
<         binaryArchive.write( &m_pStruct->id, sizeof(m_pStruct->id) ); // data, size
< 
<         // write group label length & text
<         size_t labelLength = 0;
<         labelLength = strlen( m_pStruct->label ) + 1; // write with terminating null
<         binaryArchive.write( &labelLength, sizeof(labelLength) ); // data, size
<         binaryArchive.write( &(m_pStruct->label), labelLength ); // data, size
< 
<         // write group type
<         binaryArchive.write( &(m_pStruct->grouptype), sizeof(m_pStruct->grouptype) ); // data, size
< 
<         // write group area
<         binaryArchive.write( &(m_pStruct->area), sizeof(m_pStruct->area) ); // data, size
< 
<         // target, inventoryReport, and reportFlags are not serialized (always read from file)
< 
<         // group achieved struct has default values and is
<         // therefore not serialized, but must be re-allocated on read
<     }
<     else // reading archive
<     {
<         /*// allocate space to read in values
<         GROUP tempStruct = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
<         m_pStruct = &tempStruct;*/
< 
<         // read group index
<         int id = 0;
<         binaryArchive.read( &id, sizeof(id) ); // data, size
< 
<         // read group label length & text
<         size_t labelLength = 0; // already includes terminating null
<         binaryArchive.read( &labelLength, sizeof(labelLength) ); // data, size
<         char* label = new char[labelLength];
<         binaryArchive.read( label, labelLength ); // data, size
< 
<         // read group type
<         int grouptype = 0;
<         binaryArchive.read( &(grouptype), sizeof(grouptype) ); // data, size
< 
<         // re-create & insert the C-struct into the hashed FssimApp::m_groupList
<         this->recreateStruct(label, grouptype, id);
<         delete[] label;
<         label = 0;
< 
<         // read group area
<         double area = 0.0;
<         binaryArchive.read( &area, sizeof(area) ); // data, size
< 
<         // set struct with values read before call to init_make_group
<         m_pStruct->area = area;
<         //m_pStruct->grouptype = grouptype; // done by init_make_group
< 
<         // target, inventoryReport, and reportFlags are not serialized (always read from file)
< 
<         // group achieved struct has default values and is
<         // therefore not serialized, but must be re-allocated on read
<     }
<     // priority is not serialized (always read from file)
< 
<     this->serializeAxsList(binaryArchive);
<     this->serializeGroupDefList(binaryArchive);
<     //this->serializeTransferList(binaryArchive);
< }
< 
< 
< void Group::recreateStruct(char* label, int grouptype, int id)
< {
<     /*if (0 != m_pStruct) // clean up memory if overwriting existing struct
<     {
<         init_delete_group(m_pStruct);
<     }*/
<     GROUP* pGroup = init_make_group(label, grouptype, id);
<     if (0 == pGroup)
<     {
<         string message = "ERROR: init_make_group() failed in Group::serialize.\n";
<         throw (message);
<     }
<     else
<     {
<         m_pStruct = pGroup;
<         m_structMemoryAddresses.push_back(m_pStruct);
<     }
< }
< 
< /*int Group::lookupGroupID(const string& label)
< {
<     // lookup AU's index in map by label
<     AConstIndexIterator item = m_labelIndex.find(label);
<     if ( item != m_labelIndex.end() )
<     {
<         return ( (item->second) );
<     }
<     else
<     {
<         throw ("AU not found in labelIndex map");
<     }
< }*/
< 
< // group has custody of its TRANSFERs, called after serialization of group
< void Group::serializeTransferList(Serializer& binaryArchive)
< {
<     if (binaryArchive.isWriting())
<     {
<         if (this->hasTransfers())
<         {
< #ifdef _TSB_SERIALIZER_DEBUG
<             cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->transferlist->size << " TRANSFERs" << endl;
< #endif
<             // write number of group's AxsDefs
<             int numberOfTransfers = m_pStruct->transferlist->size;
<             binaryArchive.write( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
< 
<             m_pStruct->transferlist = (LIST_PTR *)List::reset(m_pStruct->transferlist);
<             TRANSFER* pTRANSFER = 0;
<             do
<             {
<                 pTRANSFER = static_cast<TRANSFER*>(List::next(m_pStruct->transferlist));
<                 if (0 != pTRANSFER)
<                 {
<                     Transfer transferObject(pTRANSFER, this->m_pStruct);
<                     transferObject.serialize(binaryArchive);
<                 }
<             } while (0 != pTRANSFER);
<         }
<         else // no transfers, write a zero
<         {
<             // write number of zone's numberOfAxsDefs
<             int numberOfTransfers = 0;
<             binaryArchive.write( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
<         }
<     }
<     else // we are reading from binary file
<     {
<         if (0 != m_pStruct) // does the GROUP exist?
<         {
<             // read number of group's Transfers
<             int numberOfTransfers = 0;
<             binaryArchive.read( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
< 
<             // populate list of TRANSFERs
<             for( int i = 0; i < numberOfTransfers; ++i )
<             {
<                 // insert into list of AUs
<                 Transfer transferObject(0, this->m_pStruct);
<                 transferObject.serialize(binaryArchive);
<                 // new transfer is added to transferlist by init_make_transfer
<                 //m_pStruct->transferlist =
<                 //        static_cast<LIST_PTR*>(List::insert(m_pStruct->transferlist, transferObject.getStruct(), 0));
<             }
< #ifdef _TSB_SERIALIZER_DEBUG
<             if (this->hasTransfers()) // does the GROUP have AXSs?
<             {
<                 cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->transferlist->size << " TRANSFERs" << endl;
<             }
< #endif
<         }
<     }
< }
< 
< // group has custody of its GROUPDEFs, called after serialization of group
< void Group::serializeGroupDefList(Serializer& binaryArchive)
< {
<     if (binaryArchive.isWriting())
<     {
<         if (this->hasGroupDefs())
<         {
< #ifdef _TSB_SERIALIZER_DEBUG
<             cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->groupdefs->size << " GROUPDEFs" << endl;
< #endif
<             // write number of group's AxsDefs
<             int numberOfGroupDefs = m_pStruct->groupdefs->size;
<             binaryArchive.write( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
< 
<             m_pStruct->groupdefs = (LIST_PTR *)List::reset(m_pStruct->groupdefs);
<             GROUPDEF* pGROUPDEF = 0;
<             do
<             {
<                 pGROUPDEF = static_cast<GROUPDEF*>(List::next(m_pStruct->groupdefs));
<                 if (0 != pGROUPDEF)
<                 {
<                     GroupDef groupDefObject(pGROUPDEF, this->m_pStruct);
<                     groupDefObject.serialize(binaryArchive);
<                 }
<             } while (0 != pGROUPDEF);
<         }
<         else // no groupdefs, write a zero
<         {
<             // write number of zone's numberOfAxsDefs
<             int numberOfGroupDefs = 0;
<             binaryArchive.write( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
<         }
<     }
<     else // we are reading from binary file
<     {
<         if (0 != m_pStruct) // does the GROUP exist?
<         {
<             // read number of group's GroupDefs
<             int numberOfGroupDefs = 0;
<             binaryArchive.read( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
< 
<             // populate list of GROUPDEFs
<             for( int i = 0; i < numberOfGroupDefs; ++i )
<             {
<                 // insert into list of AUs
<                 GroupDef groupDefObject(0, this->m_pStruct);
<                 groupDefObject.serialize(binaryArchive);
<                 // new groupdef is added to groupdeflist by init_make_groupdef
<                 //m_pStruct->groupdefs =
<                 //        static_cast<LIST_PTR*>(List::insert(m_pStruct->groupdefs, groupDefObject.getStruct(), 0));
<             }
< #ifdef _TSB_SERIALIZER_DEBUG
<             if (this->hasGroupDefs()) // does the GROUP have AXSs?
<             {
<                 cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->groupdefs->size << " GROUPDEFs" << endl;
<             }
< #endif
<         }
<     }
< }
< 
< // group has custody of its AXSDEFs, called after serialization of group
< void Group::serializeAxsList(Serializer& binaryArchive)
< {
<     if (binaryArchive.isWriting())
<     {
<         if (this->hasAxsDefs())
<         {
< #ifdef _TSB_SERIALIZER_DEBUG
<             cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->axslist->size << " AXSDEFs" << endl;
< #endif
<             // write number of group's AxsDefs
<             int numberOfAxsDefs = m_pStruct->axslist->size;
<             binaryArchive.write( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
< 
<             m_pStruct->axslist = (LIST_PTR *)List::reset(m_pStruct->axslist);
<             AXSDEF* pAXSDEF = 0;
<             do
<             {
<                 pAXSDEF = static_cast<AXSDEF*>(List::next(m_pStruct->axslist));
<                 if (0 != pAXSDEF)
<                 {
<                     AxsDef axsDefObject(pAXSDEF, 0, this->m_pStruct);
<                     axsDefObject.serialize(binaryArchive);
<                 }
<             } while (0 != pAXSDEF);
<         }
<         else // no axsdefs, write a zero
<         {
<             // write number of zone's numberOfAxsDefs
<             int numberOfAxsDefs = 0;
<             binaryArchive.write( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
<         }
<     }
<     else // we are reading from binary file
<     {
<         if (0 != m_pStruct) // does the GROUP exist?
<         {
<             // read number of group's AxsDefs
<             int numberOfAxsDefs = 0;
<             binaryArchive.read( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
< 
<             // populate list of AXSDEFs
<             for( int i = 0; i < numberOfAxsDefs; ++i )
<             {
<                 // insert into list of AUs
<                 AxsDef axsDefObject(0, 0, this->m_pStruct);
<                 axsDefObject.serialize(binaryArchive);
<                 // new axsdef is added to axslist by init_make_axsdef
<                 //m_pStruct->axslist =
<                 //        static_cast<LIST_PTR*>(List::insert(m_pStruct->axslist, axsDefObject.getStruct(), 0));
<             }
< #ifdef _TSB_SERIALIZER_DEBUG
<             if (this->hasAxsDefs()) // does the GROUP have AXSs?
<             {
<                 cout << "Group " << m_pStruct->id << " has "
<                  << m_pStruct->axslist->size << " AXSDEFs" << endl;
<             }
< #endif
<         }
<     }
< }
< 
< void Group::serializeGroupList(Serializer& binaryArchive)
< {
<     FssimApp* pApp = FssimApp::getApp();
<     if (binaryArchive.isWriting())
<     {
<         // write size of m_groupList
<         int groupListLength = pApp->m_groupList->size;
<         binaryArchive.write( &groupListLength, sizeof(groupListLength) ); // data, size
< #ifdef _TSB_SERIALIZER_DEBUG
<             cout << endl << "Writing " << groupListLength
<                  << " Groups to binary file..." << endl;
< #endif
<         GROUP* pGroup;
<         pApp->m_groupList = static_cast<LIST_PTR*>(List::reset(pApp->m_groupList));
<         do
<         {
<             pGroup = static_cast<GROUP*>(List::next(pApp->m_groupList));
<             if (0 != pGroup)
<             {
<             	Group newGroupObject( pGroup ); // m_groupList is not a hashed list
<             	newGroupObject.serialize(binaryArchive); // serialize group
<             }
<         } while (0 != pGroup);
<     }
<     else // we are reading from binary file
<     {
<         // read size of m_groupList
<         int groupListLength = 0;
<         binaryArchive.read( &groupListLength, sizeof(groupListLength) ); // data, size
< #ifdef _TSB_SERIALIZER_DEBUG
<             cout << endl << "Reading " << groupListLength
<                  << " groups from binary file..." << endl;
< #endif
<         // populate m_groupList
<         for( int i = 0; i < groupListLength; ++i )
<         {
<             Group newGroupObject; // create default Group object
<             try
<             {
<                 newGroupObject.serialize(binaryArchive);
<                 // new group is added to m_groupList by init_make_group
<                 //pApp->m_groupList =
<                 //       static_cast<LIST_PTR*>( List::insert(pApp->m_groupList,
<                 //                                            newGroupObject.getStruct(), 0) );
<             }
<             catch(FileException& e)
<             {
< #ifdef _TSB_SERIALIZER_DEBUG
<                 cout << "File exception: " << e.what() << endl;
< #endif
<                 if (e.isEndOfFile())
<                 {
<                     //endOfFile = true;
<                     break;
<                 }
<                 else
<                 {
<                     throw e;
<                 }
<             }
<             catch(exception& e)
<             {
<                 cout << "Binary read exception: " << e.what() << endl;
<                 throw e;
<             }
<         }
< #ifdef _TSB_SERIALIZER_DEBUG
<         if (0 != pApp->m_groupList) // does the Group list have groups?
<         {
<             cout << "m_groupList " << " has "
<              << groupListLength << " Groups" << endl;
<         }
< #endif
<     }
< }
< 
< 
---
> // Group.cpp: implementation of the Group class.
> 
> #include <iostream>
> #include <string>
> #include <vector>
> 
> #include <cstring> // strcpy
> 
> #include "Group.h"
> 
> #include "Transfer.h"
> #include "GroupDef.h"
> #include "AxsDef.h"
> 
> #include "FileException.h"
> #include "IOException.h"
> 
> #include "init.h"
> 
> using namespace std;
> using namespace tsb; // timber supply branch namespace
> 
> 
> // initialize static member
> vector<GroupStruct*> Group::m_structMemoryAddresses = vector<GroupStruct*>();
> 
> 
> // write contents to binary file
> void Group::serialize( Serializer& binaryArchive ) //throw (FileException)
> {
>     if (binaryArchive.isWriting())
>     {
>         // write group index
>         binaryArchive.write( &m_pStruct->id, sizeof(m_pStruct->id) ); // data, size
> 
>         // write group label length & text
>         size_t labelLength = 0;
>         labelLength = strlen( m_pStruct->label ) + 1; // write with terminating null
>         binaryArchive.write( &labelLength, sizeof(labelLength) ); // data, size
>         binaryArchive.write( &(m_pStruct->label), labelLength ); // data, size
> 
>         // write group type
>         binaryArchive.write( &(m_pStruct->grouptype), sizeof(m_pStruct->grouptype) ); // data, size
> 
>         // write group area
>         binaryArchive.write( &(m_pStruct->area), sizeof(m_pStruct->area) ); // data, size
> 
>         // target, inventoryReport, and reportFlags are not serialized (always read from file)
> 
>         // group achieved struct has default values and is
>         // therefore not serialized, but must be re-allocated on read
>     }
>     else // reading archive
>     {
>         // read group index
>         int id = 0;
>         binaryArchive.read( &id, sizeof(id) ); // data, size
> 
>         // read group label length & text
>         size_t labelLength = 0; // already includes terminating null
>         binaryArchive.read( &labelLength, sizeof(labelLength) ); // data, size
>         char* label = new char[labelLength];
>         binaryArchive.read( label, labelLength ); // data, size
> 
>         // read group type
>         int grouptype = 0;
>         binaryArchive.read( &(grouptype), sizeof(grouptype) ); // data, size
> 
>         // re-create & insert the C-struct into the hashed FssimApp::m_groupList
>         this->recreateStruct(label, grouptype, id);
>         delete[] label;
>         label = 0;
> 
>         // read group area
>         double area = 0.0;
>         binaryArchive.read( &area, sizeof(area) ); // data, size
> 
>         // set struct with values read before call to init_make_group
>         m_pStruct->area = area;
>         //m_pStruct->grouptype = grouptype; // done by init_make_group
> 
>         // target, inventoryReport, and reportFlags are not serialized (always read from file)
> 
>         // group achieved struct has default values and is
>         // therefore not serialized, but must be re-allocated on read
>     }
>     // priority is not serialized (always read from file)
> 
>     this->serializeAxsList(binaryArchive);
>     this->serializeGroupDefList(binaryArchive);
>     //this->serializeTransferList(binaryArchive);
> }
> 
> 
> void Group::recreateStruct(char* label, int grouptype, int id)
> {
>     GroupStruct* pGroup = init_make_group(label, grouptype, id);
>     if (0 == pGroup)
>     {
>         string message = "ERROR: init_make_group() failed in Group::serialize.\n";
>         throw (message);
>     }
>     else
>     {
>         m_pStruct = pGroup;
>         m_structMemoryAddresses.push_back(m_pStruct);
>     }
> }
> 
> /*
> // group has custody of its TRANSFERs, called after serialization of group
> void Group::serializeTransferList(Serializer& binaryArchive)
> {
>     if (binaryArchive.isWriting())
>     {
>         if (this->hasTransfers())
>         {
> #ifdef _TSB_SERIALIZER_DEBUG
>             cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->transferlist.size() << " TRANSFERs" << endl;
> #endif
>             // write number of group's AxsDefs
>             int numberOfTransfers = m_pStruct->transferlist.size();
>             binaryArchive.write( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
> 
>             vector<TransferStruct*>::iterator transferIter = m_pStruct->transferlist.begin();
>             while (transferIter != m_pStruct->transferlist.end())
>             {
>                 if (0 != *transferIter)
>                 {
>                     Transfer transferObject(*transferIter, this->m_pStruct);
>                     transferObject.serialize(binaryArchive);
>                 }
>                 transferIter++;
>             }
>         }
>         else // no transfers, write a zero
>         {
>             // write number of zone's numberOfAxsDefs
>             int numberOfTransfers = 0;
>             binaryArchive.write( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
>         }
>     }
>     else // we are reading from binary file
>     {
>         if (0 != m_pStruct) // does the GroupStruct exist?
>         {
>             // read number of group's Transfers
>             int numberOfTransfers = 0;
>             binaryArchive.read( &numberOfTransfers, sizeof(numberOfTransfers) ); // data, size
> 
>             // populate list of TRANSFERs
>             for( int i = 0; i < numberOfTransfers; ++i )
>             {
>                 // insert into list of AUs
>                 Transfer transferObject(0, this->m_pStruct);
>                 transferObject.serialize(binaryArchive);
>                 // new transfer is added to transferlist by init_make_transfer
>             }
> #ifdef _TSB_SERIALIZER_DEBUG
>             if (this->hasTransfers()) // does the GroupStruct have AXSs?
>             {
>                 cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->transferlist.size() << " TRANSFERs" << endl;
>             }
> #endif
>         }
>     }
> }
> */
> 
> 
> // group has custody of its GROUPDEFs, called after serialization of group
> void Group::serializeGroupDefList(Serializer& binaryArchive)
> {
>     if (binaryArchive.isWriting())
>     {
>         if (this->hasGroupDefs())
>         {
> #ifdef _TSB_SERIALIZER_DEBUG
>             cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->groupdefs.size() << " GROUPDEFs" << endl;
> #endif
>             // write number of group's AxsDefs
>             int numberOfGroupDefs = m_pStruct->groupdefs.size();
>             binaryArchive.write( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
> 
>             vector<GroupDefStruct*>::iterator groupDefIter = m_pStruct->groupdefs.begin();
>             while (groupDefIter != m_pStruct->groupdefs.end())
>             {
>                 if (0 != *groupDefIter)
>                 {
>                     GroupDef groupDefObject(*groupDefIter, this->m_pStruct);
>                     groupDefObject.serialize(binaryArchive);
>                 }
>                 groupDefIter++;
>             }
>         }
>         else // no groupdefs, write a zero
>         {
>             // write number of zone's numberOfAxsDefs
>             int numberOfGroupDefs = 0;
>             binaryArchive.write( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
>         }
>     }
>     else // we are reading from binary file
>     {
>         if (0 != m_pStruct) // does the GroupStruct exist?
>         {
>             // read number of group's GroupDefs
>             int numberOfGroupDefs = 0;
>             binaryArchive.read( &numberOfGroupDefs, sizeof(numberOfGroupDefs) ); // data, size
> 
>             // populate list of GROUPDEFs
>             for( int i = 0; i < numberOfGroupDefs; ++i )
>             {
>                 // insert into list of AUs
>                 GroupDef groupDefObject(0, this->m_pStruct);
>                 groupDefObject.serialize(binaryArchive);
>                 // new groupdef is added to groupdeflist by init_make_groupdef
>             }
> #ifdef _TSB_SERIALIZER_DEBUG
>             if (this->hasGroupDefs()) // does the GroupStruct have AXSs?
>             {
>                 cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->groupdefs.size() << " GROUPDEFs" << endl;
>             }
> #endif
>         }
>     }
> }
> 
> // group has custody of its AXSDEFs, called after serialization of group
> void Group::serializeAxsList(Serializer& binaryArchive)
> {
>     if (binaryArchive.isWriting())
>     {
>         if (this->hasAxsDefs())
>         {
> #ifdef _TSB_SERIALIZER_DEBUG
>             cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->axslist.size() << " AXSDEFs" << endl;
> #endif
>             // write number of group's AxsDefs
>             int numberOfAxsDefs = m_pStruct->axslist.size();
>             binaryArchive.write( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
> 
>             vector<AxsDefStruct*>::iterator axsIter = m_pStruct->axslist.begin();
>             while (axsIter != m_pStruct->axslist.end())
>             {
>                 if (0 != *axsIter)
>                 {
>                     AxsDef axsDefObject(*axsIter, this->m_pStruct);
>                     axsDefObject.serialize(binaryArchive);
>                 }
>                 axsIter++;
>             }
>         }
>         else // no axsdefs, write a zero
>         {
>             // write number of zone's numberOfAxsDefs
>             int numberOfAxsDefs = 0;
>             binaryArchive.write( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
>         }
>     }
>     else // we are reading from binary file
>     {
>         if (0 != m_pStruct) // does the GroupStruct exist?
>         {
>             // read number of group's AxsDefs
>             int numberOfAxsDefs = 0;
>             binaryArchive.read( &numberOfAxsDefs, sizeof(numberOfAxsDefs) ); // data, size
> 
>             // populate list of AXSDEFs
>             for( int i = 0; i < numberOfAxsDefs; ++i )
>             {
>                 // insert into list of AUs
>                 AxsDef axsDefObject(0, this->m_pStruct);
>                 axsDefObject.serialize(binaryArchive);
>                 // new axsdef is added to axslist by init_make_axsdef
>             }
> 
> #ifdef _TSB_SERIALIZER_DEBUG
>             if (this->hasAxsDefs()) // does the GroupStruct have AXSs?
>             {
>                 cout << "Group " << m_pStruct->id << " has "
>                  << m_pStruct->axslist.size() << " AXSDEFs" << endl;
>             }
> #endif
>         }
>     }
> }
> 
> void Group::serializeGroupList(Serializer& binaryArchive)
> {
>     FssimApp* pApp = FssimApp::getApp();
>     if (binaryArchive.isWriting())
>     {
>         // write size of m_groupList
>         int groupListLength = pApp->m_groupList.size();
>         binaryArchive.write( &groupListLength, sizeof(groupListLength) ); // data, size
> #ifdef _TSB_SERIALIZER_DEBUG
>             cout << endl << "Writing " << groupListLength
>                  << " Groups to binary file..." << endl;
> #endif
>         typedef vector<GroupStruct*>::iterator GI;
>         for (GI groupIter = pApp->m_groupList.begin(); //!pApp->m_groupList.empty() &&
>                 groupIter != pApp->m_groupList.end(); ++groupIter)
>         {
>             if (0 != (*groupIter))
>             {
>             	Group newGroupObject( (*groupIter) ); // m_groupList is not a hashed list
>             	newGroupObject.serialize(binaryArchive); // serialize group
>             }
>         }
>     }
>     else // we are reading from binary file
>     {
>         // read size of m_groupList
>         int groupListLength = 0;
>         binaryArchive.read( &groupListLength, sizeof(groupListLength) ); // data, size
> #ifdef _TSB_SERIALIZER_DEBUG
>             cout << endl << "Reading " << groupListLength
>                  << " groups from binary file..." << endl;
> #endif
>         // populate m_groupList
>         for( int i = 0; i < groupListLength; ++i )
>         {
>             Group newGroupObject; // create default Group object
>             try
>             {
>                 newGroupObject.serialize(binaryArchive);
>                 // new group is added to m_groupList by init_make_group
>             }
>             catch(FileException& e)
>             {
> #ifdef _TSB_DEBUG
>                 cerr << "File exception: " << e.what() << endl;
> #endif
>                 if (e.isEndOfFile())
>                 {
>                     //endOfFile = true;
>                     break;
>                 }
>                 else
>                 {
>                     throw e;
>                 }
>             }
>             catch(IOException& e)
>             {
>                 cerr << "Binary read exception: " << e.what() << endl;
>                 throw e;
>             }
>         }
> #ifdef _TSB_SERIALIZER_DEBUG
>         if ( !pApp->m_groupList.empty() ) // does the Group list have groups?
>         {
>             cout << "m_groupList " << " has "
>              << groupListLength << " Groups" << endl;
>         }
> #endif
>     }
> }
> 
> 
