HI Brett, Please follow the suggestions already made. The osga plugin already implementents a custom std::streambuf, and the curl plugin uses a stingstream to adapt an external stream into something that the other OSG plugins can use.
Robert. On Thu, Oct 2, 2008 at 3:47 PM, brettwiesner <[EMAIL PROTECTED]> wrote: > Robert, > > OK, I'm reading up on basic_streambuf<char> now. In the meantime, maybe you > can help me understand how I can use a derived streambuf with the existing > IVE loader. Aren't I going to run into the same problem? When the IVE loader > comes across a proxy node, it will write out the node using the IVE loader > and it won't matter that I originally made the call to writeNode() with my > specialized ostream. It's going to create a file stream and write out the > proxy node and there's no way for me to change that. > > Thanks, > Brett > > Robert Osfield wrote: >> >> Hi Brett, >> >> You need to read up about deriving your own custom std::streambuf, >> once you understand this part then adapting existing plugins to use >> your encrypted stream will be straightforward. You could even be lazy >> a use a stringstream like the curl plugin does. Please look into this >> stuff - this will answer your need, and there is certainly no need to >> subclass from plugins, C++ std::stream streambuf extensibility exist >> to help solve problem like yours, and the OSG takes advantage of this. >> >> Robert. >> >> On Wed, Oct 1, 2008 at 9:27 PM, brettwiesner <[EMAIL PROTECTED]> >> wrote: >> >>> >>> Hey Robert, >>> >>> I'm confused about what you mean here. Many plugins have read/ write >>> methods >>> that take istreams/ ostreams (ReaderWriterIVE being one of them). >>> However, >>> since I can't subclass them I can't attach to the stream. For example, in >>> ReaderWriterIVE::writeNode() a std::ofstream is created but there's no >>> way >>> for me to attach it to a stream buffer. >>> >>> It seems like the osga plugin would have the same problem. The doread()/ >>> dowrite() methods call up to whatever ReaderWriter was passed in and I >>> can't >>> subclass those. >>> >>> Thanks, >>> Brett >>> >>> Robert Osfield wrote: >>> >>>> >>>> Hi Brett, >>>> >>>> A number of the plugins support reading a writing from istream/ostream >>>> which means you can implement your std::streambuffer and attach to the >>>> stream and then pass this to the plugin. This technique allows you to >>>> do items like compression/decompression/encription/decription. Have a >>>> look at the osga and curl plugins as they provide examples of using >>>> streams this way. >>>> >>>> Robert. >>>> >>>> On Wed, Oct 1, 2008 at 5:02 PM, brettwiesner <[EMAIL PROTECTED]> >>>> wrote: >>>> >>>> >>>>> >>>>> Hi, >>>>> >>>>> I've got a requirement to ship certain 3rd party model data only in an >>>>> encrypted format. So I wrote my own loader that does the encryption/ >>>>> decryption but uses the IVE loader for everything. This works except >>>>> for >>>>> files that reference other files. The master file is encrypted, but the >>>>> referenced files are saved out as .ive's. >>>>> >>>>> Ideally all I would have to do is subclass ReaderWriterIVE and override >>>>> the >>>>> following stream methods: >>>>> >>>>> virtual osgDB::ReaderWriter::ReadResult readObject(std::istream& fin, >>>>> const osgDB::ReaderWriter::Options* options) const; >>>>> >>>>> virtual osgDB::ReaderWriter::ReadResult readImage(std::istream& fin, >>>>> const osgDB::ReaderWriter::Options* options) const; >>>>> >>>>> virtual osgDB::ReaderWriter::ReadResult readNode(std::istream& fin, >>>>> const osgDB::ReaderWriter::Options* options) const; >>>>> >>>>> virtual osgDB::ReaderWriter::WriteResult writeObject(const >>>>> osg::Object& >>>>> object, >>>>> std::ostream& fout, const osgDB::ReaderWriter::Options* options) >>>>> const; >>>>> >>>>> virtual osgDB::ReaderWriter::WriteResult writeImage(const osg::Image& >>>>> image, >>>>> std::ostream& fout, const osgDB::ReaderWriter::Options* options) >>>>> const; >>>>> >>>>> virtual osgDB::ReaderWriter::WriteResult writeNode(const osg::Node& >>>>> node, >>>>> std::ostream& fout, const osgDB::ReaderWriter::Options* options) >>>>> const; >>>>> >>>>> For writing I could get the raw data from the ive loader encrypt it and >>>>> write it out. For reading I could decrypt the data, then pass the >>>>> unencrypted data up to the ive loader for use. >>>>> >>>>> There is one fatal flaw... I can't subclass the ReaderWriterIVE plugin. >>>>> :( >>>>> >>>>> 1) Has anyone besides me ever wanted to derive from a file loader? >>>>> Would >>>>> it >>>>> make sense to keep the logic in a lib with headers, then have another >>>>> library that is just the plugin? >>>>> >>>>> 2) Is there some other mechanism in OSG that will let me do this? >>>>> >>>>> Thanks, >>>>> Brett >>>>> _______________________________________________ >>>>> osg-users mailing list >>>>> [email protected] >>>>> >>>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>>> >>>>> >>>>> >>>> >>>> _______________________________________________ >>>> osg-users mailing list >>>> [email protected] >>>> >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>>> >>>> >>> >>> _______________________________________________ >>> osg-users mailing list >>> [email protected] >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>> >>> >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

