ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Sapego (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-3584) CPP: Refactor BinaryType class template.
Date Tue, 11 Apr 2017 10:50:41 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-3584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15964162#comment-15964162

Igor Sapego commented on IGNITE-3584:

Merged to master.

> CPP: Refactor BinaryType class template.
> ----------------------------------------
>                 Key: IGNITE-3584
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3584
>             Project: Ignite
>          Issue Type: Task
>          Components: platforms
>    Affects Versions: 1.6
>            Reporter: Igor Sapego
>            Assignee: Igor Sapego
>              Labels: cpp
>             Fix For: 2.0
> 1. All methods should be 'static'.
> 2. Methods {{GetTypeName()}}, {{Read()}} and {{GetNull()}} should pass result to caller
by reference argument and not by return value to avoid copying and temporary objects creation.
> 3. For the {{BinaryType<T*>}}: additionally to the mentioned above, remove field
{{typ}} and add type alias for the non-pointer type instead.
> Explanation:
> Current role of the {{BinaryType<T>}} in C++ is to provide Ignite with the information
about its template type, to be used during serialization and deserialization. Unlike Java
version, C++ {{BinaryType}} also used for user to provide implementation of {{Read}} and {{Write}}
methods, i.e. methods that used to serialize and deserialize objects.
> We can not have non-template interface for this class as Write and Read methods have
templated type in theirs signatures:
> {code}
> void Write(BinaryWriter& writer, const T& obj); 
> T Read(BinaryReader& reader);
> {code}
> We can not change template type {{T}} with non-template type as we don't have single
root class in C++ like {{Object}} class in Java and we also don't have any type information
at runtime.
> Thus we always need to know template type for the {{BinaryType<T>}} when we are
instantiating it, thus we can not have any fabrics or any polymorphism for this class in C++
and internally we always use default constructor to get new instance of such a class.
> So, currently I can not see how having non static methods could be useful for this class.

This message was sent by Atlassian JIRA

View raw message