00001 /* 00002 * PofContext.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_POF_CONTEXT_HPP 00017 #define COH_POF_CONTEXT_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/Serializer.hpp" 00022 #include "coherence/io/pof/PofSerializer.hpp" 00023 00024 COH_OPEN_NAMESPACE3(coherence,io,pof) 00025 00026 using coherence::io::Serializer; 00027 00028 00029 /** 00030 * A PofContext is a registry of PofSerializer instances, and thus, represents 00031 * a set of user types that can be serialized to and deserialized from a POF 00032 * stream. 00033 * 00034 * @author jh 2008.01.18 00035 */ 00036 class COH_EXPORT PofContext 00037 : public interface_spec<PofContext, 00038 implements<Serializer> > 00039 { 00040 // ----- PofContext interface ------------------------------------------- 00041 00042 public: 00043 /** 00044 * Return a PofSerializer that can be used to serialize and 00045 * deserialize an objectof the specified user type to and from a POF 00046 * stream. 00047 * 00048 * @param nTypeId the type identifier of the user type that can be 00049 * serialized and deserialized using the returned 00050 * PofSerializer 00051 * 00052 * @return a PofSerializer for the specified user type 00053 * 00054 * @throws coherence::lang::IllegalArgumentException if the specified 00055 * user type is negative or unknown to this PofContext 00056 */ 00057 virtual PofSerializer::View getPofSerializer(int32_t nTypeId) const = 0; 00058 00059 /** 00060 * Determine the user type identifier associated with the given 00061 * object. 00062 * 00063 * @param v an instance of a user type; must not be NULL 00064 * 00065 * @return the type identifier of the user type associated with the 00066 * given object 00067 * 00068 * @throws coherence::lang::IllegalArgumentException if the user type 00069 * associated with the given object is unknown to this 00070 * PofContext or if the object is NULL 00071 */ 00072 virtual int32_t getUserTypeIdentifier(Object::View v) const = 0; 00073 00074 /** 00075 * Determine the user type identifier associated with the given class. 00076 * 00077 * @param vClass a user type class; must not be NULL 00078 * 00079 * @return the type identifier of the user type associated with the 00080 * given class 00081 * 00082 * @throws coherence::lang::IllegalArgumentException if the user type 00083 * associated with the given class is unknown to this 00084 * PofContext or if the class is NULL 00085 */ 00086 virtual int32_t getUserTypeIdentifier(Class::View vClass) const = 0; 00087 00088 /** 00089 * Determine the user type identifier associated with the given class 00090 * name. 00091 * 00092 * @param vsClass the name of a user type class; must not be NULL 00093 * 00094 * @return the type identifier of the user type associated with the 00095 * given class name 00096 * 00097 * @throws coherence::lang::IllegalArgumentException if the user type 00098 * associated with the given class name is unknown to this 00099 * PofContext or if the class name is NULL 00100 */ 00101 virtual int32_t getUserTypeIdentifier(String::View vsClass) const = 0; 00102 00103 /** 00104 * Determine the name of the class associated with the given user type 00105 * identifier. 00106 * 00107 * @param nTypeId the user type identifier; must be non-negative 00108 * 00109 * @return the name of the class associated with the specified user 00110 * type identifier 00111 * 00112 * @throws coherence::lang::IllegalArgumentException if the specified 00113 * user type is negative or unknown to this PofContext 00114 */ 00115 virtual String::View getClassName(int32_t nTypeId) const = 0; 00116 00117 /** 00118 * Determine the class associated with the given user type identifier. 00119 * 00120 * @param nTypeId the user type identifier; must be non-negative 00121 * 00122 * @return the class associated with the specified user type 00123 * identifier 00124 * 00125 * @throws coherence::lang::IllegalArgumentException if the specified 00126 * user type is negative or unknown to this PofContext 00127 */ 00128 virtual Class::View getClass(int32_t nTypeId) const = 0; 00129 00130 /** 00131 * Determine if the given object is an instance of a user type known 00132 * to this PofContext. 00133 * 00134 * @param v the object to test; must not be NULL 00135 * 00136 * @return true iff the specified object is of a valid user type 00137 * 00138 * @throws coherence::lang::IllegalArgumentException if the given 00139 * object is NULL 00140 */ 00141 virtual bool isUserType(Object::View v) const = 0; 00142 00143 /** 00144 * Determine if the given class is a user type known to this 00145 * PofContext. 00146 * 00147 * @param vClass the class to test; must not be NULL 00148 * 00149 * @return true iff the specified class is a valid user type known to 00150 * this PofContext 00151 * 00152 * @throws coherence::lang::IllegalArgumentException if the given 00153 * class is NULL 00154 */ 00155 virtual bool isUserType(Class::View vClass) const = 0; 00156 00157 /** 00158 * Determine if the class with the given name is a user type known to 00159 * this PofContext. 00160 * 00161 * @param vsClass the name of the class to test; must not be NULL 00162 * 00163 * @return true iff the class with the specified name is a valid user 00164 * type 00165 * 00166 * @throws coherence::lang::IllegalArgumentException if the given 00167 * class name is NULL 00168 */ 00169 virtual bool isUserType(String::View vsClass) const = 0; 00170 }; 00171 00172 COH_CLOSE_NAMESPACE3 00173 00174 #endif // COH_POF_CONTEXT_HPP