# sc::StateIn Class Reference

Restores objects that derive from SavableState. More...

`#include <statein.h>`

Inheritance diagram for sc::StateIn:

List of all members.

## Public Member Functions

virtual void | get_header ()
| Read in the header information.
virtual int | version (const ClassDesc *)
| Returns the version of the ClassDesc in the persistent object or -1 if info on the ClassDesc doesn't exist.
virtual int | getstring (char *&)
| This restores strings saved with StateOut::putstring.
virtual int | get (std::string &)
| This restores a std::string object.
virtual int | get (char &r, const char *keyword=0)
| These restore data saved with StateOut's put. members.
virtual int | get (unsigned int &r, const char *keyword=0)
virtual int | get (int &r, const char *keyword=0)
virtual int | get (bool &r, const char *keyword=0)
virtual int | get (float &r, const char *keyword=0)
virtual int | get (double &r, const char *keyword=0)
virtual int | get (char *&)
| These restore data saved with StateOut's put.
virtual int | get (unsigned int *&)
virtual int | get (int *&)
virtual int | get (float *&)
virtual int | get (double *&)
virtual int | get_array_char (char *p, int size)
| These restore data saved with StateOut's put.
virtual int | get_array_uint (unsigned int *p, int size)
virtual int | get_array_int (int *p, int size)
virtual int | get_array_float (float *p, int size)
virtual int | get_array_double (double *p, int size)
template<class T>
int | get (typename std::vector< T > &v)
| Read an STL vector of data.
int | node_to_node () const
| True if this is a node to node save/restore.
virtual int | use_directory ()
| Returns true of this object uses a directory.
virtual int | tell ()
| Return the current position in the file.
virtual void | seek (int)
| Set the current position in the file.
virtual int | seekable ()
| Return non-zero if seek does anything sensible.
int | has_directory () const
virtual void | list_objects (std::ostream &=ExEnv::out0())
| List all the objects to the stream.
void | set_override (const Ref< KeyVal > &kv)
| Give this StateIn a KeyVal object that is used to override values.
const Ref< KeyVal > & | override () const
| Return the KeyVal used to override values.

## Protected Member Functions

virtual int | get_array_void (void *, int)
int | push_key (const char *key)
void | pop_key (int n)
const char * | key ()
void | get_directory ()
int | directory_location () const
void | find_and_get_directory ()
virtual int | getobject (Ref< SavableState > &)
| This is used to restore an object.
virtual int | dir_getobject (Ref< SavableState > &, const char *name)
| This restores objects that are listed in the directory.
virtual void | haveobject (int, const Ref< SavableState > &)
| When storage has been allocated during object restoration, this routine is called with the object reference number and the pointer to the new storage so getpointer can find the data if it is referenced again.
virtual void | nextobject (int)
| A call to nextobject followed by havepointer(int) is equiv to havepointer(int,void**);.
virtual void | haveobject (const Ref< SavableState > &)
void | have_classdesc ()
int | need_classdesc ()
virtual int | get (const ClassDesc **)
| This restores ClassDesc's.

## Protected Attributes

Ref< KeyVal > | override_
TranslateDataIn * | translate_
std::map< int, StateInData > | ps_
int | expected_object_num_
std::map< ClassDescP, int > | classidmap_
std::map< int, StateClassData > | classdatamap_
int | nextclassid_
int | node_to_node_
int | version_
int | date_
char | userid_ [9]
char | format_

## Friends

class | SavableState
class | TranslateDataIn

## Detailed Description

Restores objects that derive from SavableState.

## Member Function Documentation

virtual int sc::StateIn::getobject | ( | Ref< SavableState > & |  | ) | `[protected, virtual]`

This is used to restore an object.

It is called with the reference to the reference being restored. If the data being restored has previously been restored, then the pointer being restored is set to a reference to the previously restored object.

Reimplemented in sc::StateInText.

virtual void sc::StateIn::haveobject | ( | int | ,
|  | const Ref< SavableState > & |  |
| ) |  |  | `[protected, virtual]`

When storage has been allocated during object restoration, this routine is called with the object reference number and the pointer to the new storage so getpointer can find the data if it is referenced again.

virtual int sc::StateIn::get | ( | const ClassDesc ** |  | ) | `[protected, virtual]`

This restores ClassDesc's.

It will set the pointer to the address of the static ClassDesc for the class which has the same name as the class that had the ClassDesc that was saved by put(const ClassDesc*).

Reimplemented in sc::MsgStateRecv, and sc::StateInText.

virtual void sc::StateIn::get_header | ( |  | ) | `[virtual]`

Read in the header information.

Changes the translation scheme if necessary.

virtual int sc::StateIn::version | ( | const ClassDesc * |  | ) | `[virtual]`

Returns the version of the ClassDesc in the persistent object or -1 if info on the ClassDesc doesn't exist.

Reimplemented in sc::MsgStateRecv.

virtual int sc::StateIn::get | ( | char *& |  | ) | `[virtual]`

These restore data saved with StateOut's put.

members. The data is allocated by StateIn.

Reimplemented in sc::MsgStateRecv, and sc::StateInText.

virtual int sc::StateIn::get_array_char | ( | char * | p,
|  | int | size |
| ) |  |  | `[virtual]`

These restore data saved with StateOut's put.

members. The data must be preallocated by the user.

Reimplemented in sc::StateInText.

int sc::StateIn::node_to_node | ( |  | ) | const`[inline]`

True if this is a node to node save/restore.

This is for classes that try to avoid saving databases to files that can otherwise be read in, but want to avoid reading the database from disk on all nodes.

virtual void sc::StateIn::seek | ( | int |  | ) | `[virtual]`

Set the current position in the file.

The default implementation does nothing.

Reimplemented in sc::BcastStateInBin, and sc::StateInBin.

virtual int sc::StateIn::seekable | ( |  | ) | `[virtual]`

Return non-zero if seek does anything sensible.

The default implementation returns 0.

Reimplemented in sc::BcastStateInBin, and sc::StateInBin.

virtual void sc::StateIn::list_objects | ( | std::ostream & | = `ExEnv::out0()` | ) | `[virtual]`

List all the objects to the stream.

Only StateIn specializations with directories can list objects.

void sc::StateIn::set_override | ( | const Ref< KeyVal > & | kv | ) | `[inline]`

Give this StateIn a KeyVal object that is used to override values.

const Ref<KeyVal>& sc::StateIn::override | ( |  | ) | const`[inline]`

Return the KeyVal used to override values.

The documentation for this class was generated from the following file:

- statein.h