in bpp-core OutputStream.h, I added a class to use std::stringstream,
because I needed
a object that knows how to convert the stream in a string. So I added
this code
#include <sstream>
class StdStr :
public StlOutputStreamWrapper
{
public:
StdStr(): StlOutputStreamWrapper(new std::ostringstream()){}
It works fine, but I could not use the inheritance from
StlOutputStream in this, because there the stream_ is an
auto_ptr<std::ostream> , and I need something like dynamic_cast and I
could not manage this.
I am not sure I get your point... ostringstream is a ostream, so you
should be able to use StlOutputStream with it.
Then you should be able to use
dynamic_cast<ostringstream*>(stream_->get()), isn't it?
> in bpp-core OutputStream.h, I added a class to use std::stringstream,
> because I needed
> a object that knows how to convert the stream in a string. So I added
> this code
> #include <sstream>
> class StdStr :
> public StlOutputStreamWrapper
> {
> public:
> StdStr(): StlOutputStreamWrapper(new std::ostringstream()){}
> It works fine, but I could not use the inheritance from
> StlOutputStream in this, because there the stream_ is an
> auto_ptr<std::ostream> , and I need something like dynamic_cast and I
> could not manage this.
> Cheers,
> Laurent
> --
> You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
> To post to this group, send email to biopp-devel-forum@googlegroups.com.
> To unsubscribe from this group, send email to biopp-devel-forum+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
-- Julien Y. Dutheil, Ph-D
0 (+49) 6421 178 530
§ Max Planck Institute for Terrestrial Microbiology
Department of Organismic Interactions
Marburg -- GERMANY
§ Intitute of Evolutionary Sciences - Montpellier
University of Montpellier 2 -- FRANCE
For this I agree, but the problem is for the constructor, he needs
an auto_ptr<ostream> which would be the result of a cast
from an auto_ptr<ostringstream>. But I did not find the way to do it
L
On Sep 27, 1:28 pm, Julien Yann Dutheil <jy.duth...@gmail.com> wrote:
> I am not sure I get your point... ostringstream is a ostream, so you
> should be able to use StlOutputStream with it.
> Then you should be able to use
> dynamic_cast<ostringstream*>(stream_->get()), isn't it?
> Cheers,
> Julien.
> On Thu, Sep 27, 2012 at 12:26 PM, Laurent Guéguen
> > in bpp-core OutputStream.h, I added a class to use std::stringstream,
> > because I needed
> > a object that knows how to convert the stream in a string. So I added
> > this code
> > It works fine, but I could not use the inheritance from
> > StlOutputStream in this, because there the stream_ is an
> > auto_ptr<std::ostream> , and I need something like dynamic_cast and I
> > could not manage this.
> > Cheers,
> > Laurent
> > --
> > You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
> > To post to this group, send email to biopp-devel-forum@googlegroups.com.
> > To unsubscribe from this group, send email to biopp-devel-forum+unsubscribe@googlegroups.com.
> > For more options, visithttps://groups.google.com/groups/opt_out.
Actually giving an auto_ptr to the constructor might not be a good
idea, I should check that.
Otherwise you should be able to do:
auto_ptr<ostringstream> ptr1 ...
auto_ptr<ostream> ptr2(ptr1.get());
ptr1.release();
and then give ptr2 to the constructor?
<lau.gueg...@laposte.net> wrote:
> For this I agree, but the problem is for the constructor, he needs
> an auto_ptr<ostream> which would be the result of a cast
> from an auto_ptr<ostringstream>. But I did not find the way to do it
> L
> On Sep 27, 1:28 pm, Julien Yann Dutheil <jy.duth...@gmail.com> wrote:
>> Hi Laurent,
>> I am not sure I get your point... ostringstream is a ostream, so you
>> should be able to use StlOutputStream with it.
>> Then you should be able to use
>> dynamic_cast<ostringstream*>(stream_->get()), isn't it?
>> Cheers,
>> Julien.
>> On Thu, Sep 27, 2012 at 12:26 PM, Laurent Guéguen
>> > in bpp-core OutputStream.h, I added a class to use std::stringstream,
>> > because I needed
>> > a object that knows how to convert the stream in a string. So I added
>> > this code
>> > It works fine, but I could not use the inheritance from
>> > StlOutputStream in this, because there the stream_ is an
>> > auto_ptr<std::ostream> , and I need something like dynamic_cast and I
>> > could not manage this.
>> > Cheers,
>> > Laurent
>> > --
>> > You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
>> > To post to this group, send email to biopp-devel-forum@googlegroups.com.
>> > To unsubscribe from this group, send email to biopp-devel-forum+unsubscribe@googlegroups.com.
>> > For more options, visithttps://groups.google.com/groups/opt_out.
>> § Max Planck Institute for Terrestrial Microbiology
>> Department of Organismic Interactions
>> Marburg -- GERMANY
>> § Intitute of Evolutionary Sciences - Montpellier
>> University of Montpellier 2 -- FRANCE
> --
> You received this message because you are subscribed to the Google Groups "Bio++ Development Forum" group.
> To post to this group, send email to biopp-devel-forum@googlegroups.com.
> To unsubscribe from this group, send email to biopp-devel-forum+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
-- Julien Y. Dutheil, Ph-D
0 (+49) 6421 178 530
§ Max Planck Institute for Terrestrial Microbiology
Department of Organismic Interactions
Marburg -- GERMANY
§ Intitute of Evolutionary Sciences - Montpellier
University of Montpellier 2 -- FRANCE
On Friday, September 28, 2012 11:29:59 AM UTC+2, Julien Yann Dutheil wrote:
> Indeed,
> Actually giving an auto_ptr to the constructor might not be a good > idea, I should check that. > Otherwise you should be able to do: > auto_ptr<ostringstream> ptr1 ... > auto_ptr<ostream> ptr2(ptr1.get()); > ptr1.release(); > and then give ptr2 to the constructor?
> J.
> On Fri, Sep 28, 2012 at 9:50 AM, Laurent Guéguen > <lau.g...@laposte.net <javascript:>> wrote: > > For this I agree, but the problem is for the constructor, he needs > > an auto_ptr<ostream> which would be the result of a cast > > from an auto_ptr<ostringstream>. But I did not find the way to do it
> > L
> > On Sep 27, 1:28 pm, Julien Yann Dutheil <jy.duth...@gmail.com> wrote: > >> Hi Laurent,
> >> I am not sure I get your point... ostringstream is a ostream, so you > >> should be able to use StlOutputStream with it. > >> Then you should be able to use > >> dynamic_cast<ostringstream*>(stream_->get()), isn't it?
> >> Cheers,
> >> Julien.
> >> On Thu, Sep 27, 2012 at 12:26 PM, Laurent Guéguen
> >> > in bpp-core OutputStream.h, I added a class to use > std::stringstream, > >> > because I needed > >> > a object that knows how to convert the stream in a string. So I added > >> > this code
> >> > It works fine, but I could not use the inheritance from > >> > StlOutputStream in this, because there the stream_ is an > >> > auto_ptr<std::ostream> , and I need something like dynamic_cast and I > >> > could not manage this.
> >> > Cheers, > >> > Laurent
> >> > -- > >> > You received this message because you are subscribed to the Google > Groups "Bio++ Development Forum" group. > >> > To post to this group, send email to biopp-de...@googlegroups.com<javascript:>.
> >> > To unsubscribe from this group, send email to > biopp-devel-fo...@googlegroups.com <javascript:>. > >> > For more options, visithttps://groups.google.com/groups/opt_out.
> >> § Max Planck Institute for Terrestrial Microbiology > >> Department of Organismic Interactions > >> Marburg -- GERMANY
> >> § Intitute of Evolutionary Sciences - Montpellier > >> University of Montpellier 2 -- FRANCE
> > -- > > You received this message because you are subscribed to the Google > Groups "Bio++ Development Forum" group. > > To post to this group, send email to biopp-de...@googlegroups.com<javascript:>.
> > To unsubscribe from this group, send email to > biopp-devel-fo...@googlegroups.com <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out.