WFMath 0.3.11

zero.h

00001 //  The WorldForge Project
00002 //  Copyright (C) 2009  The WorldForge Project
00003 //
00004 //  Author: Erik Hjortsberg <erik@worlforge.org, (C) 2009
00005 //
00006 //  This program is free software; you can redistribute it and/or modify
00007 //  it under the terms of the GNU General Public License as published by
00008 //  the Free Software Foundation; either version 2 of the License, or
00009 //  (at your option) any later version.
00010 //
00011 //  This program is distributed in the hope that it will be useful,
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //  GNU General Public License for more details.
00015 //
00016 //  You should have received a copy of the GNU General Public License
00017 //  along with this program; if not, write to the Free Software
00018 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 //
00020 //  For information about WorldForge and its authors, please contact
00021 //  the Worldforge Web Site at http://www.worldforge.org.
00022 
00023 #ifndef WFMATH_ZERO_H
00024 #define WFMATH_ZERO_H
00025 
00026 namespace WFMath {
00027 
00033 template<typename Shape>
00034 class ZeroPrimitive
00035 {
00036 public:
00042 ZeroPrimitive(int dim)
00043 {
00044   for (int i = 0; i < dim; ++i) {
00045     m_shape.m_elem[i] = 0;
00046   }
00047   m_shape.m_valid = true;
00048 }
00049 
00053 const Shape& getShape() const
00054 {
00055         return m_shape;
00056 }
00057 
00058 private:
00062 Shape m_shape;
00063 };
00064 }
00065 
00066 #endif //WFMATH_ZERO_H