summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-12 22:24:16 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-03-12 22:24:16 +0000
commit1f3d74b1f74b99c28c6c9d4c400f4dcc4b2ab5de (patch)
treecd8c138ddb7ace6cf73e717ca3bbdaea22271bea /TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
parent15a6a0e300ef452aee7d7be94b9533e838b95c59 (diff)
downloadATCD-1f3d74b1f74b99c28c6c9d4c400f4dcc4b2ab5de.tar.gz
Added the new Nestea Bookshelf test.
Diffstat (limited to 'TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp')
-rw-r--r--TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp105
1 files changed, 105 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp b/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
new file mode 100644
index 00000000000..f3a3e842654
--- /dev/null
+++ b/TAO/orbsvcs/tests/ImplRepo/nestea_i.cpp
@@ -0,0 +1,105 @@
+// $Id$
+
+#include "time.h"
+#include "nestea_i.h"
+#include "tao/corba.h"
+
+ACE_RCSID(ImplRepo, nestea_i, "$Id$")
+
+// Constructor
+
+Nestea_i::Nestea_i (int shutdown)
+: shutdown_ (shutdown),
+ cans_ (0)
+{
+}
+
+
+// Destructor
+
+Nestea_i::~Nestea_i (void)
+{
+ // Nothing
+}
+
+
+// Add <cans> number of cans to the bookshelf.
+
+void
+Nestea_i::drink (CORBA::Long cans,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::drink %d cans\n", cans));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ this->cans_ += cans;
+}
+
+
+// Removes <cans> number of cans from the bookshelf.
+
+void
+Nestea_i::crush (CORBA::Long cans,
+ CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::crush %d cans\n", cans));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ this->cans_ -= cans;
+
+ // Don't go below 0.
+ if (this->cans_ < 0)
+ this->cans_ = 0;
+}
+
+
+// Returns the number of cans in the bookshelf.
+
+CORBA::Long
+Nestea_i::bookshelf_size (CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::bookshelf_size\n"));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ return this->cans_;
+}
+
+// Returns comments about your collection.
+
+char *
+Nestea_i::get_praise (CORBA::Environment &ACE_TRY_ENV)
+{
+ ACE_UNUSED_ARG (ACE_TRY_ENV);
+
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG, "Nestea_i::get_praise\n"));
+
+ if (this->shutdown_ != 0)
+ TAO_ORB_Core_instance ()->orb ()->shutdown ();
+
+ if (this->cans_ > 500)
+ return CORBA::string_dup ("Man, that is one excellent Nestea Collection!");
+ else if (this->cans_ > 250)
+ return CORBA::string_dup ("We are getting into the big leagues now!");
+ else if (this->cans_ > 100)
+ return CORBA::string_dup ("Things are looking up!");
+ else if (this->cans_ > 0)
+ return CORBA::string_dup ("Well, it is a start. Drink more Nestea!");
+ else
+ return CORBA::string_dup ("No cans, no praise.");
+}