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

#include <WorldObjectType.hh>

Inheritance diagram for grail::planner::WorldObjectType:
Collaboration diagram for grail::planner::WorldObjectType:

Public Member Functions

 WorldObjectType (MemoryPool *memory)
 
 WorldObjectType (MemoryPool *memory, const std::string &name, const std::vector< std::string > &bases={})
 
 WorldObjectType (const WorldObjectType &other)
 
 WorldObjectType (WorldObjectType &&other)=default
 
WorldObjectTypeoperator= (const WorldObjectType &)=delete
 
WorldObjectTypeoperator= (WorldObjectType &&)=delete
 
bool IsOfType (unsigned int type) const
 
bool IsOfType (const std::string &typeName) const
 
void SetTypeIndex (unsigned int id)
 Sets a unique identification number that represents this type. It can be used, for instance, to compare whether two types are the same.
 
void InheritFromType (const WorldObjectType &type)
 
unsigned int GetTypeIndex () const
 Gets a unique identification number that represents this type. It can be used, for instance, to compare whether two types are the same.
 
const std::string & GetName () const
 
const std::vector< std::string > & GetBaseTypes () const
 
class WorldObject InstantiateObject () const
 Constructs a new WorldObject of this type.
 
- 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

A class that represents the type of "WorldObject" used in planners. It essentially holds a unique ID determining the type, the name and inheritance structure(types and therefore objects can be organized into inheritance structures).

Constructor & Destructor Documentation

◆ WorldObjectType() [1/2]

grail::planner::WorldObjectType::WorldObjectType ( MemoryPool memory)

Constructs a new default WorldObjectType.

Parameters
memory- the MemoryPool object for memory optimization.

◆ WorldObjectType() [2/2]

grail::planner::WorldObjectType::WorldObjectType ( MemoryPool memory,
const std::string &  name,
const std::vector< std::string > &  bases = {} 
)

Constructs a WorldObjectType inheriting from bases with specified names Full WorldObjectType data construction is finished only after it's passed to Domain class

Parameters
memory- the MemoryPool object for memory optimization.
name- the name of the type.
bases- the names of types that are higher along the path up in the inheritance hierarchy.

Member Function Documentation

◆ GetBaseTypes()

const std::vector< std::string > & grail::planner::WorldObjectType::GetBaseTypes ( ) const
Returns
Returns the types that are higher in the inheritance structure, i.e., direct and indirect predecessors.

◆ GetName()

const std::string & grail::planner::WorldObjectType::GetName ( ) const
Returns
Returns the name of the type.

◆ InheritFromType()

void grail::planner::WorldObjectType::InheritFromType ( const WorldObjectType type)

Makes the type represented by the current WorldObjectType inherit from the provided type. In practice, it consists in merging parameters from the provided type and adding it to the base types.

◆ IsOfType() [1/2]

bool grail::planner::WorldObjectType::IsOfType ( const std::string &  typeName) const
Returns
true if at least one of the types of the current WorldObjectType instance has the provided "typeName". It includes the inheritance hierarchy.

◆ IsOfType() [2/2]

bool grail::planner::WorldObjectType::IsOfType ( unsigned int  type) const
Returns
true if at least one of the types of the current WorldObjectType instance is equal to the provided "type". It includes the inheritance hierarchy.

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