Shape Class Reference

The base interface for all shape specifications. More...

#include <geometry/shape_specification.h>

Inheritance diagram for Shape:

Public Member Functions

virtual ~Shape ()
void Reify (ShapeReifier *reifier, void *user_data=nullptr) const
 Causes this description to be reified in the given reifier. More...
std::unique_ptr< ShapeClone () const
 Creates a unique copy of this shape. More...

Protected Member Functions

template<typename S >
 Shape (ShapeTag< S > tag)
 Constructor available for derived class construction. More...
Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
 Shape (const Shape &)=default
Shapeoperator= (const Shape &)=default
 Shape (Shape &&)=default
Shapeoperator= (Shape &&)=default

Detailed Description

The base interface for all shape specifications.

It has no public constructor and cannot be instantiated directly. The Shape class has two key properties:

  • it is cloneable, and
  • it can be "reified" (see ShapeReifier).

Constructor & Destructor Documentation

~Shape ( )
Shape ( const Shape )
Shape ( Shape &&  )
Shape ( ShapeTag< S >  tag)

Constructor available for derived class construction.

A derived class should invoke this in its initialization list, passing a ShapeTag instantiated on its derived type, e.g.:

class MyShape final : public Shape {
MyShape() : Shape(ShapeTag<MyShape>()) {}

The base class provides infrastructure for cloning and reification. To work and to maintain sanity, we place the following requirements on derived classes:

  1. they must have a public copy constructor,
  2. they must be marked as final, and
  3. their constructors must invoke the parent constructor with a ShapeTag instance (as noted above), and
  4. The ShapeReifier class must be extended to include an invocation of ShapeReifier::ImplementGeometry() on the derived Shape class.
Template Parameters
SThe derived shape class. It must derive from Shape.

Member Function Documentation

std::unique_ptr< Shape > Clone ( ) const

Creates a unique copy of this shape.

Invokes the protected DoClone().

Here is the caller graph for this function:

Shape& operator= ( Shape &&  )
Shape& operator= ( const Shape )
void Reify ( ShapeReifier reifier,
void *  user_data = nullptr 
) const

Causes this description to be reified in the given reifier.

Each concrete subclass must invoke the single, matching method on the reifier. Provides optional user-data (cast as a void*) for the reifier to consume.

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