-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlastmap.cpp
More file actions
44 lines (39 loc) · 1.16 KB
/
lastmap.cpp
File metadata and controls
44 lines (39 loc) · 1.16 KB
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
#include "lastmap.h"
// TODO Doc
LastEvent LastMap::getLastEvent( threadId_t tid )
{
_LastMap_t::iterator it = m_map.find(tid);
pair<LastEvent, Object *> result = this->getLastEventAndObject( tid );
return result.first;
}
// TODO Doc
Object * LastMap::getLastObject( threadId_t tid )
{
_LastMap_t::iterator it = m_map.find(tid);
pair<LastEvent, Object *> result = this->getLastEventAndObject( tid );
return result.second;
}
// TODO Doc
pair<LastEvent, Object *> LastMap::getLastEventAndObject( threadId_t tid )
{
_LastMap_t::iterator it = m_map.find(tid);
if (it != m_map.end()) {
return it->second;
} else {
if (this->m_update_flag) {
return std::make_pair( LastEvent::UPDATE, this->m_last_update.second );
} else {
return std::make_pair( LastEvent::UNKNOWN_EVENT, (Object *) NULL );
}
}
}
// TODO Doc
void LastMap::setLast( threadId_t tid, LastEvent event, Object * obj )
{
if (event == LastEvent::ROOT) {
this->m_map[tid] = std::make_pair( event, obj );
} else {
this->m_last_update = std::make_pair( tid, obj );
this->m_update_flag = true;
}
}