C++ Client API Reference for Oracle Coherence
14c (14.1.2.0.0)

F79659-03

coherence/lang/abstract_spec.hpp

00001 /*
00002  * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
00003  *
00004  * Licensed under the Universal Permissive License v 1.0 as shown at
00005  * http://oss.oracle.com/licenses/upl.
00006  */
00007 #ifndef COH_ABSTRACT_SPEC_HPP
00008 #define COH_ABSTRACT_SPEC_HPP
00009 
00010 #include "coherence/lang/compatibility.hpp"
00011 
00012 #include "coherence/lang/class_spec.hpp"
00013 
00014 COH_OPEN_NAMESPACE2(coherence,lang)
00015 
00016 class Object;
00017 
00018 /**
00019 * Helper for defining an abstract managed class.
00020 *
00021 * Managed classes are implementations of coherence::lang::Object, and include
00022 * a set of well known features, which are auto-generated by this helper class:
00023 *
00024 * - Handle/View/Holder definitions
00025 * - super class definition
00026 * - virtual interface inheritance of up to 16 interfaces
00027 *
00028 * The template takes three parameters:
00029 *
00030 * - The name of the class being defined
00031 * - The defined classes parent class, indicated as extends<parent>
00032 * - An optional list of interfaces to implement, indicated as
00033 *   implements<i1, i2, ...>
00034 *
00035 * A normal class definition would be:
00036 * @code
00037 * class Bar
00038 *   : public abstract_spec<Bar,
00039 *       extends<Object>,
00040 *       implements<SomeInterface, SomeOtherInterface> >
00041 *   {
00042 *   public:
00043 *       // normal abstract class definition....
00044 *   };
00045 * @endcode
00046 *
00047 * @see extends
00048 * @see implements
00049 *
00050 * @author mf 2008.07.14
00051 */
00052 template<class T, class E = extends<Object>, class I = implements<> >
00053 class COH_EXPORT_SPEC abstract_spec
00054     : public class_spec<T, E, I>
00055     {
00056     // ----- typedefs -------------------------------------------------------
00057 
00058     public:
00059         /**
00060         * Specification definition
00061         */
00062         typedef abstract_spec this_spec;
00063 
00064         /**
00065         * Definition T's parent class
00066         */
00067         typedef abstract_spec super;
00068 
00069         /**
00070         * Definition of the spec's parent class
00071         */
00072         typedef class_spec<T, E, I> super_spec;
00073 
00074 
00075     // ----- constructors ---------------------------------------------------
00076 
00077     protected:
00078         /**
00079         * Generate a set of proxy constructors matching the signatures of the
00080         * parent class's constructors.
00081         *
00082         * NOTE: Compilation errors referencing this line likely indicate that
00083         *       class being defined by this spec makes calls a "super"
00084         *       constructor supplying a set of parameters for which there is
00085         *       no exact match on the parent class.
00086         */
00087         COH_DEFINE_PROXY_CONSTRUCTORS(abstract_spec)
00088 
00089     private:
00090         /**
00091         * @internal
00092         *
00093         * Hide inherited create methods, as abstract objects cannot be
00094         * instantiated.
00095         */
00096         static void create()
00097             {
00098             }
00099 
00100     public:
00101         /**
00102         * {@inheritDoc}
00103         *
00104         * Pure virtual clone definition ensures that the resulting class is
00105         * abstract.
00106         */
00107         virtual TypedHandle<Object> clone() const = 0;
00108     };
00109 
00110 COH_CLOSE_NAMESPACE2
00111 
00112 #endif // COH_ABSTRACT_SPEC_HPP
Copyright © 2000, 2025, Oracle and/or its affiliates. Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.