Loading...
Searching...
No Matches
by::ttype< T > Class Template Reference

Template type wrapper providing entry point for meta information. More...

#include <ttype.hpp>

Inheritance diagram for by::ttype< T >:
by::ttypeBase< T, tmetaTypeDef< T, tifHasMetaTypeDef< T >::is >::is > by::type

Additional Inherited Members

- Public Member Functions inherited from by::ttypeBase< T, tmetaTypeDef< T, tifHasMetaTypeDef< T >::is >::is >
nbool isTemplate () const override
 
nbool isAbstract () const override
 
voidmake () const override
 
ncnt size () const override
 
const typegetSuper () const override
 
const nboolisInit () const override
 
- Public Member Functions inherited from by::type
virtual nbool operator== (const me &rhs) const
 Checks if two type objects represent the same type.
 
nbool operator!= (const me &rhs) const
 
virtual const std::string & getName () const
 
template<typename T >
TmakeAs () const
 
virtual nbool init ()
 Initializes type metadata and constructs class hierarchy.
 
virtual nbool rel ()
 
const types & getLeafs () const
 Returns all most derived classes (leaf nodes) from this class.
 
const types & getSubs () const
 
const types & getSupers () const
 
virtual nbool isSuper (const type &it) const
 Checks if this type is a super class of the given type.
 
nbool isSuper (const type *it) const BY_SIDE_FUNC(isSuper)
 
template<typename T >
nbool isSuper () const
 
nbool isSub (const type &it) const
 Checks if this type is a sub class of the given type.
 
nbool isSub (const type *it) const BY_SIDE_FUNC(isSub)
 
template<typename T >
nbool isSub () const
 
const typegetStatic () const BY_CONST_FUNC(_getStatic()) virtual const nchar *getMetaTypeName() const
 Get meta type name for efficient type checking.
 
- Static Public Member Functions inherited from by::ttypeBase< T, tmetaTypeDef< T, tifHasMetaTypeDef< T >::is >::is >
static const meget ()
 
- Protected Member Functions inherited from by::ttypeBase< T, tmetaTypeDef< T, tifHasMetaTypeDef< T >::is >::is >
types & _getSupers () override
 
types & _getSubs () override
 
type_getStatic () const override
 
types ** _onGetLeafs () const override
 
void _onAddSubClass (const type &subClass) override
 
const std::string & _getNativeName () const override
 
- Protected Member Functions inherited from by::type
void _setInit (nbool newState)
 
virtual void _onAddSubClass (const me &subClass)
 Hook method called when a new subclass is registered with this type.
 
void _setLeafs (types *newLeafs) const
 

Detailed Description

template<typename T>
class by::ttype< T >

Template type wrapper providing entry point for meta information.

The entry point class for users to access meta information. Always create a new object when using ttype<T>. The entire design uses the monostate pattern, so creating objects each time shares values internally with no additional cost.

To understand the overall design of the meta module, first examine the core type class.

Remarks
Custom meta type injection If a class T defines typedef metaType MyType, then ttype<T> will be based on MyType instead of the default type class. This allows modules depending on meta to inject additional type information. For example, the core module uses this to inject ntype.

Usage

Basic usage pattern:

// Always create new ttype<T> objects
ttype<MyClass> t2; // Shares internal data with t1 via monostate pattern
// Access type information
cout << t1.getName() << "\n";
cout << t1.isAbstract() << "\n";
// Check type relationships
if(t1.isSuper<BaseClass>())
cout << "MyClass derives from BaseClass\n";
Rich logging support with polymorphic type conversion.
Definition richLog.hpp:34

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