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

E47891-01

coherence/io/pof/PofSerializer.hpp

00001 /*
00002 * PofSerializer.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_SERIALIZER_HPP
00017 #define COH_POF_SERIALIZER_HPP
00018 
00019 #include "coherence/lang.ns"
00020 
00021 COH_OPEN_NAMESPACE3(coherence,io,pof)
00022 
00023 class PofReader;
00024 class PofWriter;
00025 
00026 
00027 /**
00028 * The PofSerializer interface provides the capability of reading and writing
00029 * an object from and to a Portable Object Format (POF) stream.
00030 *
00031 * @author jh  2008.01.14
00032 */
00033 class COH_EXPORT PofSerializer
00034     : public interface_spec<PofSerializer>
00035     {
00036     // ----- handle definitions ---------------------------------------------
00037 
00038     public:
00039         /**
00040         * PofReader Handle definition.
00041         */
00042         typedef TypedHandle<PofReader> PofReaderHandle;
00043 
00044         /**
00045         * PofWriter Handle definition.
00046         */
00047         typedef TypedHandle<PofWriter> PofWriterHandle;
00048 
00049 
00050     // ----- PofSerializer interface ----------------------------------------
00051 
00052     public:
00053         /**
00054         * Serialize a user type instance to a POF stream by writing its state
00055         * using the specified PofWriter.
00056         *
00057         * An implementation of PofSerializer is required to follow the
00058         * following steps in sequence for writing out an Object of a user
00059         * type:
00060         * <ol>
00061         * <li>If the object is Evolvable, the implementation must set the
00062         *     version by calling PofWriter::setVersionId().</li>
00063         * <li>The implementation may write any combination of the properties
00064         *     of the user type by using the "write" methods of the PofWriter,
00065         *     but it must do so in the order of the property indexes.</li>
00066         * <li>After all desired properties of the user type have been
00067         *     written, the implementation must terminate the writing of
00068         *     the user type by calling PofWriter::writeRemainder(). </li>
00069         * </ol>
00070         *
00071         * @param hOut  a PofWriter to use for writing the object's state
00072         * @param v     an object to serialize
00073         */
00074         virtual void serialize(PofWriterHandle hOut, Object::View v) const = 0;
00075 
00076         /**
00077         * Deserialize a user type instance from a POF stream by reading its
00078         * state using the specified PofReader.
00079         *
00080         * An implementation of PofSerializer is required to follow the
00081         * following steps in sequence for reading in an object of a user
00082         * type:
00083         * <ol>
00084         * <li>If the object is Evolvable, the implementation must get the
00085         *     version by calling PofWriter::getVersionId().</li>
00086         * <li>The implementation may read any combination of the properties
00087         *     of the user type by using "read" methods of the PofReader, but
00088         *     it must do so in the order of the property indexes.</li>
00089         * <li>After all desired properties of the user type have been read,
00090         *     the implementation must terminate the reading of the user type
00091         *     by calling PofReader::readRemainder().</li>
00092         * </ol>
00093         *
00094         * @param hIn a PofReader to use for reading the Object's state
00095         *
00096         * @return the deserialized user type instance
00097         */
00098         virtual Object::Holder deserialize(PofReaderHandle hIn) const = 0;
00099     };
00100 
00101 COH_CLOSE_NAMESPACE3
00102 
00103 #endif // COH_POF_SERIALIZER_HPP
Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.