summaryrefslogtreecommitdiffhomepage
path: root/Tobii-EyeX/include/eyex-cpp/InteractionEvent.inl
blob: b650bef51746e35d6f1ea1bee50f4ec8ff8c0e89 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*********************************************************************************************************************
 * Copyright 2013-2014 Tobii Technology AB. All rights reserved.
 * InteractionEvent.inl
 *********************************************************************************************************************/

#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__)
#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__

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

TX_NAMESPACE_BEGIN

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

inline InteractionEvent::InteractionEvent(const std::shared_ptr<const Context>& spContext, TX_HANDLE hEvent)
: InteractionObject(spContext, hEvent)
{}

/*********************************************************************************************************************/
	   
inline std::string InteractionEvent::GetInteractorId() const        
{	
    return GetString(txGetEventInteractorId, _hObject);
}

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

inline std::vector<std::shared_ptr<Behavior>> InteractionEvent::GetBehaviors() const
{	   
	std::vector<Tx::Utils::ScopedHandle> behaviorHandles;
    TX_VALIDATE(Tx::Utils::GetBufferData(behaviorHandles, txGetEventBehaviors, _hObject));
	
    std::vector<std::shared_ptr<Behavior>> behaviors;
	for(auto& hBehavior : behaviorHandles)
	{
		auto spBehavior = _spContext->CreateObject<Behavior>(hBehavior);
		behaviors.push_back(spBehavior);
	}

	return behaviors;
}

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

inline bool InteractionEvent::TryGetBehavior(std::shared_ptr<Behavior>* pspBehavior, TX_BEHAVIORTYPE behaviorType) const
{
	Tx::Utils::ScopedHandle hBehavior;
	if(!TX_VALIDATE(txGetEventBehavior(_hObject, &hBehavior, behaviorType), TX_RESULT_NOTFOUND))
		return false;

	*pspBehavior = _spContext->CreateObject<Behavior>(hBehavior);
	return true;
}

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

TX_NAMESPACE_END

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

#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__)

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