Writing the required type implementation methods

Updated: April 19, 2023
Now, we must implement the virtual functions of TypeImpl by writing routines for the derived DataBufferType class. The constructor for this latter class must assign its TopicDataType reference (which refers to a more specific DataBufferPubSubType object) to its parent object:
DataBufferType::DataBufferType()
    : TypeImpl( m_type )
{ }
Note: Within the C++ compilation unit, DataBufferType is not written as a singleton class. However, the static method Impl() (listed just above the constructor in the class declaration) is used for externally exposing a single object when linking the plugin with the PiPS framework, which is written in C. For details, see Linking and loading the type plugin.
The createInstance() function is used by the PiPS framework to allocate new Instance objects:
DataBufferType::Instance* DataBufferType::createInstance()
{
    return new Instance( m_type );
}