You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Alan Conway (JIRA)" <ji...@apache.org> on 2018/03/21 14:34:00 UTC

[jira] [Comment Edited] (PROTON-1795) [cpp] imporved documentation for complex type mapping

    [ https://issues.apache.org/jira/browse/PROTON-1795?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16407999#comment-16407999 ] 

Alan Conway edited comment on PROTON-1795 at 3/21/18 2:33 PM:
--------------------------------------------------------------

Notes from chat:

kvdr: vector<int64_t> , vector<string> or other fixed type should encode as an array by default. vector<proton::value> or vector<proton::scalar> will encode as a list by default because the encoded type of value/scalar may not be uniform.
kvdr: there are tricks to force the encoding however.
kvdr: suppose I know that all the scalars in vector<scalar> v; are integers and I want to force the whole thing to encode as an array of uin32_t:
value x; encoder(x) << encoder::array(v, PROTON::UINT)
 kvdr: after that, x will contain the vector<scalar> encoded as AMQP array of uint - or it will throw if any of the scalars can't be converted to uint.


was (Author: aconway):
Notes from chat:

kvdr: vector<int64_t> , vector<string> or other fixed type should encode as an array by default. vector<proton::value> or vector<proton::scalar> will encode as a list by default because the encoded type of value/scalar may not be uniform.
gsapienz is now known as gsapienz_WLcall
kvdr: there are tricks to force the encoding however.
aconway, ok, thanks, let me look again at my code...
amine (~Adium@ovpn-117-57.phx2.redhat.com) has joined #messaging
aconway, yes, you are right. I have a std::vector<proton::value>
kvdr: suppose I know that all the scalars in vector<scalar> v; are integers and I want to force the whole thing to encode as an array of uin32_t:
Lei is now known as Lei_brb
mnovak (~mnovak@dhcp-10-40-5-110.brq.redhat.com) has quit (Ping timeout: 612 seconds)
jdanek_ (~jdanek@ovpn-200-25.brq.redhat.com) has joined #messaging
value x; encoder(x) << encoder::array(v, PROTON::UINT)
kvdr: after that, x will contain the vector<scalar> encoded as AMQP array of uint - or it will throw if any of the scalars can't be converted to uint.

> [cpp] imporved documentation for complex type mapping
> -----------------------------------------------------
>
>                 Key: PROTON-1795
>                 URL: https://issues.apache.org/jira/browse/PROTON-1795
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: proton-c-0.21.0
>            Reporter: Alan Conway
>            Assignee: Alan Conway
>            Priority: Major
>             Fix For: proton-c-0.22.0
>
>
> The complex type mapping section of the doc is brief and cryptic:
>    [http://qpid.apache.org/releases/qpid-proton-0.21.0/proton/cpp/api/types_page.html]
>  
> Needs review and improvement, including (but not limited to)
>  * explain why we allow conversion of AMQP maps to/from sequences: order-preserving
>  * clarify use of #include files to enable all or selected conversions.
>  * include example code



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org