00001 /* 00002 * PortableObjectSerializer.hpp 00003 * 00004 * Copyright (c) 2000, 2020, 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_OBJECT_SERIALIZER_HPP 00017 #define COH_PORTABLE_OBJECT_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 /** 00029 * A PofSerializer implementation that supports the serialization and 00030 * deserialization of any class that implements PortableObject to and 00031 * from a POF stream. 00032 * 00033 * @author jh 2008.01.18 00034 */ 00035 class COH_EXPORT PortableObjectSerializer 00036 : public class_spec<PortableObjectSerializer, 00037 extends<Object>, 00038 implements<PofSerializer> > 00039 { 00040 friend class factory<PortableObjectSerializer>; 00041 00042 // ----- constructors --------------------------------------------------- 00043 00044 protected: 00045 /** 00046 * Create a new PortableObjectSerializer for the user type with the 00047 * given type identifier. 00048 * 00049 * @param nTypeId the type identifier of a class that needs to be 00050 * serialized or deserialized 00051 */ 00052 PortableObjectSerializer(int32_t nTypeId); 00053 00054 00055 // ----- PofSerializer interface ---------------------------------------- 00056 00057 public: 00058 /** 00059 * {@inheritDoc} 00060 */ 00061 virtual void serialize(PofWriter::Handle hOut, Object::View v) const; 00062 00063 /** 00064 * {@inheritDoc} 00065 */ 00066 virtual Object::Holder deserialize(PofReader::Handle hIn) const; 00067 00068 00069 // ---- data members ---------------------------------------------------- 00070 00071 protected: 00072 /** 00073 * POF user type supported by this PortableObjectSerializer. 00074 */ 00075 int32_t m_nTypeId; 00076 }; 00077 00078 COH_CLOSE_NAMESPACE3 00079 00080 #endif // COH_PORTABLE_OBJECT_SERIALIZER_HPP