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

E47891-01

coherence/io/pof/reflect/Codec.hpp

00001 /*
00002 * Codec.hpp
00003 *
00004 * Copyright (c) 2000, 2014, 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_POF_REFLECT_CODEC_HPP
00017 #define COH_POF_REFLECT_CODEC_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 #include "coherence/io/pof/PofReader.hpp"
00022 #include "coherence/io/pof/PofWriter.hpp"
00023 
00024 using coherence::io::pof::PofReader;
00025 using coherence::io::pof::PofWriter;
00026 
00027 COH_OPEN_NAMESPACE4(coherence,io,pof,reflect)
00028 
00029 /**
00030 * A Codec provides an interception point for any specific code that needs to
00031 * be executed pre or post (de)serialization. In the case of deserialization
00032 * this could be to return a concrete implementation and with serialization
00033 * this could be to explicitly call a specific method on PofWriter
00034 * that is not carried out by PofWriter::writeObject.
00035 *
00036 * @author hr 2011.06.29
00037 *
00038 * @since 3.7.1
00039 */
00040 class COH_EXPORT Codec
00041     : public interface_spec<Codec>
00042     {
00043     public:
00044         /**
00045         * Deserialize an object from the provided PofReader. Implementing
00046         * this interface allows introducing specific return implementations.
00047         *
00048         * @param hIn    the PofReader to read from
00049         * @param nIndex the index of the POF property to deserialize
00050         *
00051         * @return a specific implementation of the POF property
00052         *
00053         * @throws IOException if an I/O error occurs
00054         */
00055         virtual Object::Holder decode(PofReader::Handle hIn, int32_t nIndex) const = 0;
00056 
00057         /**
00058         * Serialize an object using the provided PofWriter.
00059         *
00060         * @param hOut   the PofWriter to read from
00061         * @param nIndex the index of the POF property to serialize
00062         * @param v      the value to serialize
00063         *
00064         * @throws IOException if an I/O error occurs
00065         */
00066         virtual void encode(PofWriter::Handle hOut, int32_t nIndex, Object::View v) const = 0;
00067     };
00068 
00069 COH_CLOSE_NAMESPACE4
00070 
00071 #endif /* COH_POF_REFLECT_CODEC_HPP */
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.