summaryrefslogtreecommitdiff
path: root/CIAO/ciao/Port_Activator_T.cpp
diff options
context:
space:
mode:
authorAbdullah Sowayan <sowayan@users.noreply.github.com>2007-03-18 22:23:37 +0000
committerAbdullah Sowayan <sowayan@users.noreply.github.com>2007-03-18 22:23:37 +0000
commit06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b (patch)
tree8815ce3b3a85c3c4285429295f338e00ea4497f4 /CIAO/ciao/Port_Activator_T.cpp
parentd66fcc9b4aaec8e88eeb83fc578fdf8a3cc963de (diff)
downloadATCD-06a34455bd98b1379cc69bbc5b2cf085e0fc0d9b.tar.gz
Diffstat (limited to 'CIAO/ciao/Port_Activator_T.cpp')
-rw-r--r--CIAO/ciao/Port_Activator_T.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/CIAO/ciao/Port_Activator_T.cpp b/CIAO/ciao/Port_Activator_T.cpp
new file mode 100644
index 00000000000..c32d80af942
--- /dev/null
+++ b/CIAO/ciao/Port_Activator_T.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#ifndef CIAO_PORT_ACTIVATOR_T_CPP
+#define CIAO_PORT_ACTIVATOR_T_CPP
+
+#include "Port_Activator_T.h"
+#include "tao/CORBA_String.h"
+
+#include "ace/OS_NS_string.h"
+
+
+namespace CIAO
+{
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::Port_Activator_T (
+ const char *oid,
+ const char *name,
+ Port_Activator::Type t,
+ EXEC *e,
+ CONTEXT *c,
+ COMP_SERV *cc)
+ : Port_Activator (oid, name, t)
+ , executor_ (e)
+ , context_ (c)
+ , comp_serv_ (cc)
+ {
+ }
+
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ void
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::deactivate (
+ const PortableServer::Servant servant)
+ {
+ SERVANT *s = dynamic_cast<SERVANT *> (servant);
+ s->_remove_ref ();
+ }
+
+ template <typename SERV,
+ typename EXEC,
+ typename CONTEXT,
+ typename COMP_SERV>
+ PortableServer::Servant
+ Port_Activator_T<SERV, EXEC, CONTEXT, COMP_SERV>::activate (
+ const PortableServer::ObjectId &oid)
+ {
+ CORBA::String_var str =
+ PortableServer::ObjectId_to_string (oid);
+
+ // An additional check, may not be necessary. Being on the safe
+ // side.
+ if (ACE_OS::strcmp (this->oid_.in (), str.in ()) == 0)
+ {
+ if (this->executor_ == 0 && this->t_ == Port_Activator::Facet)
+ {
+ CORBA::Object_var tmp =
+ this->comp_serv_->get_facet_executor (this->name_.in ());
+
+ this->executor_ = EXEC::_narrow (tmp.in ());
+ }
+
+ SERVANT *s = 0;
+
+ ACE_NEW_THROW_EX (s,
+ SERVANT (this->executor_,
+ this->context_),
+ CORBA::NO_MEMORY ());
+ return s;
+ }
+
+ throw CORBA::OBJECT_NOT_EXIST ();
+ }
+}
+
+#endif /*SERVANT_ACTIVATOR_T_CPP*/