WFMath 1.0.2
zero.h
1// The WorldForge Project
2// Copyright (C) 2009 The WorldForge Project
3//
4// Author: Erik Hjortsberg <erik@worlforge.org, (C) 2009
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with this program; if not, write to the Free Software
18// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19//
20// For information about WorldForge and its authors, please contact
21// the Worldforge Web Site at http://www.worldforge.org.
22
23#ifndef WFMATH_ZERO_H
24#define WFMATH_ZERO_H
25
26namespace WFMath {
27
33template<typename Shape>
35{
36public:
42ZeroPrimitive(int dim) : m_shape()
43{
44 for (int i = 0; i < dim; ++i) {
45 m_shape.m_elem[i] = 0;
46 }
47 m_shape.m_valid = true;
48}
49
53const Shape& getShape() const
54{
55 return m_shape;
56}
57
58private:
62Shape m_shape;
63};
64}
65
66#endif //WFMATH_ZERO_H
A fake class which documents the generic parts of the WFMath interface.
Definition shape.h:57
Utility class for providing zero primitives. This class will only work with simple structures such as...
Definition zero.h:35
const Shape & getShape() const
Gets the zeroed shape.
Definition zero.h:53
ZeroPrimitive(int dim)
Ctor. An instance of Shape with zero values will be created at construction time.
Definition zero.h:42
Generic library namespace.
Definition atlasconv.h:45