CARLA
Unreal
CarlaUE4
Plugins
Carla
Source
Carla
Recorder
CarlaRecorderCollision.h
Go to the documentation of this file.
1
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <sstream>
10
#include <vector>
11
#include <unordered_set>
12
13
#pragma pack(push, 1)
14
struct
CarlaRecorderCollision
15
{
16
uint32_t
Id
;
17
uint32_t
DatabaseId1
;
18
uint32_t
DatabaseId2
;
19
bool
IsActor1Hero
;
20
bool
IsActor2Hero
;
21
22
void
Read
(std::istream &InFile);
23
void
Write
(std::ostream &OutFile)
const
;
24
// define operator == needed for the 'unordered_set'
25
bool
operator==
(
const
CarlaRecorderCollision
&
Other
)
const
;
26
};
27
#pragma pack(pop)
28
29
// implement the hash function for the unordered_set of collisions
30
namespace
std
31
{
32
template
<>
33
struct
hash<
CarlaRecorderCollision
>
34
{
35
std::size_t
operator()
(
const
CarlaRecorderCollision
& P)
const
noexcept
36
{
37
std::size_t hash = P.DatabaseId1;
38
hash <<= 32;
39
hash += P.DatabaseId2;
40
return
hash;
41
}
42
};
43
}
44
45
class
CarlaRecorderCollisions
{
46
47
public
:
48
void
Add(
const
CarlaRecorderCollision
&
Collision
);
49
void
Clear(
void
);
50
void
Write
(std::ostream &OutFile);
51
52
private
:
53
std::unordered_set<CarlaRecorderCollision>
Collisions
;
54
};
CarlaRecorderCollision::operator==
bool operator==(const CarlaRecorderCollision &Other) const
Definition:
CarlaRecorderCollision.cpp:33
ELightType::Other
CarlaRecorderCollisions::Collisions
std::unordered_set< CarlaRecorderCollision > Collisions
Definition:
CarlaRecorderCollision.h:53
CarlaRecorderCollisions
Definition:
CarlaRecorderCollision.h:45
CarlaRecorderCollision::Id
uint32_t Id
Definition:
CarlaRecorderCollision.h:16
std
Definition:
CarlaRecorderCollision.h:30
std::hash< CarlaRecorderCollision >::operator()
std::size_t operator()(const CarlaRecorderCollision &P) const noexcept
Definition:
CarlaRecorderCollision.h:35
CarlaRecorderCollision::IsActor1Hero
bool IsActor1Hero
Definition:
CarlaRecorderCollision.h:19
CarlaRecorderPacketId::Collision
CarlaRecorderCollision::DatabaseId1
uint32_t DatabaseId1
Definition:
CarlaRecorderCollision.h:17
CarlaRecorderCollision::IsActor2Hero
bool IsActor2Hero
Definition:
CarlaRecorderCollision.h:20
CarlaRecorderCollision::Write
void Write(std::ostream &OutFile) const
Definition:
CarlaRecorderCollision.cpp:22
CarlaRecorderCollision
Definition:
CarlaRecorderCollision.h:14
CarlaRecorderCollision::DatabaseId2
uint32_t DatabaseId2
Definition:
CarlaRecorderCollision.h:18
CarlaRecorderCollision::Read
void Read(std::istream &InFile)
Definition:
CarlaRecorderCollision.cpp:11
Generated by
1.8.13