Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

coherence/lang/TypedExecutableClass.hpp

00001 /*
00002 * TypedExecutableClass.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_TYPED_EXECUTABLE_CLASS_HPP
00017 #define COH_TYPED_EXECUTABLE_CLASS_HPP
00018 
00019 #include "coherence/lang/compatibility.hpp"
00020 
00021 #include "coherence/lang/ExecutableClass.hpp"
00022 #include "coherence/lang/TypedClass.hpp"
00023 
00024 #include <ostream>
00025 
00026 COH_OPEN_NAMESPACE2(coherence,lang)
00027 
00028 
00029 /**
00030 * TypedExecutableClass provides a templated extension of ExecutableClass.
00031 *
00032 * @author mf  2008.10.02
00033 */
00034 template<class T, class C> class TypedExecutableClass
00035     : public class_spec<TypedExecutableClass<T, C>,
00036         extends<C>,
00037         implements<ExecutableClass> >
00038     {
00039     friend class factory<TypedExecutableClass<T, C> >;
00040 
00041     // ----- typedefs -------------------------------------------------------
00042 
00043     public:
00044         /**
00045         * Class type.
00046         */
00047         typedef T Type;
00048 
00049 
00050     // ----- constructors ---------------------------------------------------
00051 
00052     protected:
00053         /**
00054         * Create a new TypedExecutableClass.
00055         *
00056         * @return a new TypedExecutableClass
00057         */
00058         TypedExecutableClass<T, C>()
00059             {
00060             }
00061 
00062     private:
00063         /**
00064         * Blocked copy constructor
00065         */
00066         TypedExecutableClass<T, C>(const TypedExecutableClass<T, C>&);
00067 
00068 
00069     // ----- ExecutableClass interface --------------------------------------
00070 
00071     public:
00072         /**
00073         * {@inheritDoc}
00074         */
00075         virtual void execute(ObjectArray::View vasArg) const
00076             {
00077             T::main(vasArg);
00078             }
00079 
00080 
00081     // ----- Object interface -----------------------------------------------
00082 
00083     public:
00084         /**
00085         * {@inheritDoc}
00086         */
00087         virtual void toStream(std::ostream& out) const
00088             {
00089             out << "TypedExecutableClass<" << Class::getName() << ">";
00090             }
00091     };
00092 
00093 COH_CLOSE_NAMESPACE2
00094 
00095 #endif // COH_TYPED_EXECUTABLE_CLASS_HPP
Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.