Grail (C++)  1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::planner::WorldObject Class Reference

#include <WorldObject.hh>

Inheritance diagram for grail::planner::WorldObject:
Collaboration diagram for grail::planner::WorldObject:

Public Member Functions

 WorldObject (const WorldObjectType &type)
 
 WorldObject (const WorldObject &other)=default
 
 WorldObject (WorldObject &&other)=default
 
bool IsOfType (unsigned int typeId) const
 
bool IsOfType (const std::string &typeName) const
 
void SetObjectIndex (unsigned int id)
 Sets an integer ID that uniquely identifies a specific WorldObject instance.
 
unsigned int GetObjectIndex () const
 Gets an integer ID that uniquely identifies a specific WorldObject instance.
 
std::string GetTypeName () const
 GetTypeName. More...
 
bool operator== (const WorldObject &other) const
 
WorldObjectoperator= (const WorldObject &)=delete
 
WorldObjectoperator= (WorldObject &&other)=delete
 
- Public Member Functions inherited from grail::planner::ParametrizedObject
void MergeParameters (const ParametrizedObject &other)
 MergeParameters - Adds other parameters to the own one, replacing parameter with those of other in case of conflict. More...
 
std::size_t GetParametersSize () const
 
bool Contains (const std::string &paramName) const
 
template<typename ParameterType >
void SetParameter (const std::string &paramName, const ParameterType &paramValue)
 
template<typename ParameterType >
ParameterType GetParameterValue (const std::string &paramName) const
 
bool CollectionContains (const std::string &collectionName, unsigned int objectIndex) const
 
void AddCollection (const std::string &collectionName)
 
std::set< unsigned int > * GetCollection (const std::string &name)
 
const std::set< unsigned int > * GetCollection (const std::string &name) const
 
bool HasEqualParams (const ParametrizedObject &other) const
 
void SetSerializeSnapshotFunction (std::function< void(const ParametrizedObject &object, std::map< std::string, std::string > &nameValues)> function)
 SetSerializeSnapshotFunction - Sets a function serializing a snapshot of parameter values to string. More...
 
ParametrizedObjectoperator= (const ParametrizedObject &other)
 
ParametrizedObjectoperator= (ParametrizedObject &&other)=default
 

Additional Inherited Members

- Protected Member Functions inherited from grail::planner::ParametrizedObject
 ParametrizedObject (MemoryPool *memory)
 
 ParametrizedObject (const ParametrizedObject &other)
 
 ParametrizedObject (ParametrizedObject &&other)=default
 
- Protected Attributes inherited from grail::planner::ParametrizedObject
std::map< std::string, ObjectParameter * > parameters {}
 
std::map< std::string, std::set< unsigned int > > indexCollections {}
 
MemoryPoolmemory
 

Detailed Description

WorldObject is the main building block of the state-action representation used in the Planner model.
It represents some entity in the planning space. It has a unique type (e.g. a 'monster') [with multiple inheritance supported] and any number of parameters (e.g. 'position', 'health'). Hence WorldObject is a specialization of ParametrizedObject
WorldObjects can be subjects to various actions.

Constructor & Destructor Documentation

◆ WorldObject()

grail::planner::WorldObject::WorldObject ( const WorldObjectType type)

Constructs a new WorldObject instance of the provided type.

Parameters
type- the type of World Object. See "WorldObjectType".

Member Function Documentation

◆ GetTypeName()

std::string grail::planner::WorldObject::GetTypeName ( ) const

GetTypeName.

Returns
The name of the type of this World Object

◆ IsOfType() [1/2]

bool grail::planner::WorldObject::IsOfType ( const std::string &  typeName) const

Checks if the type of the WorldObject matches the provided one by name.

Parameters
typeName- the name of the type to check. See also "WorldObjectType".
Returns
true if the object has the same type as the provided one; false otherwise.

◆ IsOfType() [2/2]

bool grail::planner::WorldObject::IsOfType ( unsigned int  typeId) const

Checks if the type of the WorldObject matches the provided one by ID.

Parameters
typeId- a unique ID of the type to check. See also "WorldObjectType".
Returns
true if the object has the same type as the provided one; false otherwise.

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