eris 1.4.0
A WorldForge client library.
Eris::TypeService Class Reference

#include <TypeService.h>

Inheritance diagram for Eris::TypeService:
Collaboration diagram for Eris::TypeService:

Public Member Functions

 TypeService (Connection &con)
 
void init ()
 
TypeInfogetTypeByName (const std::string &tynm)
 
TypeInfogetTypeForAtlas (const Atlas::Objects::Root &obj)
 
TypeInfofindTypeByName (const std::string &tynm)
 
void handleOperation (const Atlas::Objects::Operation::RootOperation &)
 
void sendRequest (const std::string &id)
 
void setTypeProviderId (std::string id)
 Set another provider of type data than the connection. More...
 

Public Attributes

sigc::signal< void, TypeInfo * > BoundType
 
sigc::signal< void, TypeInfo * > BadType
 

Protected Member Functions

void recvTypeInfo (const Atlas::Objects::Root &atype)
 
void recvError (const Atlas::Objects::Operation::Get &get)
 
void recvTypeUpdate (const Atlas::Objects::Root &atype)
 
TypeInfodefineBuiltin (const std::string &name, TypeInfo *parent)
 

Protected Attributes

std::unordered_map< std::string, std::unique_ptr< TypeInfo > > m_types
 
Connectionm_con
 
bool m_inited
 
std::string m_type_provider_id
 

Detailed Description

A service class querying and caching types.

Definition at line 23 of file TypeService.h.

Constructor & Destructor Documentation

◆ TypeService()

Eris::TypeService::TypeService ( Connection con)
explicit

Definition at line 29 of file TypeService.cpp.

Member Function Documentation

◆ defineBuiltin()

TypeInfo * Eris::TypeService::defineBuiltin ( const std::string &  name,
TypeInfo parent 
)
protected

Definition at line 197 of file TypeService.cpp.

◆ findTypeByName()

TypeInfo * Eris::TypeService::findTypeByName ( const std::string &  tynm)

Lookup the requested type, by name, and return nullptr if it's unknown.

Definition at line 51 of file TypeService.cpp.

Referenced by Eris::TypeInfo::processTypeData().

◆ getTypeByName()

TypeInfo * Eris::TypeService::getTypeByName ( const std::string &  tynm)

find the TypeInfo for the named type; this may involve a search, or a map lookup. The returned TypeInfo node may not be bound, and the caller should verify this before using the type.

Todo:
Verify the id is not in the authoritative invalid ID list

Definition at line 61 of file TypeService.cpp.

Referenced by Eris::TypeInfo::processTypeData(), and Eris::TypeInfo::resolveChildren().

◆ getTypeForAtlas()

TypeInfo * Eris::TypeService::getTypeForAtlas ( const Atlas::Objects::Root &  obj)

retrive the TypeInfo for an object; this should be faster (hopefully constant time) since it can take advantage of integer typeids

Definition at line 77 of file TypeService.cpp.

◆ handleOperation()

void Eris::TypeService::handleOperation ( const Atlas::Objects::Operation::RootOperation &  )

Definition at line 88 of file TypeService.cpp.

◆ init()

void Eris::TypeService::init ( )

Definition at line 38 of file TypeService.cpp.

◆ recvError()

void Eris::TypeService::recvError ( const Atlas::Objects::Operation::Get &  get)
protected

Definition at line 175 of file TypeService.cpp.

◆ recvTypeInfo()

void Eris::TypeService::recvTypeInfo ( const Atlas::Objects::Root &  atype)
protected

Definition at line 132 of file TypeService.cpp.

◆ recvTypeUpdate()

void Eris::TypeService::recvTypeUpdate ( const Atlas::Objects::Root &  atype)
protected

Definition at line 143 of file TypeService.cpp.

◆ sendRequest()

void Eris::TypeService::sendRequest ( const std::string &  id)

request the information about a type from the server.

Parameters
idThe ID of the type to lookup

Definition at line 155 of file TypeService.cpp.

References Eris::getNewSerialno().

Referenced by Eris::TypeInfo::refresh().

◆ setTypeProviderId()

void Eris::TypeService::setTypeProviderId ( std::string  id)

Set another provider of type data than the connection.

This should be set to the external mind once an entity has been possessed, since the external mind has access to more type data (for example the type of the entity itself).

Parameters
id

Definition at line 213 of file TypeService.cpp.

Referenced by Eris::Avatar::Avatar().

Member Data Documentation

◆ BadType

sigc::signal<void, TypeInfo*> Eris::TypeService::BadType

emitted when a type is confirmed as being undefined

Definition at line 47 of file TypeService.h.

◆ BoundType

sigc::signal<void, TypeInfo*> Eris::TypeService::BoundType

emitted when a new type is available and bound to it's parents

Definition at line 44 of file TypeService.h.

◆ m_con

Connection& Eris::TypeService::m_con
protected

Definition at line 79 of file TypeService.h.

◆ m_inited

bool Eris::TypeService::m_inited
protected

Definition at line 80 of file TypeService.h.

◆ m_type_provider_id

std::string Eris::TypeService::m_type_provider_id
protected

An optional type provider, to which requests for types are sent.

Definition at line 85 of file TypeService.h.

◆ m_types

std::unordered_map<std::string, std::unique_ptr<TypeInfo> > Eris::TypeService::m_types
protected

The easy bit : a simple map from 'string-id' (e.g 'look' or 'farmer') to the corresponding TypeInfo instance. This could be a hash_map in the future, if efficiency considerations indicate it would be worthwhile

Definition at line 77 of file TypeService.h.


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