From: <den...@us...> - 2010-02-28 01:19:06
|
Revision: 71 http://dsim.svn.sourceforge.net/dsim/?rev=71&view=rev Author: denis_arnaud Date: 2010-02-28 01:18:59 +0000 (Sun, 28 Feb 2010) Log Message: ----------- [Test] Added a directory for Boost.IOStreams. Modified Paths: -------------- trunk/dsim/configure.ac Added Paths: ----------- trunk/dsim/test/boost/iostreams/ trunk/dsim/test/boost/iostreams/Makefile.am trunk/dsim/test/boost/iostreams/filereader.cpp trunk/dsim/test/boost/iostreams/filetoberead.csv Modified: trunk/dsim/configure.ac =================================================================== --- trunk/dsim/configure.ac 2010-02-23 14:29:43 UTC (rev 70) +++ trunk/dsim/configure.ac 2010-02-28 01:18:59 UTC (rev 71) @@ -199,6 +199,7 @@ AC_SUBST(BOOST_THREAD_LIB) AC_SUBST(BOOST_PYTHON_LIB) AC_SUBST(BOOST_SIGNALS_LIB) +AC_SUBST(BOOST_IOSTREAMS_LIB) AC_SUBST(BOOST_ASIO_LIB) AC_SUBST(BOOST_MPI_LIB) AC_SUBST(BOOST_MPI_PYTHON_LIB) @@ -504,6 +505,7 @@ test/boost/asio/logd/Makefile test/boost/asio/logger/Makefile test/boost/filesystem/Makefile + test/boost/iostreams/Makefile test/boost/mpi/Makefile test/boost/mpl/Makefile test/boost/spirit/Makefile @@ -609,6 +611,7 @@ o BOOST_FS_LIB .... : ${BOOST_FILESYSTEM_LIB} o BOOST_THRD_LIB .. : ${BOOST_THREAD_LIB} o BOOST_PY_LIB .... : ${BOOST_PYTHON_LIB} + o BOOST_IOSTR_LIB . : ${BOOST_IOSTREAMS_LIB} o BOOST_ASIO_LIB .. : ${BOOST_ASIO_LIB} o BOOST_SIG_LIB ... : ${BOOST_SIGNALS_LIB} o BOOST_MPI_LIB ... : ${BOOST_MPI_LIB} Property changes on: trunk/dsim/test/boost/iostreams ___________________________________________________________________ Added: svn:ignore + .deps .libs Makefile.in Makefile filereader Added: trunk/dsim/test/boost/iostreams/Makefile.am =================================================================== --- trunk/dsim/test/boost/iostreams/Makefile.am (rev 0) +++ trunk/dsim/test/boost/iostreams/Makefile.am 2010-02-28 01:18:59 UTC (rev 71) @@ -0,0 +1,17 @@ +## test/boost/iostreams sub-directory +include $(top_srcdir)/Makefile.common + +## +SUBDIRS = + +MAINTAINERCLEANFILES = Makefile.in + +EXTRA_DIST = + +# +check_PROGRAMS = filereader + +filereader_SOURCES = filereader.cpp +filereader_CXXFLAGS = $(BOOST_CFLAGS) $(BOOST_CFLAGS) +filereader_LDFLAGS = $(BOOST_LIBS) $(BOOST_ASIO_LIB) $(BOOST_IOSTREAMS_LIB) +filereader_LDADD = Added: trunk/dsim/test/boost/iostreams/filereader.cpp =================================================================== --- trunk/dsim/test/boost/iostreams/filereader.cpp (rev 0) +++ trunk/dsim/test/boost/iostreams/filereader.cpp 2010-02-28 01:18:59 UTC (rev 71) @@ -0,0 +1,46 @@ +// STL +#include <cassert> +#include <string> +#include <iostream> +#include <sstream> +#include <fstream> +#include <streambuf> +// Boost + + +// ////////////////// M A I N //////////////////////// +int main (int argc, char* argv[]) { + + // Input file name + const std::string lInputFilename ("filetoberead.csv"); + + // Open the input file + std::ifstream lInputFile (lInputFilename.c_str()); + + // Get a handler (pointer) on the underlying buffer stream + std::streambuf* lInputFileBuffer_ptr = lInputFile.rdbuf(); + + // Get the number of characters within the input file + const unsigned long nbChars = lInputFileBuffer_ptr->in_avail(); + + // DEBUG + std::cout << "Number of characters in the file '" << lInputFilename << "': " + << nbChars << std::endl; + + // Instantiate a character buffer for that number of characters + char lBufferChar[nbChars]; + + // Read that number of characters from the input file, and put it directly into the + // character buffer + lInputFileBuffer_ptr->sgetn (lBufferChar, nbChars); + + // Instantiate an input stream with the character buffer + std::istringstream iStr (lBufferChar); + // std::ostringstream iStr (lBufferChar); + + // DEBUG + // std::cout << "The file contains: " << iStr.str() << std::endl; + + return 0; +} + Added: trunk/dsim/test/boost/iostreams/filetoberead.csv =================================================================== --- trunk/dsim/test/boost/iostreams/filetoberead.csv (rev 0) +++ trunk/dsim/test/boost/iostreams/filetoberead.csv 2010-02-28 01:18:59 UTC (rev 71) @@ -0,0 +1,7 @@ +NCE,CDG,1 +NCE,ORY,1 +NCE,LYS,1 +NCE,MRS,1 +NCE,TLS,1 +NCE,SXB,1 +NCE,CFE,1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |