ost::BaseObject(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

✨ ost::BaseObject ✨ β€” from the ost library, section 3 of the Library Functions Manual 🫢

okay bestie, sit down, hydrate, and let me tell you about the literal blueprint of persistence πŸ’…


🌸 NAME 🌸

ost::BaseObject β€” it's giving… BaseObject. that's the whole name. iconic of it honestly πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <persist.h>

πŸ’œ Public Member Functions πŸ’œ

  • BaseObject () β€” the constructor that gets called when you're doing serialisation stuff. it's the one CreateNewInstance rings up so it has an instance to call Read() on. very "let me create you so I can fill you in" energy.
  • virtual ~BaseObject () β€” default destructor. nothing dramatic, just a clean exit. she leaves the group chat politely 😌
  • virtual const char * getPersistenceID () const β€” hands you back the ID of the persistent object, aka its type. like a little name tag at the party 🏷️
  • virtual bool write (Engine &archive) const β€” writes out to a Persistence::Engine. ⚠️ NOT the same as the << operator, because it only writes the data, not the object type or any of that extra garnish. data only, no seasoning πŸ§‚
  • virtual bool read (Engine &archive) β€” reads in from a Persistence::Engine. ⚠️ NOT the same as the >> operator either, because it does zero typesafety, not even a little bit. it trusts you completely. no cap 😭

πŸ¦‹ DETAILED DESCRIPTION πŸ¦‹

BaseObject. she's the base of it all, fr fr.

this object is the base for all persistent data that isn't natively serialised by the Persistence::Engine. the ones the engine can't handle on its own? they come to her. she's the mother of the misfits πŸ’–

she registers herself with the Persistence::TypeManager using a global constructor function. and then β€” plot twist β€” a matching deregister call happens in a global destructor. why? so that DLL's can use the Persistence::Engine inside a main executable. teamwork, babe 🀝

important warning, bestie, listen up: persistable objects must never maintain bad pointers. if a pointer doesn't point to something valid, it must be NULL. this is non-negotiable. it's how the persistence engine knows whether it should allocate memory for an object or whether the memory was already pre-allocated. bad pointer = chaos = we don't do that here πŸ’€

πŸ‘‘ Author πŸ‘‘

  • Daniel Silverstone

Base class for classes that will be persistent. that's her whole job description and she does it flawlessly ✨


🌈 Constructor & Destructor Documentation 🌈

πŸ“ ost::BaseObject::BaseObject ()

this constructor is used in serialisation processes. specifically, it's called inside CreateNewInstance in order to create an instance of the class that's about to have Read() called on it. so like… she's born, and immediately gets read to. relatable honestly πŸ™ˆ

πŸ’œ virtual ost::BaseObject::~BaseObject () [virtual]

default destructor. that's it. that's the whole thing. short and sweet, a queen of brevity πŸŽ€


⭐ Member Function Documentation ⭐

🌸 virtual const char* ost::BaseObject::getPersistenceID () const [virtual]

this returns the ID of the persistent object β€” which is its type. your object's government name, essentially πŸ’…

πŸ’– virtual bool ost::BaseObject::read (Engine & archive) [virtual]

this method is used to read from a Persistence::Engine. and NO, it is not equivalent to the >> operator, because it does no typesafety or anything. it does not check. it does not verify. it simply reads. wild behavior, but okay πŸ‘€

🧚 virtual bool ost::BaseObject::write (Engine & archive) const [virtual]

this method is used to write to the Persistence::Engine. and NO again β€” it is not equivalent to the << operator, because it writes only the data and not the object type etc. just the data. the bare necessities. minimalism slay 🌿


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for GNU CommonC++ from the source code.


and that's the whole page, bestie!! you understood all of it, I know you did πŸ’…βœ¨ this was ost::BaseObject(3), from GNU CommonC++, dated Sun Dec 27 2020 β€” mwah, go forth and persist responsibly πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from