CARLA
载入中...
搜索中...
未找到
Unreal
CarlaUE4
Plugins
Carla
Source
Carla
Recorder
CarlaRecorderAnimWalker.cpp
浏览该文件的文档.
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
#include "
CarlaRecorder.h
"
8
#include "
CarlaRecorderAnimWalker.h
"
9
#include "
CarlaRecorderHelpers.h
"
10
11
void
CarlaRecorderAnimWalker::Write
(std::ostream &OutFile)
12
{
13
// database id
14
WriteValue<uint32_t>(OutFile, this->
DatabaseId
);
15
WriteValue<float>(OutFile, this->Speed);
16
}
17
void
CarlaRecorderAnimWalker::Read
(std::istream &InFile)
18
{
19
// database id
20
ReadValue<uint32_t>(InFile, this->
DatabaseId
);
21
ReadValue<float>(InFile, this->Speed);
22
}
23
24
// ---------------------------------------------
25
26
void
CarlaRecorderAnimWalkers::Clear
(
void
)
27
{
28
Walkers
.clear();
29
}
30
31
void
CarlaRecorderAnimWalkers::Add
(
const
CarlaRecorderAnimWalker
&Walker)
32
{
33
Walkers
.push_back(Walker);
34
}
35
36
void
CarlaRecorderAnimWalkers::Write
(std::ostream &OutFile)
37
{
38
// write the packet id
39
WriteValue<char>(OutFile,
static_cast<
char
>
(
CarlaRecorderPacketId::AnimWalker
));
40
41
// write the packet size
42
uint32_t Total = 2 +
Walkers
.size() *
sizeof
(
CarlaRecorderAnimWalker
);
43
WriteValue<uint32_t>(OutFile, Total);
44
45
// write total records
46
Total =
Walkers
.size();
47
WriteValue<uint16_t>(OutFile, Total);
48
49
// write records
50
if
(Total > 0)
51
{
52
OutFile.write(
reinterpret_cast<
const
char
*
>
(
Walkers
.data()),
53
Walkers
.size() *
sizeof
(
CarlaRecorderAnimWalker
));
54
}
55
}
56
57
void
CarlaRecorderAnimWalkers::Read
(std::istream &InFile)
58
{
59
uint16_t i, Total;
60
CarlaRecorderAnimWalker
Walker;
61
62
// read Total walkers
63
ReadValue<uint16_t>(InFile, Total);
64
for
(i = 0; i < Total; ++i)
65
{
66
Walker.
Read
(InFile);
67
Add
(Walker);
68
}
69
}
70
71
const
std::vector<CarlaRecorderAnimWalker>&
CarlaRecorderAnimWalkers::GetWalkers
()
72
{
73
return
Walkers
;
74
}
CarlaRecorderAnimWalker.h
CarlaRecorderHelpers.h
CarlaRecorder.h
CarlaRecorderPacketId::AnimWalker
@ AnimWalker
CarlaRecorderAnimWalkers::Add
void Add(const CarlaRecorderAnimWalker &InObj)
Definition
CarlaRecorderAnimWalker.cpp:31
CarlaRecorderAnimWalkers::Read
void Read(std::istream &InFile)
Definition
CarlaRecorderAnimWalker.cpp:57
CarlaRecorderAnimWalkers::Write
void Write(std::ostream &OutFile)
Definition
CarlaRecorderAnimWalker.cpp:36
CarlaRecorderAnimWalkers::Clear
void Clear(void)
Definition
CarlaRecorderAnimWalker.cpp:26
CarlaRecorderAnimWalkers::Walkers
std::vector< CarlaRecorderAnimWalker > Walkers
Definition
CarlaRecorderAnimWalker.h:41
CarlaRecorderAnimWalkers::GetWalkers
const std::vector< CarlaRecorderAnimWalker > & GetWalkers()
Definition
CarlaRecorderAnimWalker.cpp:71
CarlaRecorderAnimWalker
Definition
CarlaRecorderAnimWalker.h:14
CarlaRecorderAnimWalker::Write
void Write(std::ostream &OutFile)
Definition
CarlaRecorderAnimWalker.cpp:11
CarlaRecorderAnimWalker::DatabaseId
uint32_t DatabaseId
Definition
CarlaRecorderAnimWalker.h:15
CarlaRecorderAnimWalker::Read
void Read(std::istream &InFile)
Definition
CarlaRecorderAnimWalker.cpp:17
制作者
1.10.0