Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / Smart_Pointers / Gadget.h
bloba6150d152bcae8aed851cd513b39b0d726e26653
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Gadget.h
6 * @author Christopher Kohlhoff <chris@kohlhoff.com>
7 */
8 //=============================================================================
10 #ifndef GADGET_H
11 #define GADGET_H
13 #include "ace/Bound_Ptr.h"
14 #include "Gadget_Part.h"
16 /**
17 * @class Gadget
19 * @brief An interface for some high-level application object.
21 class Gadget
23 public:
24 /// Destructor.
25 virtual ~Gadget ();
27 /// Add a new part to the gadget. The gadget automatically takes shared
28 /// responsibility for the ownership of the part object since we are passing
29 /// a Gadget_Part_var.
30 virtual void add_part (Gadget_Part_var part) = 0;
32 /// Remove a random part from the gadget. Responsibility for ownership of the
33 /// part is automatically returned to the caller since we are returning a
34 /// Gadget_Part_var.
35 virtual Gadget_Part_var remove_part () = 0;
37 /// Ask the gadget to print information about the parts that it contains.
38 virtual void list_parts () = 0;
41 // The Gadget_var smart pointer has shared (reference counted) ownership
42 // semantics.
43 typedef ACE_Strong_Bound_Ptr<Gadget, ACE_SYNCH_MUTEX> Gadget_var;
45 // The Gadget_ptr smart pointer has no ownership semantics, but supports
46 // conversion back into a Gadget_var.
47 typedef ACE_Weak_Bound_Ptr<Gadget, ACE_SYNCH_MUTEX> Gadget_ptr;
49 #endif /* GADGET_H */