sc::StateOut(3)

πŸ“¦
version 2.3.1 Β· 5 versions
, in ubuntu jammy

✨ sc::StateOut(3) ✨

okay so bestie, welcome to the MPQC manual page for sc::StateOut β€” she’s the SavableState serializer, and she’s lowkey iconic. We’re keeping every signature, every attribute, every default, and every β€œthis one returns 0” exactly where it belongs. No cap. πŸ’…


🌸 NAME 🌸

sc::StateOut β€” Serializes objects that derive from SavableState.

πŸ¦‹ SYNOPSIS πŸ¦‹

#include <stateout.h>

Inherits sc::DescribedClass.

Inherited by sc::MsgStateSend, and sc::StateOutFile.

πŸ’– Public Member Functions πŸ’–

  • virtual void put_header () β€” Writes out header information.
  • virtual int putstring (const char *) β€” This is like put, but the length of the char array is determined by interpreting the character array as a character string.
  • virtual int put (const std::string &) β€” Writes out a std::string object.
  • virtual int put (char r) β€” Writes the given datum.
  • virtual int put (unsigned int r) β€” Another datum-writing put, this one for an unsigned int.
  • virtual int put (int r) β€” Same put energy, int edition.
  • virtual int put (bool r) β€” Same put energy, bool edition.
  • virtual int put (unsigned long r) β€” Same put energy, unsigned long edition.
  • virtual int put (float r) β€” Same put energy, float edition.
  • virtual int put (double r) β€” Same put energy, double edition.
  • virtual int put (const char *, int) β€” Writes the given array data.
  • virtual int put (const unsigned int *, int) β€” Writes the given array data as an unsigned int array.
  • virtual int put (const int *, int) β€” Writes the given array data as an int array.
  • virtual int put (const float *, int) β€” Writes the given array data as a float array.
  • virtual int put (const double *, int) β€” Writes the given array data as a double array.
  • virtual int put_array_char (const char *p, int size) β€” Puts arrays of data.
  • virtual int put_array_uint (const unsigned int *p, int size) β€” Another array-putting helper.
  • virtual int put_array_int (const int *p, int size) β€” Another array-putting helper.
  • virtual int put_array_float (const float *p, int size) β€” Another array-putting helper.
  • virtual int put_array_double (const double *p, int size) β€” Another array-putting helper.
  • template<class T > int put (typename std::vector< T > &v) β€” Writes an STL vector of data.
  • void forget_references () β€” Doesn’t keep track of pointers to objects.
  • void copy_references () β€” If a reference to an object that has already been written is encountered, copies it instead of generating a reference to the first object.
  • virtual int use_directory () β€” Returns true if this object uses a directory.
  • virtual void flush () β€” Flushes out any remaining data.
  • int node_to_node () const β€” True if this is a node to node save/restore.
  • virtual int tell () β€” Returns the current position in the file.
  • virtual void seek (int loc) β€” Sets the current position in the file.
  • virtual int seekable () β€” Returns non-zero if tell and seek do anything sensible.

πŸ”’ Protected Member Functions πŸ”’

  • virtual int put_array_void (const void *, int)
  • virtual int putparents (const ClassDesc *)
  • void put_directory ()
  • void have_classdesc ()
  • int need_classdesc ()
  • virtual int putobject (const Ref< SavableState > &) β€” This prepares StateOut to output a pointer to data.
  • virtual int put (const ClassDesc *) β€” Writes out information about the given ClassDesc.

🧚 Protected Attributes 🧚

  • int dir_loc_loc_
  • TranslateDataOut * translate_
  • int copy_references_
  • int next_object_number_
  • std::map< Ref< SavableState >, StateOutData > ps_
  • std::map< ClassDescP, int > classidmap_
  • int nextclassid_
  • int node_to_node_

🫢 Friends 🫢

  • class SavableState
  • class TranslateDataOut

πŸŽ€ Detailed Description πŸŽ€

Serializes objects that derive from SavableState.

StateOut keeps track of pointers to data so that two references to the same piece of data do not result in that data being sent to the output device two times. That’s the whole vibe: no duplicate data, no messy repeats. ✨

πŸ’œ Member Function Documentation πŸ’œ

🌟 void sc::StateOut::copy_references ()

If a reference to an object that has already been written is encountered, it gets copied instead of generating a reference to the first object. The directory will not be updated with new objects. Important little caveat, bestie. πŸ’Œ

🌟 void sc::StateOut::forget_references ()

Don’t keep track of pointers to objects. Calling this causes duplicated references to objects to be copied. The directory will not contain the forgotten objects. So yeah β€” forgetting is a choice with consequences. 😭

🌟 int sc::StateOut::node_to_node () const [inline]

True if this is a node to node save/restore. This is necessary 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. That’s the whole reason it exists. 🫢

🌟 virtual int sc::StateOut::put (const char *, int) [virtual]

Writes the given array data. Size information is also saved. The data is allocated and read by the get(T*&) routines.

Reimplemented in sc::MsgStateSend, and sc::StateOutText.

🌟 virtual int sc::StateOut::put_array_char (const char * p, int size) [virtual]

Puts arrays of data. No size information is stored. This data is read by the get_array_T routines.

Reimplemented in sc::StateOutText.

🌟 virtual int sc::StateOut::putobject (const Ref< SavableState > &) [protected], [virtual]

This prepares StateOut to output a pointer to data. It first checks to see if the data has already been saved. If it has, then a reference to this data is saved. Otherwise the object is written out. Very β€œcheck the group chat before sending the same message twice” of her. πŸ’…

Reimplemented in sc::StateOutText.

🌟 virtual void sc::StateOut::seek (int loc) [virtual]

Sets the current position in the file. The default implementation does nothing. Literally nothing. 🫠

Reimplemented in sc::StateOutBin.

🌟 virtual int sc::StateOut::seekable () [virtual]

Returns non-zero if tell and seek do anything sensible. The default implementation returns 0.

Reimplemented in sc::StateOutBin.

🌟 virtual int sc::StateOut::tell () [virtual]

Returns the current position in the file. The default implementation returns 0.

Reimplemented in sc::StateOutBin.


🌈 Author 🌈

Generated automatically by Doxygen for MPQC from the source code.


Version 2.3.1, dated Sun Oct 4 2020 β€” and that’s the whole sc::StateOut(3) page, bestie. Go serialize something iconic. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from