[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [IMP-dev] specifying input files in IMP



Daniel Russel wrote:
> Currently files which need input files take strings with the path to the
> file name. This is pretty easy, but eliminates the possibility of using
> more exotic sources and write destinations (such as reading and writing
> from memory). Since Ben has gotten streams working across the C++/Python
> bridge, we could switch our interfaces over to using streams everywhere.
> Thoughts?

I was just thinking the same thing. If you could only choose one of
filenames or streams, streams are clearly the more flexible way to go.
(The only sort-of downside, I guess, is that for things such as density
maps, the stream would have to be in binary mode to work properly. Right
now filename-access functions can explicitly request that when they open
the ifstream, whereas there's no way I know of to check an existing stream.)

But do we have to choose only one? One could argue that we could
overload each method, to take either a string or a stream. But it seems
more sensible to me to only have one method (the stream method)
otherwise we have lots of extra code paths to test everywhere.

	Ben
-- 
                      http://salilab.org/~ben/
"It is a capital mistake to theorize before one has data."
	- Sir Arthur Conan Doyle