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 <ac...@redhat.com> on 2008/10/07 16:01:45 UTC

[c++] rename size() to encodedSize() for encodable types.

As a step towards using standard STL collection interfaces for things
like framing::FieldTable and Array, and towards greater clarity in
general, I'd like to rename size() for encoded types as encodedSize().
size() is used in STL to mean the size of a container. Since some of our
encoded types are also containers (FieldTable, Array), our non-standard
use of size() and count() is confusing.

I've got it done in a working copy. Anyone have objections? 

Diff attached.



Re: [c++] rename size() to encodedSize() for encodable types.

Posted by Alan Conway <ac...@redhat.com>.
On Tue, 2008-10-07 at 12:29 -0400, Andrew Stitcher wrote:
> On Tue, 2008-10-07 at 10:01 -0400, Alan Conway wrote:
> > As a step towards using standard STL collection interfaces for things
> > like framing::FieldTable and Array, and towards greater clarity in
> > general, I'd like to rename size() for encoded types as encodedSize().
> > size() is used in STL to mean the size of a container. Since some of our
> > encoded types are also containers (FieldTable, Array), our non-standard
> > use of size() and count() is confusing.
> > 
> > I've got it done in a working copy. Anyone have objections? 
> 
> I think that sounds like a good idea.
> 
> > 
> > Diff attached.
> 
> You haven't compiled this diff, have you? :)

I have, and it passed make check. Maybe there's been a commit since.


Re: [c++] rename size() to encodedSize() for encodable types.

Posted by Alan Conway <ac...@redhat.com>.
On Tue, 2008-10-07 at 13:34 -0400, Ted Ross wrote:
> Alan Conway wrote:
> > On Tue, 2008-10-07 at 12:29 -0400, Andrew Stitcher wrote:
> >   
> >> On Tue, 2008-10-07 at 10:01 -0400, Alan Conway wrote:
> >>     
> >>> As a step towards using standard STL collection interfaces for things
> >>> like framing::FieldTable and Array, and towards greater clarity in
> >>> general, I'd like to rename size() for encoded types as encodedSize().
> >>> size() is used in STL to mean the size of a container. Since some of our
> >>> encoded types are also containers (FieldTable, Array), our non-standard
> >>> use of size() and count() is confusing.
> >>>
> >>> I've got it done in a working copy. Anyone have objections? 
> >>>       
> >> I think that sounds like a good idea.
> >>
> >>     
> >>> Diff attached.
> >>>       
> >> You haven't compiled this diff, have you? :)
> >>     
> >
> > Did you see a problem with it? I've just compiled again on an updated
> > copy, it works fine for me.
> >
> >   
> I think Andrew might be referring to the diff below.  Not sure why your 
> compiler likes it.
> 
> --- incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp (original)
> +++ incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp Tue Oct  7 10:24:24 2008
> @@ -33,7 +33,7 @@
>      Frame f(42, AMQContentBody("foobar"));
>      AMQBody* body=f.getBody();
>      BOOST_CHECK(dynamic_cast<AMQContentBody*>(body));
> -    Buffer b(f.size());
> +    Buffer b(f.encodedSize();
>      f.encode(b);
> 

Evidently the patch I mailed was not the one I compiled :)


Re: [c++] rename size() to encodedSize() for encodable types.

Posted by Ted Ross <tr...@redhat.com>.
Alan Conway wrote:
> On Tue, 2008-10-07 at 12:29 -0400, Andrew Stitcher wrote:
>   
>> On Tue, 2008-10-07 at 10:01 -0400, Alan Conway wrote:
>>     
>>> As a step towards using standard STL collection interfaces for things
>>> like framing::FieldTable and Array, and towards greater clarity in
>>> general, I'd like to rename size() for encoded types as encodedSize().
>>> size() is used in STL to mean the size of a container. Since some of our
>>> encoded types are also containers (FieldTable, Array), our non-standard
>>> use of size() and count() is confusing.
>>>
>>> I've got it done in a working copy. Anyone have objections? 
>>>       
>> I think that sounds like a good idea.
>>
>>     
>>> Diff attached.
>>>       
>> You haven't compiled this diff, have you? :)
>>     
>
> Did you see a problem with it? I've just compiled again on an updated
> copy, it works fine for me.
>
>   
I think Andrew might be referring to the diff below.  Not sure why your 
compiler likes it.

--- incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/tests/Frame.cpp Tue Oct  7 10:24:24 2008
@@ -33,7 +33,7 @@
     Frame f(42, AMQContentBody("foobar"));
     AMQBody* body=f.getBody();
     BOOST_CHECK(dynamic_cast<AMQContentBody*>(body));
-    Buffer b(f.size());
+    Buffer b(f.encodedSize();
     f.encode(b);


Re: [c++] rename size() to encodedSize() for encodable types.

Posted by Alan Conway <ac...@redhat.com>.
On Tue, 2008-10-07 at 12:29 -0400, Andrew Stitcher wrote:
> On Tue, 2008-10-07 at 10:01 -0400, Alan Conway wrote:
> > As a step towards using standard STL collection interfaces for things
> > like framing::FieldTable and Array, and towards greater clarity in
> > general, I'd like to rename size() for encoded types as encodedSize().
> > size() is used in STL to mean the size of a container. Since some of our
> > encoded types are also containers (FieldTable, Array), our non-standard
> > use of size() and count() is confusing.
> > 
> > I've got it done in a working copy. Anyone have objections? 
> 
> I think that sounds like a good idea.
> 
> > 
> > Diff attached.
> 
> You haven't compiled this diff, have you? :)

Did you see a problem with it? I've just compiled again on an updated
copy, it works fine for me.


Re: [c++] rename size() to encodedSize() for encodable types.

Posted by Andrew Stitcher <as...@redhat.com>.
On Tue, 2008-10-07 at 10:01 -0400, Alan Conway wrote:
> As a step towards using standard STL collection interfaces for things
> like framing::FieldTable and Array, and towards greater clarity in
> general, I'd like to rename size() for encoded types as encodedSize().
> size() is used in STL to mean the size of a container. Since some of our
> encoded types are also containers (FieldTable, Array), our non-standard
> use of size() and count() is confusing.
> 
> I've got it done in a working copy. Anyone have objections? 

I think that sounds like a good idea.

> 
> Diff attached.

You haven't compiled this diff, have you? :)

Andrew



RE: [c++] rename size() to encodedSize() for encodable types.

Posted by Steve Huston <sh...@riverace.com>.
FWIW, I think this is a good idea.

-Steve

> -----Original Message-----
> From: Alan Conway [mailto:aconway@redhat.com] 
> Sent: Tuesday, October 07, 2008 10:02 AM
> To: qpid-dev
> Cc: Gordon Sim; Andrew Stitcher
> Subject: [c++] rename size() to encodedSize() for encodable types.
> 
> 
> As a step towards using standard STL collection interfaces for
things
> like framing::FieldTable and Array, and towards greater clarity in
> general, I'd like to rename size() for encoded types as
encodedSize().
> size() is used in STL to mean the size of a container. Since 
> some of our
> encoded types are also containers (FieldTable, Array), our 
> non-standard
> use of size() and count() is confusing.
> 
> I've got it done in a working copy. Anyone have objections? 
> 
> Diff attached.
> 
> 
>