Eris  1.4.0
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
Eris::TypeService Class Reference

A service class querying and caching types. More...

#include <TypeService.h>

Inheritance diagram for Eris::TypeService:

Public Member Functions

 TypeService (Connection *con)
 
void init ()
 
TypeInfoPtr getTypeByName (const std::string &tynm)
 find the TypeInfo for the named type; this may involve a search, or a map lookup. More...
 
TypeInfoPtr 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
 
TypeInfoPtr findTypeByName (const std::string &tynm)
 Lookup the requested type, by name, and return NULL if it's unknown. More...
 
void handleOperation (const Atlas::Objects::Operation::RootOperation &)
 
void sendRequest (const std::string &id)
 request the information about a type from the server. More...
 
void setTypeProviderId (std::string id)
 Set another provider of type data than the connection. More...
 

Public Attributes

sigc::signal< void, TypeInfoPtrBoundType
 emitted when a new type is available and bound to it's parents
 
sigc::signal< void, TypeInfoPtrBadType
 emitted when a type is confirmed as being undefined
 

Protected Types

typedef std::unordered_map< std::string, TypeInfoPtrTypeInfoMap
 

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)
 
TypeInfoPtr defineBuiltin (const std::string &name, TypeInfoPtr parent)
 

Protected Attributes

TypeInfoMap m_types
 The easy bit : a simple map from 'string-id' (e.g 'look' or 'farmer') to the corresponding TypeInfo instance. More...
 
Connectionm_con
 
bool m_inited
 
std::string m_type_provider_id
 An optional type provider, to which requests for types are sent.
 

Detailed Description

A service class querying and caching types.

Member Function Documentation

◆ findTypeByName()

TypeInfoPtr Eris::TypeService::findTypeByName ( const std::string &  tynm)

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

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

◆ getTypeByName()

TypeInfoPtr 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

References sendRequest().

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

◆ 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

References BadType, Eris::getNewSerialno(), m_type_provider_id, and Eris::Connection::send().

Referenced by getTypeByName(), getTypeForAtlas(), and 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

References m_type_provider_id.

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

Member Data Documentation

◆ m_types

TypeInfoMap 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


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