EventAnalysis  1.3.0
WrapperCast.hpp
Go to the documentation of this file.
1 /*
2  * WrapperCast.hpp
3  *
4  * Created on: 04 Dec 2017
5  * Author: Nicola Mori
6  */
7 
8 #ifndef WRAPPERCAST_HPP_
9 #define WRAPPERCAST_HPP_
10 
11 #include "core/InheritsFrom.h"
12 #include "core/ObjectWrapper.h"
13 #include "core/ObserverPtr.h"
14 
15 namespace EA {
16 
32 void *wrapper_cast(ObjectWrapper &wrapper, const std::type_info &typeInfo, bool isConst);
33 
45 template <typename DataType> observer_ptr<DataType> wrapper_cast(ObjectWrapper &wrapper) {
46  return observer_ptr<DataType>((DataType *)(wrapper_cast(wrapper, typeid(DataType), std::is_const<DataType>::value)));
47 }
48 
49 } // namespace EA
50 #endif /* WRAPPERCAST_HPP_ */
IncludeFileExc.h IncludeFileExc class declaration.
Definition: Algorithm.h:21
Generic wrapper class.
Definition: ObjectWrapper.h:28
void * wrapper_cast(ObjectWrapper &wrapper, const std::type_info &typeInfo, bool isConst)
Cast function to extract wrapped pointer from wrapper in a type-safe way.
Definition: WrapperCast.cpp:12