Base class for runtime type information in byeol language. More...
#include <type.hpp>
Public Member Functions | |
| virtual nbool | operator== (const me &rhs) const |
| nbool | operator!= (const me &rhs) const |
| virtual nbool | isTemplate () const =0 |
| virtual nbool | isAbstract () const =0 |
| virtual const std::string & | getName () const |
| virtual void * | make () const =0 |
| create an instance to be refered this type. More... | |
| template<typename T > | |
| T * | makeAs () const |
| virtual ncnt | size () const =0 |
| virtual nbool | init () |
| virtual nbool | rel () |
| virtual const type & | getSuper () const =0 |
| virtual const nbool & | isInit () const =0 |
| const types & | getLeafs () const |
| returns all most derived class from this class. | |
| const types & | getSubs () const |
| const types & | getSupers () const |
| virtual nbool | isSuper (const type &it) const |
| nbool | isSuper (const type *it) const BY_SIDE_FUNC(isSuper) |
| template<typename T > | |
| nbool | isSuper () const |
| nbool | isSub (const type &it) const |
| nbool | isSub (const type *it) const BY_SIDE_FUNC(isSub) |
| template<typename T > | |
| nbool | isSub () const |
| const type & | getStatic () const BY_CONST_FUNC(_getStatic()) virtual const nchar *getMetaTypeName() const |
| Get meta type name for efficient type checking. More... | |
Protected Member Functions | |
| virtual types & | _getSubs ()=0 |
| virtual types & | _getSupers ()=0 |
| virtual type & | _getStatic () const =0 |
| void | _setInit (nbool newState) |
| virtual void | _onAddSubClass (const me &subClass) |
| virtual types ** | _onGetLeafs () const =0 |
| void | _setLeafs (types *newLeafs) const |
| virtual const std::string & | _getNativeName () const |
Base class for runtime type information in byeol language.
Provides fundamental type metadata and operations. Returns ttype<type> as result of getType() for type introspection.
| const type & by::type::getStatic | ( | ) | const |
Get meta type name for efficient type checking.
This returns metaTypename. metaTypename can be used like 'dynamic_cast<yourType>'. as you may know, c++'s dynamic_cast is slow. because normally compilers tries to loop in order to figure out which type is fit to given your type parameter. 'meta' library, however, uses 'tier' algorithm and it's O(1), so it's faster.
you can use your own metaType to represent more data on type class. for instance, 'core' module uses 'ntype' custom type class. but in that case, when you compare custom type class, you must compare extended data to 'rhs' variable to base type class, 'type'.
so how can you know that 'type' is actually instance of your derived custom type class in 'tier' algorithm? please don't think about 'dynamic_cast'. it'll vanish our effectiveness to use 'tier' algorithm. that's why I make 'getMetaTypeName()' func.
|
pure virtual |
create an instance to be refered this type.
Implemented in by::mgdType, and by::ttypeBase< void, type >.