LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
util.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_RCG_UTIL_H
33#define RCSC_RCG_UTIL_H
34
35#include <rcsc/rcg/types.h>
36
37namespace rcsc {
38namespace rcg {
39
40/*-------------------------------------------------------------------*/
46int
47nstohi( const Int16 val );
48
49/*-------------------------------------------------------------------*/
56hitons( const int val );
57
58/*-------------------------------------------------------------------*/
64bool
65nstohb( const Int16 val );
66
67/*-------------------------------------------------------------------*/
74hbtons( const bool val );
75
76/*-------------------------------------------------------------------*/
82double
83nstohd( const Int16 val );
84
85/*-------------------------------------------------------------------*/
91float
92nstohf( const Int16 val );
93
94/*-------------------------------------------------------------------*/
100Int16
101hdtons( const double & val );
102
103/*-------------------------------------------------------------------*/
109Int16
110hftons( const float & val );
111
112/*-------------------------------------------------------------------*/
119double
120nltohd( const Int32 & val );
121
122/*-------------------------------------------------------------------*/
129float
130nltohf( const Int32 & val );
131
132/*-------------------------------------------------------------------*/
139Int32
140hdtonl( const double & val );
141
142/*-------------------------------------------------------------------*/
149Int32
150hftonl( const float & val );
151
152/*-------------------------------------------------------------------*/
159Int32
160nstonl( const Int16 val );
161
162/*-------------------------------------------------------------------*/
169Int16
170nltons( const Int32 & val );
171
172
173/*-------------------------------------------------------------------*/
179void
180convert( const pos_t & from,
181 BallT & to );
182
183
184/*-------------------------------------------------------------------*/
190void
191convert( const BallT & from,
192 pos_t & to );
193
194/*-------------------------------------------------------------------*/
200void
201convert( const ball_t & from,
202 BallT & to );
203/*-------------------------------------------------------------------*/
209void
210convert( const BallT & from,
211 ball_t & to );
212
213/*-------------------------------------------------------------------*/
219void
220convert( const pos_t & from,
221 player_t & to );
222
223/*-------------------------------------------------------------------*/
231void
232convert( const SideID side,
233 const int unum,
234 const player_t & from,
235 pos_t & to );
236
237/*-------------------------------------------------------------------*/
243void
244convert( const pos_t & from,
245 PlayerT & to );
246
247/*-------------------------------------------------------------------*/
253void
254convert( const PlayerT & from,
255 player_t & to );
256
257/*-------------------------------------------------------------------*/
263void
264convert( const SideID side,
265 const int unum,
266 const player_t & from,
267 PlayerT & to );
268
269/*-------------------------------------------------------------------*/
276void
277convert( const std::string & name,
278 const int score,
279 team_t & to );
280
281/*-------------------------------------------------------------------*/
287void
288convert( const TeamT & from,
289 team_t & to );
290
291/*-------------------------------------------------------------------*/
297void
298convert( const team_t & from,
299 TeamT & to );
300
301/*-------------------------------------------------------------------*/
307void
308convert( const showinfo_t & from,
309 showinfo_t2 & to );
310
311/*-------------------------------------------------------------------*/
317void
318convert( const showinfo_t & from,
319 short_showinfo_t2 & to );
320
321/*-------------------------------------------------------------------*/
327void
328convert( const showinfo_t2 & from,
329 showinfo_t & to );
330
331/*-------------------------------------------------------------------*/
340void
341convert( const char playmode,
342 const TeamT & team_l,
343 const TeamT & team_r,
344 const short_showinfo_t2 & from,
345 showinfo_t & to );
346
347/*-------------------------------------------------------------------*/
356void
357convert( const char playmode,
358 const TeamT & team_l,
359 const TeamT & team_r,
360 const ShowInfoT & from,
361 showinfo_t & to );
362
363/*-------------------------------------------------------------------*/
369void
370convert( const showinfo_t & from,
371 ShowInfoT & to );
372
373/*-------------------------------------------------------------------*/
382void
383convert( const char playmode,
384 const TeamT & team_l,
385 const TeamT & team_r,
386 const ShowInfoT & from,
387 showinfo_t2 & to );
388
389/*-------------------------------------------------------------------*/
395void
396convert( const showinfo_t2 & from,
397 ShowInfoT & to );
398
399/*-------------------------------------------------------------------*/
405void
406convert( const ShowInfoT & from,
407 short_showinfo_t2 & to );
408
409/*-------------------------------------------------------------------*/
415void
417 ShowInfoT & to );
418
419/*-------------------------------------------------------------------*/
425void convert( const std::string & from,
426 msginfo_t & to );
427
428
429/*-------------------------------------------------------------------*/
435std::string
436to_string( const player_type_t & from );
437
438/*-------------------------------------------------------------------*/
444std::string
446
447/*-------------------------------------------------------------------*/
453std::string
455
456} // end namespace
457} // end namespace
458
459#endif
rcg data format types.
std::int32_t Int32
type of the 32bits integer value
Definition: types.h:50
std::int16_t Int16
type of the 16bits integer value
Definition: types.h:46
generic ball data for display information
Definition: types.h:561
generic player data for display information
Definition: types.h:597
show information
Definition: types.h:1121
team information
Definition: types.h:1017
ball data
Definition: types.h:244
message data
Definition: types.h:165
heterogenious player trade-off parametors
Definition: types.h:484
player data
Definition: types.h:255
player type parameters
Definition: types.h:307
object data
Definition: types.h:132
server parametors
Definition: types.h:341
view data.
Definition: types.h:297
view data of rcssmonitor v2 protocol
Definition: types.h:283
view data of rcssmonitor v1 protocol
Definition: types.h:154
team data
Definition: types.h:145
SideID
side type definition
Definition: types.h:47
Int16 nltons(const Int32 &val)
convert network byte order long value to network byte order short value convert v2 protocol -> v1 pro...
Int32 nstonl(const Int16 val)
convert network byle order short value to network byte order long value v1 protocol -> v2 protocol.
double nstohd(const Int16 val)
convert network byte order short value to floating point number
float nltohf(const Int32 &val)
convert network byte order Int32 value to floating point number for rcsmonitor v2 protocol
Int32 hdtonl(const double &val)
convert a floating point number to the network byte order Int32 value for rcsmonitor v2 protocol
Int16 hftons(const float &val)
convert local floating point value to thnetwork byte order short value
double nltohd(const Int32 &val)
convert network byte order long value to floating point number for rcsmonitor v2 protocol
Int16 hbtons(const bool val)
convert local boolean value -> network byte order short value
int nstohi(const Int16 val)
convert network byte order Int15 value to integer
bool nstohb(const Int16 val)
convert network byte order Int16 value to bool
Int16 hitons(const int val)
convert local integer value to network byte order Int16 value
void convert(const pos_t &from, BallT &to)
convert pos_t to BallT
Int32 hftonl(const float &val)
convert a floating point number to the network byte order Int32 value for rcsmonitor v2 protocol
Int16 hdtons(const double &val)
convert local floating point value to thnetwork byte order short value
std::string to_string(const player_type_t &from)
build server message from old format data
float nstohf(const Int16 val)
convert network byte order short value to floating point number