📄 serializerplayerstdv1.cc
字号:
// -*-c++-*-/*************************************************************************** serializerplayerstdv1.cc Class for serializing data to std v1 players ------------------- begin : 27-MAY-2002 copyright : (C) 2002 by The RoboCup Soccer Server Maintenance Group. email : sserver-admin@lists.sourceforge.net ***************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU LGPL as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any * * later version. * * * ***************************************************************************/#include "serializerplayerstdv1.h"#include "param.h"#include "clangmsg.h"static char *PlayModeString[] = PLAYMODE_STRINGS;namespace rcss{ SerializerPlayerStdv1::SerializerPlayerStdv1( const SerializerCommon& common ) : SerializerPlayer( common ) {} SerializerPlayerStdv1::~SerializerPlayerStdv1() {} const SerializerPlayerStdv1* SerializerPlayerStdv1::instance() { SerializerCommon::Creator cre; if( !SerializerCommon::factory().getCreator( cre, 1 ) ) return NULL; static SerializerPlayerStdv1 ser( cre() ); return &ser; } void SerializerPlayerStdv1::serializeRefAudio( std::ostream& strm, const int& time, const char* msg ) const { strm << "(hear " << time << " " << REFEREE_NAME << " " << msg << ")"; } void SerializerPlayerStdv1::serializeCoachAudio( std::ostream& strm, const int& time, const std::string& name, const char* msg ) const { strm << "(hear " << time << " " << name << " " << msg << ")"; } void SerializerPlayerStdv1::serializeCoachStdAudio( std::ostream& strm, const int& time, const std::string& name, const rcss::clang::Msg& msg ) const { strm << "(hear " << time << " " << name << " " << msg << ")"; } void SerializerPlayerStdv1::serializeSelfAudio( std::ostream& strm, const int& time, const char* msg ) const { strm << "(hear " << time << " self " << msg << ")"; } void SerializerPlayerStdv1::serializePlayerAudio( std::ostream& strm, const int& time, const double& dir, const char* msg ) const { strm << "(hear " << time << " " << dir << " " << msg << ")"; } void SerializerPlayerStdv1::serializeVisualBegin( std::ostream& strm, int time ) const { strm << "(see " << time; } void SerializerPlayerStdv1::serializeVisualEnd( std::ostream& strm ) const { strm << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, int dir ) const { strm << " (" << name << " " << dir << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir ) const { strm << " (" << name << " " << dist << " " << dir << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, double dist_chg, double dir_chg ) const { strm << " (" << name << " " << dist << " " << dir << " " << dist_chg << " " << dir_chg << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, double dist_chg, double dir_chg, double body_dir ) const { strm << " (" << name << " " << dist << " " << dir << " " << dist_chg << " " << dir_chg << " " << body_dir << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, double dist_chg, double dir_chg, double body_dir, double head_dir ) const { strm << " (" << name << " " << dist << " " << dir << " " << dist_chg << " " << dir_chg << " " << body_dir << " " << head_dir << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, bool tackling ) const { strm << " (" << name << " " << dist << " " << dir; if( tackling ) strm << " t"; strm << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, int point_dir, bool tackling ) const { strm << " (" << name << " " << dist << " " << dir << " " << point_dir; if( tackling ) strm << " t"; strm << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, double dist_chg, double dir_chg, int body_dir, int head_dir, bool tackling ) const { strm << " (" << name << " " << dist << " " << dir << " " << dist_chg << " " << dir_chg << " " << body_dir << " " << head_dir; if( tackling ) strm << " t"; strm << ")"; } void SerializerPlayerStdv1::serializeVisualObject( std::ostream& strm, const char* name, double dist, int dir, double dist_chg, double dir_chg, int body_dir, int head_dir, int point_dir, bool tackling ) const { strm << " (" << name << " " << dist << " " << dir << " " << dist_chg << " " << dir_chg << " " << body_dir << " " << head_dir << " " << point_dir; if( tackling ) strm << " t"; strm << ")"; } void SerializerPlayerStdv1::serializeBodyBegin( std::ostream& strm, int time ) const { strm << "(sense_body " << time; } void SerializerPlayerStdv1::serializeBodyEnd( std::ostream& strm ) const { strm << ")"; } void SerializerPlayerStdv1::serializeBodyViewMode( std::ostream& strm, const char* qual, const char* width ) const { strm << " (view_mode " << qual << " " << width << ")"; } void SerializerPlayerStdv1::serializeBodyStamina( std::ostream& strm, double stamina, double effort ) const { strm << " (stamina " << stamina << " " << effort << ")"; } void SerializerPlayerStdv1::serializeBodyVelocity( std::ostream& strm,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -