Click here to Skip to main content
15,893,814 members
Articles / Programming Languages / C++

Using Interfaces for Object Oriented Primitives

Rate me:
Please Sign up or sign in to vote.
4.65/5 (11 votes)
7 Dec 20047 min read 57.5K   369   27  
An introduction to the OOTL (Object Oriented Template Library). Describes how the OOTL uses a bleeding-edge technique of defining interface types in C++ to provide lightweight object-oriented primitives with run-time polymorphism through an IObject interface.
// (C) Copyright Jonathan Turkanis 2004.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)

// Disclaimer: Not a Boost library.

#ifndef BOOST_IDL_DETAIL_IDL_BEGIN_HPP_INCLUDED
#define BOOST_IDL_DETAIL_IDL_BEGIN_HPP_INCLUDED

#if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once
#endif

#include <boost/interfaces/detail/util.hpp>
#include <boost/interfaces/detail/macros/befriend_template.hpp>
#include <boost/interfaces/access.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/list.hpp>
#include <boost/preprocessor/cat.hpp>

#define BOOST_IDL_BEGIN_TEMPLATE(name, arity) \
    struct BOOST_PP_CAT(name, _interface_impl_) { \
      friend class ::boost::interfaces::access; \
      BOOST_STATIC_CONSTANT(int, start_line_ = __LINE__); \
    public: \
      template<typename Derived_, typename Flags_, typename Base_> \
      struct generator_impl : Base_ { \
      BOOST_IDL_PRIVATE: \
        template<typename NNN_, typename Dummy_ = int> \
        struct tracker_ { typedef void type; }; \
      public: \
        struct superinterfaces_ \
            : ::boost::mpl::identity< ::boost::mpl::list< \
    /**/

#define BOOST_IDL_BEGIN(name) BOOST_IDL_BEGIN_TEMPLATE(name, 0)
    /**/

#endif // #ifndef BOOST_IDL_DETAIL_IDL_BEGIN_HPP_INCLUDED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer Ara 3D
Canada Canada
I am the designer of the Plato programming language and I am the founder of Ara 3D. I can be reached via email at cdiggins@gmail.com

Comments and Discussions