00001 /* 00002 * PortableTypeSerializer.hpp 00003 * 00004 * Copyright (c) 2000, 2017, 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_PORTABLE_TYPE_SERIALIZER_HPP 00017 #define COH_PORTABLE_TYPE_SERIALIZER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/PofReader.hpp" 00022 #include "coherence/io/pof/PofSerializer.hpp" 00023 #include "coherence/io/pof/PofWriter.hpp" 00024 00025 COH_OPEN_NAMESPACE3(coherence,io,pof) 00026 00027 /** 00028 * A PofSerializer implementation that serializes classes that implement 00029 * PortableObject interface (and optionally EvolvableObject interface). 00030 * 00031 * Unlike legacy PortableObjectSerializer, this class serializes attributes 00032 * of each class in the object's hierarchy into a separate nested POF stream, 00033 * which allows for independent evolution of each class in the hierarchy, as well 00034 * as the evolution of the hierarchy itself (addition of new classes at any level 00035 * in the hierarchy). 00036 * 00037 * @author as 2013.05.01 00038 00039 * @since 12.1.3 00040 */ 00041 class COH_EXPORT PortableTypeSerializer 00042 : public class_spec<PortableTypeSerializer, 00043 extends<Object>, 00044 implements<PofSerializer> > 00045 { 00046 friend class factory<PortableTypeSerializer>; 00047 00048 // ---- constructors ---------------------------------------------------- 00049 00050 protected: 00051 /** 00052 * Create a new PortableTypeSerializer for the user type with the given type 00053 * identifier. 00054 * 00055 * @param nTypeId the type identifier of the user type to serialize and deserialize 00056 */ 00057 PortableTypeSerializer(int32_t nTypeId); 00058 00059 // ----- PofSerializer interface ---------------------------------------- 00060 00061 public: 00062 /** 00063 * {@inheritDoc} 00064 */ 00065 virtual void serialize(PofWriter::Handle hOut, Object::View v) const; 00066 00067 /** 00068 * {@inheritDoc} 00069 */ 00070 virtual Object::Holder deserialize(PofReader::Handle hIn) const; 00071 00072 // ----- data members --------------------------------------------------- 00073 00074 protected: 00075 /** 00076 * The type identifier of the user type to serialize and deserialize. 00077 */ 00078 int32_t m_nTypeId; 00079 }; 00080 00081 COH_CLOSE_NAMESPACE3 00082 00083 #endif // COH_PORTABLE_TYPE_SERIALIZER_HPP