⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clangmsg.cpp

📁 2009 ROBOCUP 仿真2DSERVER 源码
💻 CPP
字号:
// -*-c++-*-/***************************************************************************                                 clangmsg.cc                    Abstract base class for CLang messages                             -------------------    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 "clangmsg.h"namespace rcss {namespace clang {Msg::Msg()    : M_time_recv( -1 ),      M_min_ver( (unsigned int)-1 ),      M_max_ver( 0 ),      M_time_send( -1 ),      M_side( 0 ){}Msg::Msg( const int& time_recv )    : M_time_recv( time_recv ),      M_min_ver( (unsigned int)-1 ),      M_max_ver( 0 ),      M_time_send( -1 ),      M_side( 0 ){}Msg::~Msg(){}voidMsg::setVer( const unsigned int min,             const unsigned int max ){    if( min == max )    {        // Then the version is restriced to min/max        if ( min < M_max_ver )        {            M_min_ver = min;        }        else if ( min > M_min_ver )        {            M_max_ver = min;        }        else if ( M_max_ver < M_min_ver )        {            M_min_ver = M_max_ver = min;        }    }    else    {        if ( min < M_min_ver )        {            M_min_ver = min;        }        if ( max > M_max_ver )        {            M_max_ver = max;        }        if ( min > max             && M_max_ver < M_min_ver             && min > M_max_ver             && max < M_min_ver )        {            M_min_ver = min;            M_max_ver = max;        }    }}unsigned intMsg::getMinVer() const{    return M_min_ver;}unsigned intMsg::getMaxVer() const{    return M_max_ver;}boolMsg::isSupported( const unsigned int min,                  const unsigned int max ) const{    // ino this could be just one big return statement, but it's confusing    // enough as it is.    if ( M_min_ver >= M_max_ver )    {        // then the message can be heard by any client that supports        // clang message inbetween and including M_min_ver and M_max_ver        if ( min <= M_max_ver             && max >= M_max_ver )        {            return true;        }        if ( min <= M_min_ver             && max >= M_min_ver )        {            return true;        }    }    else // M_min_ver < M_max_ver    {        // then the message can only be heard by clients that support the        // range M_min_ver to M_max_ver        if ( min <= M_min_ver             && max >= M_max_ver )        {            return true;        }    }    return false;}intMsg::getTimeRecv() const{    return M_time_recv;}voidMsg::setTimeRecv( const int time_recv ){    M_time_recv = time_recv;}intMsg::getTimeSend() const{    return M_time_send;}voidMsg::setTimeSend( const int time_send ){    M_time_send = time_send;}intMsg::getSide() const{    return M_side;}voidMsg::setSide( const int side ){    M_side = side;}}}std::ostream &operator<<( std::ostream & os,            const rcss::clang::Msg & m ){    return m.print( os );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -