Drake
Shape Class Reference

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

#include <drake/geometry/shape_specification.h>

Inheritance diagram for Shape:
[legend]

Public Member Functions

virtual ~Shape ()
 
void Reify (ShapeReifier *reifier) 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 ( )
virtual
Shape ( const Shape )
protecteddefault
Shape ( Shape &&  )
protecteddefault
Shape ( ShapeTag< S >  tag)
explicitprotected

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 {
public:
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().

Shape& operator= ( Shape &&  )
protecteddefault
Shape& operator= ( const Shape )
protecteddefault
void Reify ( ShapeReifier reifier) const

Causes this description to be reified in the given reifier.

Each concrete subclass must invoke the single, matching method on the reifier.


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