Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

coherence/lang/interface_spec.hpp

00001 /*
00002 * interface_spec.hpp
00003 *
00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
00005 *
00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
00007 * affiliates.
00008 *
00009 * This software is the confidential and proprietary information of Oracle
00010 * Corporation. You shall not disclose such confidential and proprietary
00011 * information and shall use it only in accordance with the terms of the
00012 * license agreement you entered into with Oracle.
00013 *
00014 * This notice may not be removed or altered.
00015 */
00016 #ifndef COH_INTERFACE_SPEC_HPP
00017 #define COH_INTERFACE_SPEC_HPP
00018 
00019 #include "coherence/lang/compatibility.hpp"
00020 
00021 #include "coherence/lang/lang_spec.hpp"
00022 #include "coherence/lang/Object.hpp"
00023 #include "coherence/lang/TypedHandle.hpp"
00024 #include "coherence/lang/TypedHolder.hpp"
00025 
00026 COH_OPEN_NAMESPACE2(coherence,lang)
00027 
00028 /**
00029 * Helper for defining a managed interface.
00030 *
00031 * Managed interfaces virtually derive from coherence::lang::Object, and
00032 * include a set of well known features, which are auto-generated by this
00033 * helper class:
00034 *
00035 * - Handle/View/Holder definitions
00036 * - virtual interface inheritance of up to 16 interfaces
00037 *
00038 * The template takes two parameters:
00039 *
00040 * - The name of the interface being defined
00041 * - An optional list of interfaces to extend, indicated as
00042 *   implements<i1, i2, ...>
00043 *
00044 * A normal interface definition would be:
00045 * @code
00046 * class MyInterface
00047 *   : public interface_spec<MyInterface,
00048 *       implements<SomeInterface, SomeOtherInterface> >
00049 *   {
00050 *   public:
00051 *       // pure virtual method definitions....
00052 *   };
00053 * @endcode
00054 *
00055 * @see implements
00056 *
00057 * @author mf 2008.07.14
00058 */
00059 template<class T, class I = implements<> >
00060 class interface_spec
00061     : public virtual Object, public virtual I::implements_chain
00062     {
00063     public:
00064         /**
00065         * Specification definition
00066         */
00067         typedef interface_spec this_spec;
00068 
00069         /**
00070         * Standard Handle definition
00071         */
00072         typedef TypedHandle<T> Handle;
00073 
00074         /**
00075         * Standard View definition
00076         */
00077         typedef TypedHandle<const T> View;
00078 
00079         /**
00080         * Standard Holder definition
00081         */
00082         typedef TypedHolder<T> Holder;
00083 
00084     private:
00085         /**
00086         * Blocked Object::create()
00087         *
00088         * @internal
00089         */
00090         static void create()
00091             {
00092             }
00093     };
00094 
00095 COH_CLOSE_NAMESPACE2
00096 
00097 #endif // COH_INTERFACE_SPEC_HPP
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.