diff options
Diffstat (limited to 'ACE/examples/Smart_Pointers/Gadget_Impl.cpp')
-rw-r--r-- | ACE/examples/Smart_Pointers/Gadget_Impl.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ACE/examples/Smart_Pointers/Gadget_Impl.cpp b/ACE/examples/Smart_Pointers/Gadget_Impl.cpp new file mode 100644 index 00000000000..03dd94f8838 --- /dev/null +++ b/ACE/examples/Smart_Pointers/Gadget_Impl.cpp @@ -0,0 +1,47 @@ +/* -*- C++ -*- */ +//============================================================================= +/** + * @file Gadget_Impl.cpp + * + * $Id$ + * + * @author Christopher Kohlhoff <chris@kohlhoff.com> + */ +//============================================================================= + +#include "Gadget_Impl.h" +#include "ace/Log_Msg.h" + +Gadget_Impl::Gadget_Impl (void) +{ + ACE_DEBUG ((LM_DEBUG, "Gadget_Impl constructor\n")); +} + +Gadget_Impl::~Gadget_Impl (void) +{ + ACE_DEBUG ((LM_DEBUG, "Gadget_Impl destructor\n")); +} + +void Gadget_Impl::add_part (Gadget_Part_var part) +{ + parts_.enqueue_tail (part); +} + +Gadget_Part_var Gadget_Impl::remove_part (void) +{ + Gadget_Part_var removed_part; + if (parts_.dequeue_head (removed_part) == -1) + return Gadget_Part_var(); + return removed_part; +} + +void Gadget_Impl::list_parts (void) +{ + ACE_Unbounded_Queue_Iterator<Gadget_Part_var> iter (parts_); + Gadget_Part_var *current_part; + while (iter.next (current_part)) + { + (*current_part)->print_info (); + iter.advance (); + } +} |