ot::EventAttributeBase Class Reference
[Core Classes]
The base class of the EventAttribute class.
More...
#include <EventAttributeBase.h>
Inheritance diagram for ot::EventAttributeBase:


Protected Member Functions | |
| virtual OPENTRACKER_API | ~EventAttributeBase () |
| virtual EventAttributeBase & | operator= (const EventAttributeBase &rv)=0 |
| virtual void | serialize (std::ostream &out)=0 |
| virtual void | deserialize (std::istream &in)=0 |
| virtual const std::type_info & | getType () const =0 |
| virtual const std::string & | getGenericTypeName () const =0 |
Static Protected Member Functions | |
| static OPENTRACKER_API EventAttributeBase * | create (const std::string &genericTypeName) |
| static OPENTRACKER_API EventAttributeBase * | create (const std::type_info &typeInfo) |
| static OPENTRACKER_API void | registerType (const std::string &genericTypeName, const std::type_info &typeInfo, CreateFunction create) |
Static Protected Attributes | |
| static OPENTRACKER_API CreatorMap | creators |
| static OPENTRACKER_API Translator | translator |
Friends | |
| class | Event |
| std::istream & | operator>> (std::istream &in, ot::EventAttributeBase &att) |
| std::ostream & | operator<< (std::ostream &out, ot::EventAttributeBase &att) |
Detailed Description
The base class of the EventAttribute class.This class must be provided as a common base class of all template instantiations of the EventAttribute class, so that an Event can store pointers of this class in its attributes map (AttributeMap). This class is purely abstract and provides an interface for serialization, de-serialization, streaming, and accessing type information. The interface is implemented by the templated EventAttribute class.
Moreover, static create functions, a static function for registering types, and some static members realize the concept of creating new EventAttribute objects without knowing anything else but the attribute's generic type name. This functionality is crucial for the de-serialization of events encoded in strings.
- Author:
- Jochen von Spiczak
Definition at line 85 of file EventAttributeBase.h.
Constructor & Destructor Documentation
| ot::EventAttributeBase::~EventAttributeBase | ( | ) | [protected, virtual] |
Virtual destructor.
Must provide empty implementation for creation of RTTI type information.
Definition at line 57 of file EventAttributeBase.cxx.
Member Function Documentation
| EventAttributeBase * ot::EventAttributeBase::create | ( | const std::type_info & | typeInfo | ) | [static, protected] |
Creates an EventAttribute according to typeInfo.
Throws an exception if this type is not known by the system.
- Parameters:
-
typeInfo RTTI type info
- Returns:
- pointer to the newly created attribute
Definition at line 72 of file EventAttributeBase.cxx.
References create(), ot::Translator::getGenericName(), and translator.
| EventAttributeBase * ot::EventAttributeBase::create | ( | const std::string & | genericTypeName | ) | [static, protected] |
Creates an EventAttribute according to genericTypeName.
Throws an exception if this type name is not known by the system.
- Parameters:
-
genericTypeName generic type name
- Returns:
- pointer to the newly created attribute
Definition at line 62 of file EventAttributeBase.cxx.
References creators.
Referenced by ot::Event::addAttribute(), ot::Event::copyAllButStdAttr(), create(), ot::Event::deserialize(), ot::Event::operator=(), and ot::Event::setAttribute().
| virtual void ot::EventAttributeBase::deserialize | ( | std::istream & | in | ) | [protected, pure virtual] |
Abstract function to de-serialize the attribute.
- Parameters:
-
in the input stream
Implemented in ot::EventAttribute< T >.
Referenced by ot::operator>>().
| virtual const std::string& ot::EventAttributeBase::getGenericTypeName | ( | ) | const [protected, pure virtual] |
Abstract function to get generic type name of the attribute's value.
- Returns:
- generic type name
Implemented in ot::EventAttribute< T >.
Referenced by ot::Event::copyAllButStdAttr(), and ot::Event::getAttributeTypeName().
| virtual const std::type_info& ot::EventAttributeBase::getType | ( | ) | const [protected, pure virtual] |
Abstract function to get RTTI type information of the attribute's value.
- Returns:
- RTTI type information
Implemented in ot::EventAttribute< T >.
Referenced by ot::Event::getAttributeType().
| virtual EventAttributeBase& ot::EventAttributeBase::operator= | ( | const EventAttributeBase & | rv | ) | [protected, pure virtual] |
Abstract assignment operator.
- Parameters:
-
rv the right-value, which is the attribute to copy from
- Returns:
- the left value
Implemented in ot::EventAttribute< T >.
| void ot::EventAttributeBase::registerType | ( | const std::string & | genericTypeName, | |
| const std::type_info & | typeInfo, | |||
| CreateFunction | create | |||
| ) | [static, protected] |
Registers a new generic type name.
Type names are arbitrary but must be unique. In this function, the generic type name is matched to the according creator function and the type name is registered in the translator.
- Parameters:
-
genericTypeName the generic type name to be registered (must be unique!) typeInfo RTTI type information of the new type create creator function for attributes of the new type
- Returns:
Definition at line 79 of file EventAttributeBase.cxx.
References creators, ot::Translator::registerTypeName(), and translator.
Referenced by ot::Event::registerGenericTypeName().
| virtual void ot::EventAttributeBase::serialize | ( | std::ostream & | out | ) | [protected, pure virtual] |
Abstract function to serialize the attribute.
- Parameters:
-
out the output stream
Implemented in ot::EventAttribute< T >.
Referenced by ot::operator<<().
Friends And Related Function Documentation
friend class Event [friend] |
| std::ostream& operator<< | ( | std::ostream & | out, | |
| ot::EventAttributeBase & | att | |||
| ) | [friend] |
Output streaming operator.
Streams the attribute into the output stream.
- Parameters:
-
out the output stream att the attribute
- Returns:
- the output stream
Definition at line 93 of file EventAttributeBase.cxx.
| std::istream& operator>> | ( | std::istream & | in, | |
| ot::EventAttributeBase & | att | |||
| ) | [friend] |
Input streaming operator.
Streams the data provided by the input stream into the attribute.
- Parameters:
-
in the input stream att the attribute
- Returns:
- the input stream
Definition at line 86 of file EventAttributeBase.cxx.
Member Data Documentation
CreatorMap ot::EventAttributeBase::creators [static, protected] |
Static map matching generic type names to according creator functions.
- Parameters:
-
@return
Definition at line 152 of file EventAttributeBase.h.
Referenced by create(), and registerType().
Translator ot::EventAttributeBase::translator [static, protected] |
Static Translator to translate compiler dependent RTTI names to generic type names.
Such translations are used to create attributes by RTTI type information.
Definition at line 157 of file EventAttributeBase.h.
Referenced by create(), ot::EventAttribute< T >::EventAttribute(), ot::Event::knowsType(), and registerType().
The documentation for this class was generated from the following files: