|
From: <br...@us...> - 2009-03-19 06:38:55
|
Revision: 3851
http://openvrml.svn.sourceforge.net/openvrml/?rev=3851&view=rev
Author: braden
Date: 2009-03-19 06:38:39 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Moved bounded_buffer to the implementation of openvrml_control::browser.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/libopenvrml-control/openvrml_control/browser.cpp
Removed Paths:
-------------
trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/ChangeLog 2009-03-19 06:38:39 UTC (rev 3851)
@@ -1,5 +1,21 @@
2009-03-19 Braden McDaniel <br...@en...>
+ Moved bounded_buffer to the implementation of
+ openvrml_control::browser.
+
+ * src/Makefile.am
+ (libopenvrml_control_libopenvrml_control_la_SOURCES): Removed
+ reference to
+ libopenvrml-control/openvrml_control/bounded_buffer.h.
+ * src/libopenvrml-control/openvrml_control/bounded_buffer.h:
+ Removed.
+ * src/libopenvrml-control/openvrml_control/browser.cpp: Moved
+ bounded_buffer from
+ src/libopenvrml-control/openvrml_control/bounded_buffer.h to an
+ unnamed namespace here.
+
+2009-03-19 Braden McDaniel <br...@en...>
+
Moved plugin_streambuf, uninitialized_plugin_streambuf_map, and
plugin_streambuf_map to be private member classes of
openvrml_control::browser.
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/Makefile.am 2009-03-19 06:38:39 UTC (rev 3851)
@@ -730,8 +730,7 @@
endif
libopenvrml_control_libopenvrml_control_la_SOURCES = \
libopenvrml-control/openvrml_control/browser.cpp \
- libopenvrml-control/openvrml_control/browser.h \
- libopenvrml-control/openvrml_control/bounded_buffer.h
+ libopenvrml-control/openvrml_control/browser.h
libopenvrml_control_libopenvrml_control_la_CPPFLAGS = \
-I$(top_builddir)/src/libopenvrml \
-I$(top_srcdir)/src/libopenvrml
Deleted: trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/libopenvrml-control/openvrml_control/bounded_buffer.h 2009-03-19 06:38:39 UTC (rev 3851)
@@ -1,116 +0,0 @@
-// -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 78 -*-
-//
-// OpenVRML Control
-//
-// Copyright 2004, 2005, 2006, 2007 Braden McDaniel
-//
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by the Free
-// Software Foundation; either version 3 of the License, or (at your option)
-// any later version.
-//
-// This program is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
-// more details.
-//
-// You should have received a copy of the GNU General Public License along
-// with this library; if not, see <http://www.gnu.org/licenses/>.
-//
-
-# ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
-# define OPENVRML_CONTROL_BOUNDED_BUFFER_H
-
-# include <cassert>
-# include <string>
-# include <boost/thread/mutex.hpp>
-# include <boost/thread/condition.hpp>
-
-namespace openvrml_control {
-
- template <typename CharT, size_t BufferSize>
- class bounded_buffer {
- mutable boost::mutex mutex_;
- boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
-
- CharT buf_[BufferSize];
- size_t begin_, end_, buffered_;
- bool eof_;
-
- public:
- typedef CharT char_type;
- typedef typename std::char_traits<char_type> traits_type;
- typedef typename traits_type::int_type int_type;
-
- bounded_buffer();
- void put(const char_type & c);
- int_type get();
- size_t buffered() const;
- void set_eof();
- bool eof() const;
- };
-
- template <typename CharT, size_t BufferSize>
- bounded_buffer<CharT, BufferSize>::bounded_buffer():
- begin_(0),
- end_(0),
- buffered_(0),
- eof_(false)
- {}
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == BufferSize) {
- this->buffer_not_full_.wait(lock);
- }
- this->buf_[this->end_] = c;
- this->end_ = (this->end_ + 1) % BufferSize;
- ++this->buffered_;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- typename bounded_buffer<CharT, BufferSize>::int_type
- bounded_buffer<CharT, BufferSize>::get()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- while (this->buffered_ == 0 && !this->eof_) {
- this->buffer_not_empty_or_eof_.wait(lock);
- }
- if (this->buffered_ == 0 && this->eof_) {
- return traits_type::eof();
- }
- const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
- this->begin_ = (this->begin_ + 1) % BufferSize;
- --this->buffered_;
- this->buffer_not_full_.notify_one();
- assert(!traits_type::eq_int_type(c, traits_type::eof()));
- return c;
- }
-
- template <typename CharT, size_t BufferSize>
- size_t bounded_buffer<CharT, BufferSize>::buffered() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->buffered_;
- }
-
- template <typename CharT, size_t BufferSize>
- void bounded_buffer<CharT, BufferSize>::set_eof()
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- this->eof_ = true;
- this->buffer_not_empty_or_eof_.notify_one();
- }
-
- template <typename CharT, size_t BufferSize>
- bool bounded_buffer<CharT, BufferSize>::eof() const
- {
- boost::mutex::scoped_lock lock(this->mutex_);
- return this->eof_;
- }
-}
-
-# endif // ifndef OPENVRML_CONTROL_BOUNDED_BUFFER_H
Modified: trunk/src/libopenvrml-control/openvrml_control/browser.cpp
===================================================================
--- trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 06:30:11 UTC (rev 3850)
+++ trunk/src/libopenvrml-control/openvrml_control/browser.cpp 2009-03-19 06:38:39 UTC (rev 3851)
@@ -19,7 +19,6 @@
//
# include "browser.h"
-# include "bounded_buffer.h"
# include <boost/enable_shared_from_this.hpp>
# include <boost/lexical_cast.hpp>
# include <iostream>
@@ -79,6 +78,93 @@
// plugin_streambuf is removed, the plugin_streambuf is deleted.
//
+namespace {
+
+ template <typename CharT, size_t BufferSize>
+ class bounded_buffer {
+ mutable boost::mutex mutex_;
+ boost::condition buffer_not_full_, buffer_not_empty_or_eof_;
+
+ CharT buf_[BufferSize];
+ size_t begin_, end_, buffered_;
+ bool eof_;
+
+ public:
+ typedef CharT char_type;
+ typedef typename std::char_traits<char_type> traits_type;
+ typedef typename traits_type::int_type int_type;
+
+ bounded_buffer();
+ void put(const char_type & c);
+ int_type get();
+ size_t buffered() const;
+ void set_eof();
+ bool eof() const;
+ };
+
+ template <typename CharT, size_t BufferSize>
+ bounded_buffer<CharT, BufferSize>::bounded_buffer():
+ begin_(0),
+ end_(0),
+ buffered_(0),
+ eof_(false)
+ {}
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::put(const char_type & c)
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == BufferSize) {
+ this->buffer_not_full_.wait(lock);
+ }
+ this->buf_[this->end_] = c;
+ this->end_ = (this->end_ + 1) % BufferSize;
+ ++this->buffered_;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ typename bounded_buffer<CharT, BufferSize>::int_type
+ bounded_buffer<CharT, BufferSize>::get()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ while (this->buffered_ == 0 && !this->eof_) {
+ this->buffer_not_empty_or_eof_.wait(lock);
+ }
+ if (this->buffered_ == 0 && this->eof_) {
+ return traits_type::eof();
+ }
+ const int_type c = traits_type::to_int_type(this->buf_[this->begin_]);
+ this->begin_ = (this->begin_ + 1) % BufferSize;
+ --this->buffered_;
+ this->buffer_not_full_.notify_one();
+ assert(!traits_type::eq_int_type(c, traits_type::eof()));
+ return c;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ size_t bounded_buffer<CharT, BufferSize>::buffered() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->buffered_;
+ }
+
+ template <typename CharT, size_t BufferSize>
+ void bounded_buffer<CharT, BufferSize>::set_eof()
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ this->eof_ = true;
+ this->buffer_not_empty_or_eof_.notify_one();
+ }
+
+ template <typename CharT, size_t BufferSize>
+ bool bounded_buffer<CharT, BufferSize>::eof() const
+ {
+ boost::mutex::scoped_lock lock(this->mutex_);
+ return this->eof_;
+ }
+}
+
class OPENVRML_LOCAL openvrml_control::browser::plugin_streambuf :
public boost::enable_shared_from_this<
openvrml_control::browser::plugin_streambuf>,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|