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
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to