summaryrefslogtreecommitdiffhomepage
path: root/Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp
blob: d32b83c820bd0769d4d2d185f2bb68ff74ec7e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*********************************************************************************************************************
 * Copyright 2013-2014 Tobii Technology AB. All rights reserved.
 * HandleWrapper.hpp
 *********************************************************************************************************************/

#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__)
#define __TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__

/*********************************************************************************************************************/

TX_NAMESPACE_BEGIN

/*********************************************************************************************************************/

template <typename THandle>
class HandleWrapper :
	public std::enable_shared_from_this<HandleWrapper<THandle>>
{
public:
    HandleWrapper(const std::shared_ptr<const Context>& spContext, THandle hObject);
	virtual ~HandleWrapper();
	
    std::shared_ptr<const Context> GetContext() const;
	THandle GetHandle() const;

protected:
    template <typename THandle1, typename THandle2>
    inline static std::string GetString(TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength = 0);

protected:
	std::shared_ptr<const Context> _spContext;
	THandle _hObject;
};

/*********************************************************************************************************************/

TX_NAMESPACE_END

/*********************************************************************************************************************/


#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__)

/*********************************************************************************************************************/