stefandebruyn/surefire

Split methods for PAL objects into wrapper and implementation methods

stefandebruyn opened this issue · 0 comments

Split each PAL object method into a public wrapper (that the PAL implements) and a private implementation method (that the PSL implements). This cuts down on boilerplate, as the wrapper can contain common code that gets "inherited" by all PSL implementations of a particular PAL method; for example, checking that the object is initialized:

// Before
Result foo() // Implemented in PSL
{
    if (!mInit) // Copied across all PSL implementations
    {
        return E_FOO_UNINIT;
    }
    ...
}

// After
Result foo() // Implemented in PAL
{
    if (!mInit)
    {
        return E_FOO_UNINIT;
    }
    return this->fooImpl();
}

Result fooImpl() // Implemented in PSL
{
    ...
}