コード例 #1
0
                boost::shared_ptr<ClassDefinition> ClassDefinitionWriter::createNestedClassDef(const Portable& portable) {
                    int version = pimpl::PortableVersionHelper::getVersion(&portable, context.getVersion());
                    ClassDefinitionBuilder definitionBuilder(portable.getFactoryId(), portable.getClassId(), version);

                    ClassDefinitionWriter nestedWriter(context, definitionBuilder);
                    PortableWriter portableWriter(&nestedWriter);
                    portable.writePortable(portableWriter);
                    return context.registerClassDefinition(definitionBuilder.build());
                }
コード例 #2
0
 void DefaultPortableWriter::checkPortableAttributes(const FieldDefinition& fd, const Portable& portable) {
     if (fd.getFactoryId() != portable.getFactoryId()) {
         std::stringstream errorMessage;
         errorMessage << "Wrong Portable type! Templated portable types are not supported! "
         << " Expected factory-id: " << fd.getFactoryId() << ", Actual factory-id: " << portable.getFactoryId();
         throw exception::HazelcastSerializationException("DefaultPortableWriter::::checkPortableAttributes", errorMessage.str());
     }
     if (fd.getClassId() != portable.getClassId()) {
         std::stringstream errorMessage;
         errorMessage << "Wrong Portable type! Templated portable types are not supported! "
         << "Expected class-id: " << fd.getClassId() << ", Actual class-id: " << portable.getClassId();
         throw exception::HazelcastSerializationException("DefaultPortableWriter::::checkPortableAttributes", errorMessage.str());
     }
 }