Skip to content

Namespace cse491

Namespace List > cse491

A base class interface for all agent types. More...

Classes

Type Name
class AgentBase
struct CellType
Simple data structure to hold info about a TYPE of cell in the world.
class CoreObject
class Entity
class GridPosition
Represents a position within a 2D grid of cells. This class provides utilities to manage a position in 2D space. The position is stored as floating-point values (to allow for smooth motion through a grid), but is easily converted to size_t for grid-cell identification.
class InterfaceBase
class ItemBase
struct Property <typename T>
struct PropertyBase
class WorldBase
class WorldGrid
A common interface class for core objects that sets up required functionality. This class ensures that objects can be serialized (saved), deserialized (restored) and provides helper functions.
struct is_any_map <typename T>
Type trait to determine if we are working with any type of map.
struct is_any_map< std::map< KEY_T, VALUE_T > > <typename KEY_T, typename VALUE_T>
struct is_any_map< std::unordered_map< KEY_T, VALUE_T > > <typename KEY_T, typename VALUE_T>
struct is_vector <typename T>
Type trait to determine if we are working with a vector.
struct is_vector< std::vector< T > > <typename T>

Public Types

Type Name
enum PropertyType
Common types of properties in network serialization.
enum State
States that an agent can be in.
enum WorldType
Enum for World types in network serialization.
typedef std::map< size_t, std::unique_ptr< AgentBase > > agent_map_t
Maps of agent IDs to agent pointers.
typedef std::map< size_t, std::unique_ptr< ItemBase > > item_map_t
Maps of item IDs to item pointers.
typedef std::vector< CellType > type_options_t
Available CellTypes will be passed around as a vector of options.

Public Static Functions

Type Name
T DeserializeAs (std::istream & is)
Helper function to deserialize and return a specified type.
void DeserializeFunction (std::istream & is, std::function< void(T)> set_fun)
Helper function to deserialize a member variables from a function.
void DeserializeValue (std::istream & is, T & var)
Helper function to deserialize a single member variable.
void DeserializeValue_Map (std::istream &, T &)
void DeserializeValue_Map (std::istream & is, MAP_T & var)
Helper specialty function to deserialize a unordered_map member variable.
void DeserializeValue_Vector (std::istream & is, std::vector< T > & var)
Helper specialty function to deserialize a vector-based member variable.
void SerializeValue (std::ostream & os, const T & var)
Helper function to serialize a single member variable.
void SerializeValue_Map (std::ostream & os, const T & var)
Helper specialty function to serialize a unordered_map member variable.
void SerializeValue_Vector (std::ostream & os, const std::vector< T > & var)
Helper specialty function to serialize a vector-based member variable.

Detailed Description

A simple 2D Grid container.

Tools to simplify serializing classes.

A class to maintain arbitrary data and facilitate its use.

A base class interface for all non-agent item types.

A base class for all player-interface types.

A mechanism of identifying a grid cell, as well as a position within the cell.

A base class for all items or agents that can exist on the grid.

Set of types used throughout the codebase.

This file is part of the Fall 2023, CSE 491 course project.

Note:

Status: ALPHA

Public Types Documentation

enum PropertyType

enum cse491::PropertyType {
    t_double,
    t_int,
    t_char,
    t_string,
    t_position,
    t_bool,
    t_other
};

enum State

enum cse491::State {
    Healthy,
    Taking_Damage,
    Dying,
    Deceased
};

enum WorldType

enum cse491::WorldType {
    w_maze,
    w_second,
    w_generative,
    w_manual
};

typedef agent_map_t

using agent_map_t =  std::map<size_t, std::unique_ptr<AgentBase> >;

typedef item_map_t

using item_map_t =  std::map<size_t, std::unique_ptr<ItemBase> >;

typedef type_options_t

using type_options_t =  std::vector<CellType>;

Public Static Functions Documentation

function DeserializeAs

Helper function to deserialize and return a specified type.

template<typename T typename T>
static T cse491::DeserializeAs (
    std::istream & is
) 

Parameters:

  • os Input stream to write from.

function DeserializeFunction

Helper function to deserialize a member variables from a function.

template<typename T typename T>
static void cse491::DeserializeFunction (
    std::istream & is,
    std::function< void(T)> set_fun
) 

Parameters:

  • os Input stream to write from.
  • var Variable to serialize.

function DeserializeValue

Helper function to deserialize a single member variable.

template<typename T typename T>
static void cse491::DeserializeValue (
    std::istream & is,
    T & var
) 

Parameters:

  • os Input stream to write from.
  • var Variable to deserialize.

function DeserializeValue_Map

template<typename T typename T>
static void cse491::DeserializeValue_Map (
    std::istream &,
    T &
) 

function DeserializeValue_Map

Helper specialty function to deserialize a unordered_map member variable.

template<typename MAP_T typename MAP_T>
static void cse491::DeserializeValue_Map (
    std::istream & is,
    MAP_T & var
) 

Parameters:

  • is Input stream to read from.
  • var Variable to deserialize.

function DeserializeValue_Vector

Helper specialty function to deserialize a vector-based member variable.

template<typename T typename T>
static void cse491::DeserializeValue_Vector (
    std::istream & is,
    std::vector< T > & var
) 

Parameters:

  • os Input stream to read from.
  • var Variable to deserialize.

function SerializeValue

Helper function to serialize a single member variable.

template<typename T typename T>
static void cse491::SerializeValue (
    std::ostream & os,
    const T & var
) 

Parameters:

  • os Output stream to write to.
  • var Variable to serialize.

function SerializeValue_Map

Helper specialty function to serialize a unordered_map member variable.

template<typename T typename T>
static void cse491::SerializeValue_Map (
    std::ostream & os,
    const T & var
) 

Parameters:

  • os Output stream to write to.
  • var Variable to serialize.

function SerializeValue_Vector

Helper specialty function to serialize a vector-based member variable.

template<typename T typename T>
static void cse491::SerializeValue_Vector (
    std::ostream & os,
    const std::vector< T > & var
) 

Parameters:

  • os Output stream to write to.
  • var Variable to serialize.

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