Simbody  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PrivateImplementation.h File Reference

This header provides declarations of the user-visible portion of the PIMPLHandle template classes that are used in the SimTK Core to implement the PIMPL (private implementation) design pattern. More...

#include "SimTKcommon/internal/common.h"
#include "SimTKcommon/internal/ExceptionMacros.h"
#include <cassert>
#include <iosfwd>

Go to the source code of this file.

Classes

class  SimTK::PIMPLHandle< HANDLE, IMPL, PTR >
 This class provides some infrastructure useful in making SimTK Private Implementation (PIMPL) classes. More...
 
class  SimTK::PIMPLImplementation< HANDLE, IMPL >
 This class provides some infrastructure useful in creating PIMPL Implementation classes (the ones referred to by Handles). More...
 

Namespaces

 SimTK
 This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with other symbols.
 

Macros

#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 & SimTK::operator<< (std::ostream &o, const PIMPLHandle< H, IMPL, PTR > &h)
 

Detailed Description

This header provides declarations of the user-visible portion of the PIMPLHandle template classes that are used in the SimTK Core to implement the PIMPL (private implementation) design pattern.

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.

Macro Definition Documentation

#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 SimTK_DYNAMIC_CAST_DEBUG<const DERIVED_IMPL&>(PARENT::getImpl());\
}\
DERIVED_IMPL& DERIVED::updImpl() {\
return SimTK_DYNAMIC_CAST_DEBUG<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);\
}\