On 14/04/2016 07:34, Gerry Boland wrote:
> + if (CoordinateTranslator::instance()) {
> + CoordinateTranslator::instance()->registerMirSurface(this, surface.get());
> + }
> Why would there not be an instance returned? Having to check this every time is a pain. Singleton pattern requires instance() returns a valid object.
CoordinateTranslator has no control over the creation of its instance.
On 14/04/2016 07:34, Gerry Boland wrote: slator: :instance( )) { lator:: instance( )->registerMirS urface( this, surface.get());
> + if (CoordinateTran
> + CoordinateTrans
> + }
> Why would there not be an instance returned? Having to check this every time is a pain. Singleton pattern requires instance() returns a valid object.
CoordinateTrans lator has no control over the creation of its instance.
It's created by MirServer here:
""" the_coordinate_ translator( [] shared< qtmir:: CoordinateTrans lator>( );
override_
{
return std::make_
});
"""
CoordinateTrans lator:: instance( ) simply returns its single existing
instance, if any.
How do you conciliate the Singleton pattern you expect with the way
things get created in MirServer?