Delen via


CArchive::SetStoreParams

Use SetStoreParams when storing a large number of CObject-derived objects in an archive.

void SetStoreParams( 
   UINT nHashSize = 2053, 
   UINT nBlockSize = 128  
);

Parameters

  • nHashSize
    The size of the hash table for interface pointer maps. Should be a prime number.

  • nBlockSize
    Specifies the memory-allocation granularity for extending the parameters. Should be a power of 2 for the best performance.

Remarks

SetStoreParams allows you to set the hash table size and the block size of the map used to identify unique objects during the serialization process.

You must not call SetStoreParams after any objects are stored, or after MapObject or WriteObject is called.

Example

class CMyLargeDocument : public CDocument
{
public:
   virtual void Serialize(CArchive& ar);
};
void CMyLargeDocument::Serialize(CArchive& ar)
{
   if (ar.IsStoring())
      ar.SetStoreParams();  // use large defaults
   else
      ar.SetLoadParams();

   if (ar.IsStoring())
   {
      // code for storing CMyLargeDocument
   }
   else
   {
      // code for loading CMyLargeDocument
   }
}

Requirements

Header: afx.h

See Also

Reference

CArchive Class

Hierarchy Chart

CArchive::SetLoadParams