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

📄 arithop.cc

📁 在LINUX下运行的仿真机器人服务器源代码
💻 CC
字号:
// -*-c++-*-/***************************************************************************                                 arithop.cc                    Flyweight classes representing comparison operators                             -------------------    begin                : 22-MAR-2002    copyright            : (C) 2002 by The RoboCup Soccer Server                            Maintainance 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 "arithop.h"namespace rcss{  namespace util  {    const char* ArithOp::STRINGS[] = { "+", "-", "*", "/" };    ArithOp::ArithOp( const arith_t& arith )      : M_arith( arith )    {}    const char*    ArithOp::getStr() const    {        return STRINGS[ M_arith ];     }    const ArithOp&    ArithOp::instance( const arith_t& arith )    {      // The entire collection of ArithOps is created on the first      // call to ArithOp::instance.  Because the array is a static      // varaible in this function, we can legally return references      // to its elements.  One of the advatages of doing this is      // that the ArithOps will be destroyed automatically.      static ArithOp instances[] = { ArithOp( PLUS ),                                     ArithOp( MINUS ),                                     ArithOp( MULT ),                                     ArithOp( DIV ) };      return instances[ arith ];    }    const ArithOp&    ArithOp::plus()    { return instance( PLUS ); }        const ArithOp&    ArithOp::minus()    { return instance( MINUS ); }        const ArithOp&    ArithOp::mult()    { return instance( MULT ); }        const ArithOp&    ArithOp::div()    { return instance( DIV ); }  }}

⌨️ 快捷键说明

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