HydraExpress™ C++ API Reference Guide

 
Loading...
Searching...
No Matches
rwsf::PointerNamedObjectImp< T > Class Template Reference

A subtype of NamedObjectImp used to wrap an object, as a pointer, in a NamedObject handle. More...

#include <rwsf/core/NamedObject.h>

Inheritance diagram for rwsf::PointerNamedObjectImp< T >:
rwsf::NamedObjectImp

Public Member Functions

 PointerNamedObjectImp ()
 PointerNamedObjectImp (T *objImpl, bool needsDeletion=false)
virtual ~PointerNamedObjectImp ()
T * getValue () const
virtual void init ()

Detailed Description

template<class T>
class rwsf::PointerNamedObjectImp< T >

The PointerNamedObjectImp is a subtype of NamedObjectImp and can be used to wrap an object, as a pointer, in a NamedObject handle. The object wrapped by this NamedObject body type must have an init() function declared and defined:

void init(const rwsf::Config& config);
Base class for classes that encapsulate information from deployment descriptors.
Definition Config.h:47

Since this is a templatized function, the type of object wrapped serves as the template parameter to this class and its functions. There are two ways to create a PointerNamedObjectImp:

  • Allow the constructor to create the templatized object pointer. This is the easiest method, but requires that the object have a functioning default constructor.
  • Create the object first, then wrap it with the PointerNamedObjectImp. This method allows for flexible construction, but it must be specified whether the object should be deleted when the PointerNamedObjectImp is deleted. The default is to not delete the object, allowing the user to control the object's lifetime. If the system should delete the object, set the relevant constructor's parameter needsDeletion to true.

Constructor & Destructor Documentation

◆ PointerNamedObjectImp() [1/2]

template<class T>
rwsf::PointerNamedObjectImp< T >::PointerNamedObjectImp ( )

Constructs a new PointerNamedObjectImp body with a pointer to a new object of templatized type T. This requires that type T have a default constructor.

◆ PointerNamedObjectImp() [2/2]

template<class T>
rwsf::PointerNamedObjectImp< T >::PointerNamedObjectImp ( T * objImpl,
bool needsDeletion = false )

Constructs a new PointerNamedObjectImp body, wrapped around the existing object objImpl. To delete objImpl when this body is deleted, set needsDeletion to true. The default is false, allowing control over the lifetime of the objImpl.

◆ ~PointerNamedObjectImp()

template<class T>
virtual rwsf::PointerNamedObjectImp< T >::~PointerNamedObjectImp ( )
virtual

Destructor called when the last NamedObject handle pointing to this body goes out of scope. If needsDeletion was set to true when this object was constructed, or the default constructor was used to create this body, the wrapped object is also deleted.

Member Function Documentation

◆ getValue()

template<class T>
T * rwsf::PointerNamedObjectImp< T >::getValue ( ) const

Returns the underlying, wrapped object as its object pointer.

◆ init()

template<class T>
virtual void rwsf::PointerNamedObjectImp< T >::init ( )
virtual

Calls void init(const rwsf::Config&) on the stored object. This function must exist, or compiler or linker errors will occur when generating the template code for the module that uses this class.

Implements rwsf::NamedObjectImp.

Copyright © 2026 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.