Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.4.0)

E90870-01

coherence/io/pof/EvolvableObject.hpp

00001 /*
00002 * EvolvableObject.hpp
00003 *
00004 * Copyright (c) 2000, 2019, 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_EVOLVABLE_OBJECT_HPP
00017 #define COH_EVOLVABLE_OBJECT_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/Evolvable.hpp"
00022 
00023 #include "coherence/io/pof/EvolvableHolder.hpp"
00024 
00025 COH_OPEN_NAMESPACE3(coherence,io,pof)
00026 
00027 using coherence::io::Evolvable;
00028 
00029 /**
00030  * Defines an interface that should be implemented by the classes that want to
00031  * support evolution.
00032  *
00033  * @author as  2013.04.24
00034  *
00035  * @since  12.2.1
00036  */
00037 class COH_EXPORT EvolvableObject
00038     : public interface_spec<EvolvableObject>
00039     {
00040     // ----- EvolvableObject interface --------------------------------------
00041 
00042     public:
00043         /**
00044          * Return Evolvable holder object for the specified type id.
00045          *
00046          * This method should only return Evolvable instance if the specified type
00047          * id matches its own type id. Otherwise, it should delegate to the parent:
00048          * <pre>
00049          *     // assuming type ID of this class is 1234
00050          *     FinalView<Evolvable> f_vEvolvable;
00051          *      ...
00052          *     // in constructor
00053          *     : f_vEvolvable(self(), SimpleEvolvable::create(IMPL_VERSION))
00054          *     ...
00055          *     Evolvable::View getEvolvable(int32_t nTypeId)
00056          *         {
00057          *         if (1234 == nTypeId)
00058          *             {
00059          *             return f_vEvolvable;
00060          *             }
00061          *
00062          *         return super::getEvolvable(nTypeId);
00063          *         }
00064          * </pre>
00065          *
00066          * @param nTypeId  type id to get Evolvable instance for
00067          *
00068          * @return  Evolvable instance for the specified type id
00069          */
00070         virtual Evolvable::View getEvolvable(int32_t nTypeId) const = 0;
00071 
00072         /**
00073          * Return Evolvable holder object for the specified type id.
00074          *
00075          * This method should only return Evolvable instance if the specified type
00076          * id matches its own type id. Otherwise, it should delegate to the parent:
00077          * <pre>
00078          *     // assuming type ID of this class is 1234
00079          *     FinalView<Evolvable> f_vEvolvable;
00080          *      ...
00081          *     // in constructor
00082          *     : f_vEvolvable(self(), SimpleEvolvable::create(IMPL_VERSION))
00083          *     ...
00084          *     Evolvable::Handle getEvolvable(int32_t nTypeId)
00085          *         {
00086          *         if (1234 == nTypeId)
00087          *             {
00088          *             return f_vEvolvable;
00089          *             }
00090          *
00091          *         return super::getEvolvable(nTypeId);
00092          *         }
00093          * </pre>
00094          *
00095          * @param nTypeId  type id to get Evolvable instance for
00096          *
00097          * @return  Evolvable instance for the specified type id
00098          */
00099         virtual Evolvable::Handle getEvolvable(int32_t nTypeId) = 0;
00100 
00101         /**
00102          * Return EvolvableHolder that can be used to store information
00103          * about evolvable objects that are not known during deserialization.
00104          *
00105          * For example, it is possible to evolve the class hierarchy by adding new
00106          * classes at any level in the hierarchy. Normally this would cause a problem
00107          * during deserialization on older clients that don't have new classes at all,
00108          * but EvolvableHolder allows us to work around that issue and simply store
00109          * type id to opaque binary value mapping within it.
00110          *
00111          * @return  EvolvableHolder instance
00112          */
00113         virtual EvolvableHolder::View getEvolvableHolder() const = 0;
00114     };
00115 
00116 COH_CLOSE_NAMESPACE3
00117 
00118 #endif // COH_PORTABLE_TYPE_HPP
Copyright © 2000, 2019, Oracle and/or its affiliates. All rights reserved.