diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-06-08 18:48:35 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2000-06-08 18:48:35 +0000 |
commit | 5c4a1556e3b7afb9506aa88a4ba420e4f64b7e6b (patch) | |
tree | a7dfcb5e5b0373ec0802370684b427eeca72f911 | |
parent | 9ba0caee9b998926915e3bc5d89dc917e00a68eb (diff) | |
download | ATCD-5c4a1556e3b7afb9506aa88a4ba420e4f64b7e6b.tar.gz |
ChangeLogTag:Thu Jun 8 13:00:38 2000 Toshio Hori <toshi@etl.go.jp>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 6 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 6 | ||||
-rw-r--r-- | THANKS | 2 | ||||
-rw-r--r-- | ace/Stream.cpp | 87 | ||||
-rw-r--r-- | ace/Stream.h | 9 |
6 files changed, 115 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog index 11c479b9d99..a01658e9716 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 8 13:00:38 2000 Toshio Hori <toshi@etl.go.jp> + + * ace/Stream.h (class ACE_Stream): Added support for an insert() + and replace() to make it easier to insert and update the + contents of an ACE_Stream. + Thu Jun 8 09:52:36 2000 Joe Hoffert <joeh@cs.wustl.edu> * bin/pace_components: diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 11c479b9d99..a01658e9716 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,9 @@ +Thu Jun 8 13:00:38 2000 Toshio Hori <toshi@etl.go.jp> + + * ace/Stream.h (class ACE_Stream): Added support for an insert() + and replace() to make it easier to insert and update the + contents of an ACE_Stream. + Thu Jun 8 09:52:36 2000 Joe Hoffert <joeh@cs.wustl.edu> * bin/pace_components: diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 11c479b9d99..a01658e9716 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,9 @@ +Thu Jun 8 13:00:38 2000 Toshio Hori <toshi@etl.go.jp> + + * ace/Stream.h (class ACE_Stream): Added support for an insert() + and replace() to make it easier to insert and update the + contents of an ACE_Stream. + Thu Jun 8 09:52:36 2000 Joe Hoffert <joeh@cs.wustl.edu> * bin/pace_components: @@ -506,7 +506,7 @@ Keith Brown <kalbrown@ix.netcom.com> Barry Hoggard <hoggard@cfx.com> Peter J. Mason <peterm@fl.net.au> Jerry D. De Master <jdemaste@rite-solutions.com> -Greg Gallant <gcg@intercap.com> +Greg Gallant <gcg@micrografx.com> wym <wym@dekang.com> Karel Zuiderveld <kzuiderveld@vitalimages.com> Mike Goldman <whig@by.net> diff --git a/ace/Stream.cpp b/ace/Stream.cpp index 3e5b138a98a..09a3cc25f76 100644 --- a/ace/Stream.cpp +++ b/ace/Stream.cpp @@ -110,6 +110,93 @@ ACE_Stream<ACE_SYNCH_USE>::top (ACE_Module<ACE_SYNCH_USE> *&m) } } +template <ACE_SYNCH_DECL> int +ACE_Stream<ACE_SYNCH_USE>::insert (const ACE_TCHAR *prev_name, + ACE_Module<ACE_SYNCH_USE> *mod) +{ + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::insert"); + + for (ACE_Module<ACE_SYNCH_USE> *prev_mod = this->stream_head_; + prev_mod != 0; + prev_mod = prev_mod->next ()) + if (ACE_OS::strcmp (prev_mod->name (), prev_name) == 0) + { + ACE_Module<ACE_SYNCH_USE> *next_mod = prev_mod->next (); + ACE_Task<ACE_SYNCH_USE> *m_reader = mod->reader (); + ACE_Task<ACE_SYNCH_USE> *m_writer = mod->writer (); + + next_mod->reader ()->next (m_reader); + m_writer->next (next_mod->writer ()); + + prev_mod->next (mod); + prev_mod->writer ()->next (m_writer); + m_reader->next (prev_mod->reader ()); + + mod->next (next_mod); + + if (m_reader->open (mod->arg ()) == -1) + return -1; + + if (m_writer->open (mod->arg ()) == -1) + return -1; + + return 0; + } + + return -1; +} + +template <ACE_SYNCH_DECL> int +ACE_Stream<ACE_SYNCH_USE>::replace (const ACE_TCHAR *replace_name, + ACE_Module<ACE_SYNCH_USE> *mod, + int flags) +{ + ACE_TRACE ("ACE_Stream<ACE_SYNCH_USE>::replace"); + ACE_Module<ACE_SYNCH_USE> *prev_mod = 0; + + for (ACE_Module<ACE_SYNCH_USE> *rep_mod = this->stream_head_; + rep_mod != 0; + rep_mod = rep_mod->next ()) + if (ACE_OS::strcmp (rep_mod->name (), replace_name) == 0) + { + if (prev_mod == 0) // Do you want to replace <stream_head_>? + return -1; // Might be modified? + else + { + ACE_Module<ACE_SYNCH_USE> *next_mod = rep_mod->next (); + ACE_Task<ACE_SYNCH_USE> *m_reader = mod->reader (); + ACE_Task<ACE_SYNCH_USE> *m_writer = mod->writer (); + + next_mod->reader ()->next (m_reader); + m_writer->next (next_mod->writer ()); + + prev_mod->next (mod); + prev_mod->writer ()->next (m_writer); + m_reader->next (prev_mod->reader ()); + + mod->next (next_mod); + + if (m_reader->open (mod->arg ()) == -1) + return -1; + + if (m_writer->open (mod->arg ()) == -1) + return -1; + } + + if (flags != ACE_Module<ACE_SYNCH_USE>::M_DELETE_NONE) + { + rep_mod->close (flags); + delete rep_mod; + } + + return 0; + } + else + prev_mod = rep_mod; + + return -1; +} + // Remove the "top" ACE_Module in a ACE_Stream, skipping over the // stream_head. diff --git a/ace/Stream.h b/ace/Stream.h index a2839fb11be..20b5b8b6869 100644 --- a/ace/Stream.h +++ b/ace/Stream.h @@ -92,6 +92,15 @@ public: // Return the top module on the stream (right below the stream // head). + virtual int insert (const ACE_TCHAR *prev_name, + ACE_Module<ACE_SYNCH_USE> *mod); + // Insert a new module <mod> below the named module <prev_name>. + + virtual int replace (const ACE_TCHAR *replace_name, + ACE_Module<ACE_SYNCH_USE> *mod, + int flags = M_DELETE); + // Replace the named module <replace_name> with a new module <mod>. + virtual int remove (const ACE_TCHAR *mod, int flags = M_DELETE); // Remove the named module <mod> from the stream. This bypasses the |