mp_mosaics
Monstrous Mosaics
Point< Dim > Class Template Reference

Represents a point in Dim dimensional space. More...

#include <point.h>

Collaboration diagram for Point< Dim >:
[legend]

Classes

class  MineAction
 
class  MineAction_DoNothingImpl
 

Public Member Functions

 Point ()
 Point constructor. More...
 
 Point (double arr[Dim])
 Point constructor. More...
 
template<typename T >
 Point (T x,...)
 
template<typename T >
 Point (T x0, T x1, T x2)
 
Pointoperator= (const Point &other)
 
double operator[] (int index) const
 Gets the value of the Point object in the given dimension (index). More...
 
double & operator[] (int index)
 Gets the value of the Point object in the given dimension (index). More...
 
bool operator== (const Point< Dim > p) const
 
bool operator!= (const Point< Dim > p) const
 
bool operator< (const Point< Dim > p) const
 Compares whether the given Point is smaller than the current Point. More...
 
bool operator<= (const Point< Dim > p) const
 
bool operator> (const Point< Dim > p) const
 
bool operator>= (const Point< Dim > p) const
 
void set (int index, double val)
 
void print (std::ostream &out=std::cout) const
 
bool isMine () const
 
 Point (double arr[Dim], bool isMine, const MineAction *mineAction)
 

Private Attributes

double vals [Dim]
 
bool isMine_ = false
 
MineAction_DoNothingImpl MineAction_DoNothing
 
const MineActionmineAction_ = &MineAction_DoNothing
 

Detailed Description

template<int Dim>
class Point< Dim >

Represents a point in Dim dimensional space.

Constructor & Destructor Documentation

◆ Point() [1/5]

template<int Dim>
Point< Dim >::Point ( )

Point constructor.

Initializes everything to 0.

◆ Point() [2/5]

template<int Dim>
Point< Dim >::Point ( double  arr[Dim])

Point constructor.

Copy the array of points in

◆ Point() [3/5]

template<int Dim>
template<typename T >
Point< Dim >::Point ( x,
  ... 
)
explicit

◆ Point() [4/5]

template<int Dim>
template<typename T >
Point< Dim >::Point ( x0,
x1,
x2 
)
explicit

◆ Point() [5/5]

template<int Dim>
Point< Dim >::Point ( double  arr[Dim],
bool  isMine,
const MineAction mineAction 
)

Member Function Documentation

◆ isMine()

template<int Dim>
bool Point< Dim >::isMine ( ) const

◆ operator!=()

template<int Dim>
bool Point< Dim >::operator!= ( const Point< Dim >  p) const

◆ operator<()

template<int Dim>
bool Point< Dim >::operator< ( const Point< Dim >  p) const

Compares whether the given Point is smaller than the current Point.

Parameters
pThe other point to compare with.
Returns
A boolean value indicating whether the current Point is smaller than the provided Point p.

◆ operator<=()

template<int Dim>
bool Point< Dim >::operator<= ( const Point< Dim >  p) const

◆ operator=()

template<int Dim>
Point< Dim > & Point< Dim >::operator= ( const Point< Dim > &  other)

◆ operator==()

template<int Dim>
bool Point< Dim >::operator== ( const Point< Dim >  p) const

◆ operator>()

template<int Dim>
bool Point< Dim >::operator> ( const Point< Dim >  p) const

◆ operator>=()

template<int Dim>
bool Point< Dim >::operator>= ( const Point< Dim >  p) const

◆ operator[]() [1/2]

template<int Dim>
double Point< Dim >::operator[] ( int  index) const

Gets the value of the Point object in the given dimension (index).

This function is const so we don't modify Points using this function.

Parameters
indexThe dimension of the Point to grab.
Returns
The value of the Point in the indexth dimension.

◆ operator[]() [2/2]

template<int Dim>
double & Point< Dim >::operator[] ( int  index)

Gets the value of the Point object in the given dimension (index).

This is the non-const version, so it can be used to modify Points like so:

Point<3> a(1, 2, 3);
a[0] = 4; // a is now (4, 2, 3)
Parameters
indexThe dimension of the Point to grab.
Returns
The value of the Point in the indexth dimension, by reference (so that it may be modified).

◆ print()

template<int Dim>
void Point< Dim >::print ( std::ostream out = std::cout) const

◆ set()

template<int Dim>
void Point< Dim >::set ( int  index,
double  val 
)

Member Data Documentation

◆ isMine_

template<int Dim>
bool Point< Dim >::isMine_ = false
private

◆ mineAction_

template<int Dim>
const MineAction* Point< Dim >::mineAction_ = &MineAction_DoNothing
private

◆ MineAction_DoNothing

template<int Dim>
MineAction_DoNothingImpl Point< Dim >::MineAction_DoNothing
private

◆ vals

template<int Dim>
double Point< Dim >::vals[Dim]
private

The documentation for this class was generated from the following files: