NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgCast Class Reference

#include <tgCast.h>

Static Public Member Functions

template<typename T_FROM , typename T_TO >
static std::vector< T_TO * > filter (const std::vector< T_FROM * > &v)
 
template<typename T_FROM , typename T_TO >
static std::vector< const T_TO * > constFilter (const std::vector< T_FROM * > &v)
 
template<typename T_FROM , typename T_TO >
static T_TO * cast (T_FROM *obj)
 
template<typename T_FROM , typename T_TO >
static const T_TO * cast (const T_FROM *obj)
 
template<typename T_FROM , typename T_TO >
static T_TO * cast (T_FROM &obj)
 
template<typename T_FROM , typename T_TO >
static std::vector< T_TO * > find (const tgTagSearch &tagSearch, const std::vector< T_FROM * > haystack)
 

Detailed Description

Utility class for typecasting

Definition at line 38 of file tgCast.h.

Member Function Documentation

template<typename T_FROM , typename T_TO >
static T_TO* tgCast::cast ( T_FROM *  obj)
inlinestatic

Attempt a dynamic cast to the provided type. If it fails, return 0

Definition at line 87 of file tgCast.h.

template<typename T_FROM , typename T_TO >
static const T_TO* tgCast::cast ( const T_FROM *  obj)
inlinestatic

Attempt a dynamic cast to the provided type. If it fails, return 0 This method is designed for const pointers

Definition at line 102 of file tgCast.h.

template<typename T_FROM , typename T_TO >
static T_TO* tgCast::cast ( T_FROM &  obj)
inlinestatic

Attempt a dynamic cast to the provided type. If it fails, return 0

Definition at line 116 of file tgCast.h.

template<typename T_FROM , typename T_TO >
static std::vector<const T_TO*> tgCast::constFilter ( const std::vector< T_FROM * > &  v)
inlinestatic

A version of filter that returns const objects inside the vector Filter by type, e.g. std::vector<SomeBaseType> myVector; tgCast::filter<SomeBaseType, const SomeSubType>(myVector); will return a vector containing only the elements in myVector that are castable to const SomeSubType

Definition at line 71 of file tgCast.h.

template<typename T_FROM , typename T_TO >
static std::vector<T_TO*> tgCast::filter ( const std::vector< T_FROM * > &  v)
inlinestatic

Filter by type, e.g. std::vector<SomeBaseType> myVector; tgCast::filter<SomeBaseType, SomeSubType>(myVector); will return a vector containing only the elements in myVector that are castable to SomeSubType

Definition at line 50 of file tgCast.h.


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