The definitions associated with these template method declarations are separated into the companion header file PrivateImplementation_Defs.h with the intent that those definitions will be visible only in library-side code where they need to be instantiated. The definition header file is available for end users as part of the SimTK Core installation, but is not automatically included with SimTKcomon.h as this file is.
SimTK Core client-side headers include this declarations file in order to define the various client side Handle classes, but SimTK Core client-side code never includes the definitions; that is done exclusively in private, library-side code.
#include "SimTKcommon/internal/common.h"
#include "SimTKcommon/internal/ExceptionMacros.h"
#include <cassert>
#include <iosfwd>
Go to the source code of this file.
Namespaces | |
namespace | SimTK |
Classes | |
class | PIMPLHandle |
This class provides some infrastructure useful in making SimTK Private Implementation (PIMPL) classes. More... | |
class | PIMPLImplementation |
This class provides some infrastructure useful in creating PIMPL Implementation classes (the ones referred to by Handles). More... | |
Defines | |
#define | SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT) |
#define | SimTK_INSERT_DERIVED_HANDLE_DEFINITIONS(DERIVED, DERIVED_IMPL, PARENT) |
Functions | |
template<class H, class IMPL, bool PTR> | |
std::ostream & | operator<< (std::ostream &o, const PIMPLHandle< H, IMPL, PTR > &h) |
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS | ( | DERIVED, | |||
DERIVED_IMPL, | |||||
PARENT | ) |
Value:
const DERIVED_IMPL& getImpl() const;\ DERIVED_IMPL& updImpl();\ const PARENT& upcast() const;\ PARENT& updUpcast();\ static bool isInstanceOf(const PARENT& p);\ static const DERIVED& downcast(const PARENT& p);\ static DERIVED& updDowncast(PARENT& p);
#define SimTK_INSERT_DERIVED_HANDLE_DEFINITIONS | ( | DERIVED, | |||
DERIVED_IMPL, | |||||
PARENT | ) |
Value:
const DERIVED_IMPL& DERIVED::getImpl() const {\ return dynamic_cast<const DERIVED_IMPL&>(PARENT::getImpl());\ }\ DERIVED_IMPL& DERIVED::updImpl() {\ return dynamic_cast<DERIVED_IMPL&>(PARENT::updImpl());\ }\ const PARENT& DERIVED::upcast() const {\ return static_cast<const PARENT&>(*this);\ }\ PARENT& DERIVED::updUpcast() {\ return static_cast<PARENT&>(*this);\ }\ bool DERIVED::isInstanceOf(const PARENT& p) {\ return dynamic_cast<const DERIVED_IMPL*>(&p.getImpl()) != 0;\ }\ const DERIVED& DERIVED::downcast(const PARENT& p) {\ assert(isInstanceOf(p));\ return static_cast<const DERIVED&>(p);\ }\ DERIVED& DERIVED::updDowncast(PARENT& p) {\ assert(isInstanceOf(p));\ return static_cast<DERIVED&>(p);\ }\