Skip to content

Class cse491::CoreObject

ClassList > cse491 > CoreObject

Inherited by the following classes: cse491::Entity, cse491::GridPosition, cse491::PropertyBase, cse491::WorldGrid

Public Functions

Type Name
void Deserialize (std::istream & is)
Restore the state of this object, extracting it from the provided stream.
bool Deserialize (std::string filename)
A version of Deserialize that accepts a filename to read this object from.
std::string GetTypeName () const
Access the derived name for this type.
void Serialize (std::ostream & os) const
Store the current state of this object for later extraction.
bool Serialize (std::string filename) const
A version of Serialize that accepts a filename for saving just this object.
auto operator<=> (const CoreObject &) const
virtual ~CoreObject ()

Protected Functions

Type Name
virtual void Deserialize_impl (std::istream &) = 0
Override to restore the state of this object from the provided stream.
bool EndDeserialize (std::istream & is)
Set up end of the deserialization for this class (does type checking)
void EndSerialize (std::ostream & os) const
Set up end of the serialization for this class (allows checking later)
virtual std::string GetTypeName_impl () const = 0
Override to allow access the derived name for this type.
virtual void Serialize_impl (std::ostream &) const = 0
Override to store the current state of this object for later extraction.
bool StartDeserialize (std::istream & is)
Set up beginning of the deserialization for this class (does type checking)
void StartSerialize (std::ostream & os) const
Set up beginning of the serialization for this class (allows checking later)

Public Functions Documentation

function Deserialize [1/2]

Restore the state of this object, extracting it from the provided stream.

inline void cse491::CoreObject::Deserialize (
    std::istream & is
) 

Parameters:

  • input_stream The istream with full details about this object. This function takes in an istream that was previously written using the paired Serialize() function and restores the associated class. It should stop loading when all data is finished; this may be signalled by the ":::END" directive. The stream should end ready for the next extraction.

function Deserialize [2/2]

A version of Deserialize that accepts a filename to read this object from.

inline bool cse491::CoreObject::Deserialize (
    std::string filename
) 

Parameters:

  • filename The name of the file to open to load this object from.

Returns:

Success (true/false)

function GetTypeName

Access the derived name for this type.

inline std::string cse491::CoreObject::GetTypeName () const

Returns:

A unique typename, ideally the exact name for this class (with scope) This member function will be helpful for serialization and debugging. It should return a fully scoped typename, such as "cse491::WorldGrid".

function Serialize [1/2]

Store the current state of this object for later extraction.

inline void cse491::CoreObject::Serialize (
    std::ostream & os
) const

Parameters:

  • output_stream An ostream that the required information should be stored in. A derived class is required to store all information about itself in Serialize() and clearly note the end of storage to simplify de-serializing the data. This function will automatic add a start line that reads ":::START" followed by the typename, and an end line with ":::END" followed by the typename again.

function Serialize [2/2]

A version of Serialize that accepts a filename for saving just this object.

inline bool cse491::CoreObject::Serialize (
    std::string filename
) const

Parameters:

  • filename The name of the file to create for storing this object.

Returns:

Success (true/false)

function operator<=>

auto cse491::CoreObject::operator<=> (
    const CoreObject &
) const

function ~CoreObject

inline virtual cse491::CoreObject::~CoreObject () 

Protected Functions Documentation

function Deserialize_impl

Override to restore the state of this object from the provided stream.

virtual void cse491::CoreObject::Deserialize_impl (
    std::istream &
) = 0

Parameters:

  • input_stream The istream with full details about this object.

function EndDeserialize

Set up end of the deserialization for this class (does type checking)

inline bool cse491::CoreObject::EndDeserialize (
    std::istream & is
) 

Parameters:

  • is Input stream to deserialize from.

Returns:

success (true/false)

function EndSerialize

Set up end of the serialization for this class (allows checking later)

inline void cse491::CoreObject::EndSerialize (
    std::ostream & os
) const

Parameters:

  • os Output stream to Serialize into.

function GetTypeName_impl

Override to allow access the derived name for this type.

virtual std::string cse491::CoreObject::GetTypeName_impl () const = 0

Returns:

A unique typename, ideally the exact name for this class (with scope) This member function will be helpful for serialization and debugging. It should return a fully scoped typename, such as "cse491::WorldGrid".

function Serialize_impl

Override to store the current state of this object for later extraction.

virtual void cse491::CoreObject::Serialize_impl (
    std::ostream &
) const = 0

Parameters:

  • output_stream An ostream that the required information should be stored in.

function StartDeserialize

Set up beginning of the deserialization for this class (does type checking)

inline bool cse491::CoreObject::StartDeserialize (
    std::istream & is
) 

Parameters:

  • is Input stream to deserialize from.

Returns:

success (true/false)

function StartSerialize

Set up beginning of the serialization for this class (allows checking later)

inline void cse491::CoreObject::StartSerialize (
    std::ostream & os
) const

Parameters:

  • os Output stream to Serialize into.

The documentation for this class was generated from the following file source/core/CoreObject.hpp