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