Gazebo Utils

API Reference

2.2.0
gz/utils/ImplPtr.hh File Reference
#include <memory>
#include <utility>
#include <gz/utils/detail/DefaultOps.hh>
#include <gz/utils/SuppressWarning.hh>
#include <gz/utils/Export.hh>
#include <gz/utils/detail/ImplPtr.hh>

Go to the source code of this file.

Classes

class  ImplPtr< T, Deleter, Operations >
 The ImplPtr class provides a convenient away to achieve the Rule of Zero while keeping all the benefits of PIMPL. This saves us from writing an enormous amount of boilerplate code for each class. More...
 

Namespaces

 gz
 
 gz::utils
 

Macros

#define GZ_UTILS_IMPL_PTR(memberName)
 Add a private ImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl. More...
 
#define GZ_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName)
 Add a private ImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl. More...
 
#define GZ_UTILS_UNIQUE_IMPL_PTR(memberName)
 Add a private UniqueImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl. More...
 
#define GZ_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName)
 Add a private UniqueImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl. More...
 

Typedefs

template<class T , class Deleter = void (*)(T*)>
using UniqueImplPtr = std::unique_ptr< T, Deleter >
 This is an alternative to ImplPtr<T> which serves the same purpose, except it only provide move semantics (i.e. it does not allow copying). This should be used in cases where it is not safe (or not possible) to copy the underlying state of an implementation class. More...
 

Functions

template<class T , typename... Args>
ImplPtr< T > MakeImpl (Args &&..._args)
 Pass this to the constructor of an ImplPtr object to easily initialize it. All the arguments passed into this function will be perfectly forwarded to the implementation class that gets created. More...
 
template<class T , typename... Args>
UniqueImplPtr< T > MakeUniqueImpl (Args &&..._args)
 Pass this to the constructor of a UniqueImplPtr object to easily initialize it. All the arguments passed into this function will be perfectly forwarded to the implementation class that gets created. More...
 

Macro Definition Documentation

◆ GZ_UTILS_IMPL_PTR

#define GZ_UTILS_IMPL_PTR (   memberName)
Value:
public: class Implementation; \
GZ_UTILS_IMPL_PTR_FWD(Implementation, memberName)

Add a private ImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl.

◆ GZ_UTILS_IMPL_PTR_FWD

#define GZ_UTILS_IMPL_PTR_FWD (   ImplementationClass,
  memberName 
)
Value:
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::ImplPtr<ImplementationClass> memberName; \
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING

Add a private ImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl.

◆ GZ_UTILS_UNIQUE_IMPL_PTR

#define GZ_UTILS_UNIQUE_IMPL_PTR (   memberName)
Value:
public: class Implementation; \
GZ_UTILS_UNIQUE_IMPL_PTR_FWD(Implementation, memberName)

Add a private UniqueImplPtr to a class as dataPtr. This variant forward-declares Class::Implementation as the impl.

◆ GZ_UTILS_UNIQUE_IMPL_PTR_FWD

#define GZ_UTILS_UNIQUE_IMPL_PTR_FWD (   ImplementationClass,
  memberName 
)
Value:
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::UniqueImplPtr<ImplementationClass> memberName; \
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING

Add a private UniqueImplPtr to a class as dataPtr. This variant takes a forward-declared ImplementationClass as the impl.