[cmake-developers] daemon-mode: Infrastructure

Ben Boeckel ben.boeckel at kitware.com
Thu Jun 23 17:06:13 EDT 2016


On Tue, Jun 14, 2016 at 02:00:14 +0200, Tobias Hunger wrote:
> Implementing new Protocol Versions:
> ==============================

<snip>

> Deprecating old Protocol Versions:
> ============================

<snip>

One idea that came up on a previous project was the following:

    namespace protocol {
        namespace aspect1 {
            namespace v1 {
            }

            namespace v2 {
            }
        }

        namespace aspect2 {
            namespace v1 {
            }
        }

        namespace v1 {
            namespace aspect1 = aspect1::v1;
            namespace aspect2 = aspect1::v1;

            Version version(1, 0);
            bool deprecated = true;
        }

        namespace v2 {
            namespace aspect1 = aspect1::v2;
            namespace aspect2 = aspect1::v1;

            Version version(2, 0);
            bool deprecated = false;
        }

        namespace latest = v2;
    }

Then the code can use `protocol::v1::aspect1::` for explicit v1
communication and `protocol::latest::` in any normal code. It does
require C++11 though. There's probably some template metaprogramming
magic that could be done to instantiate communication ends for each
protocol namespace once communication is done.

I have no idea how maintainable in the long-term this is though.

--Ben


More information about the cmake-developers mailing list