2 //=============================================================================
4 * @file gadget_test.cpp
6 * @author Christopher Kohlhoff <chris@kohlhoff.com>
8 //=============================================================================
10 #include "ace/Refcounted_Auto_Ptr.h"
11 #include "ace/Unbounded_Queue.h"
13 #include "Gadget_Factory.h"
14 #include "Gadget_Part.h"
15 #include "Gadget_Part_Factory.h"
18 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
20 ACE_UNUSED_ARG (argc
);
21 ACE_UNUSED_ARG (argv
);
23 Gadget_var g1
= Gadget_Factory::create_gadget ();
24 g1
->add_part (Gadget_Part_Factory::create_gadget_part (g1
, "part1", 1));
25 g1
->add_part (Gadget_Part_Factory::create_gadget_part (g1
, "part2", 2));
26 g1
->add_part (Gadget_Part_Factory::create_gadget_part (g1
, "part3", 3));
30 Gadget_Part_var p1
= g1
->remove_part ();
33 // Oops, we forgot to collect the return value! No worries, the temporary
34 // Gadget_var returned by the function call will clean it up automatically.
39 Gadget_var g2
= Gadget_Factory::create_gadget ();
40 g2
->add_part (Gadget_Part_Factory::create_gadget_part (g2
, "part4", 4));
41 Gadget_Part_var p2
= Gadget_Part_Factory::create_gadget_part (g2
, "part5", 5);
43 p2
->remove_from_owner ();