# IRsPersistStream Struct Reference

Inherits IUnknown.

Inherited by CRdBitmap, CRdBitmap, IRsConPersistStream, and IRsPersistDeltaStream.

List of all members.

## Public Member Functions
HRESULT | IsDirty (void)
HRESULT | Load ([in] IStream *pStm,[in] RtObjFileHeaderInfo *pObjFileHeaderInfo)
HRESULT | Save ([in] IStream *pStm,[in] RtBOOL fClearDirty)
HRESULT | GetFileHeaderInfo ([out, retval] RtObjFileHeaderInfo *pHeaderInfo)

## Detailed Description

Purpose of the interface is to allow Node’s data storing/restoring when the system is shutting down/starting. {verbatim} The storing process

1. After the SaveSystem method calling (RpKernel) are enumerated all the Nodes connected to Main Kernel Connector. 2. The BaseNode’s persist stream methods are used to store Node’s connectors together with its connections and data descriptors. 3. Then the BaseNode’s outer is checked for the IRsPersistStream interface. 4. If the interface is present its methods are called as necessary (GetSizeMax() and then Save()).

Restoring

1. The Kernel node is loaded as first, and then all the other Nodes are loaded. 2. First an empty Node is created through the CreateNode method and its Initialize() method is called. 3. The BaseNode is loaded. 4. Then if the outer has implemented IRsPersistStream interface, its Load() method is called. The Base Node is already created and loaded, but the connectors are not working yet. An attempt to use them for connecting purposes fail and an error message will be returned. 5. When all the Nodes are loaded, the connections are restored. {verbatim}

If a Node is connected to Kernel’s CON_KN_SERIALIZE connector, it will be informed about the serialize process more detailed. It is also possible to make a Post Load procedure here.

## Member Function Documentation

HRESULT IRsPersistStream::IsDirty | ( | void |  | ) |

Checks the object for changes since it was last saved.

This method checks whether an object has changed since it was last saved so you can avoid losing information in objects that have not yet been saved. The dirty flag for an object is conditionally cleared in the IRsPersistStream::Save (and Load) methods.

Returns:
  S_OK - The object has changed since it was last saved.

  S_FALSE - The object has not changed since the last save.

HRESULT IRsPersistStream::Load | ( | [in] IStream * | pStm,
|  | [in] RtObjFileHeaderInfo * | pObjFileHeaderInfo |
| ) |  |  |

Initializes an object from the stream where it was previously saved.

On exit, the seek pointer should be left in the same position as it was on exit from Save, immediately past the end of the data.

Parameters:

  | pStm | [in] IStream pointer to the stream from which the object should be loaded.
  | pObjFileHeaderInfo | [in] pointer to object file header structure.

Returns:
  S_OK - The object was successfully loaded.

  E_OUTOFMEMORY - The object was not loaded due to a lack of memory.

  E_FAIL - The object was not loaded due to some reason other than a lack of memory.

HRESULT IRsPersistStream::Save | ( | [in] IStream * | pStm,
|  | [in] RtBOOL | fClearDirty |
| ) |  |  |

Saves an object to the specified stream.

On exit, the seek pointer must be positioned immediately past the object data. The position of the seek pointer is undefined if an error returns.

Parameters:

  | pStm | [in] IStream pointer to the stream into which the object should be saved.
  | fClearDirty | [in] Indicates whether to clear the dirty flag after the save is complete. If TRUE, the flag should be cleared. If FALSE, the flag should be left unchanged.

Returns:
  S_OK - The object was successfully saved to the stream.

  STG_E_CANTSAVE - The object could not save itself to the stream. This error could indicate, for example, that the object contains another object that is not serializable to a stream or that an ISequentialStream::Write call returned STG_E_CANTSAVE.

  STG_E_MEDIUMFULL - The object could not be saved because there is no space left on the storage device.

HRESULT IRsPersistStream::GetFileHeaderInfo | ( | [out, retval] RtObjFileHeaderInfo * | pHeaderInfo | ) |

Returns file header associated with object.

Parameters:

  | pObjFileHeaderInfo | [out,retval] pointer to file header structure associated with object

Returns:
  S_OK - The size was successfully returned.