00001 #include "ace_pch.h"
00002
00003
00004 #include "ace/Service_Object.h"
00005
00006 #if !defined (__ACE_INLINE__)
00007 #include "ace/Service_Object.i"
00008 #endif
00009
00010 #include "ace/Service_Types.h"
00011 #include "ace/DLL.h"
00012
00013 ACE_RCSID(ace, Service_Object, "$Id: Service_Object.cpp,v 1.1.1.4.2.1 2003/03/13 19:44:22 chad Exp $")
00014
00015 ACE_ALLOC_HOOK_DEFINE(ACE_Service_Object)
00016 ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type)
00017
00018 void
00019 ACE_Service_Type::dump (void) const
00020 {
00021 ACE_TRACE ("ACE_Service_Type::dump");
00022 }
00023
00024 ACE_Service_Type::ACE_Service_Type (const ACE_TCHAR *n,
00025 ACE_Service_Type_Impl *t,
00026 const ACE_DLL &dll,
00027 int active)
00028 : name_ (0),
00029 type_ (t),
00030 dll_ (dll),
00031 active_ (active),
00032 fini_already_called_ (0)
00033 {
00034 ACE_TRACE ("ACE_Service_Type::ACE_Service_Type");
00035 this->name (n);
00036 }
00037
00038 ACE_Service_Type::~ACE_Service_Type (void)
00039 {
00040 ACE_TRACE ("ACE_Service_Type::~ACE_Service_Type");
00041
00042 this->fini ();
00043
00044 delete [] (ACE_TCHAR *) this->name_;
00045 }
00046
00047 int
00048 ACE_Service_Type::fini (void)
00049 {
00050 if (!this->fini_already_called_)
00051 {
00052 this->fini_already_called_ = 1;
00053 return this->type_->fini ();
00054 }
00055 return 0;
00056 }
00057
00058 int
00059 ACE_Service_Type::suspend (void) const
00060 {
00061 ACE_TRACE ("ACE_Service_Type::suspend");
00062 ((ACE_Service_Type *) this)->active_ = 0;
00063 return this->type_->suspend ();
00064 }
00065
00066 int
00067 ACE_Service_Type::resume (void) const
00068 {
00069 ACE_TRACE ("ACE_Service_Type::resume");
00070 ((ACE_Service_Type *) this)->active_ = 1;
00071 return this->type_->resume ();
00072 }
00073
00074 ACE_Service_Object::ACE_Service_Object (ACE_Reactor *r)
00075 : ACE_Event_Handler (r)
00076 {
00077 ACE_TRACE ("ACE_Service_Object::ACE_Service_Object");
00078 }
00079
00080 ACE_Service_Object::~ACE_Service_Object (void)
00081 {
00082 ACE_TRACE ("ACE_Service_Object::~ACE_Service_Object");
00083 }
00084
00085 int
00086 ACE_Service_Object::suspend (void)
00087 {
00088 ACE_TRACE ("ACE_Service_Object::suspend");
00089 return 0;
00090 }
00091
00092 int
00093 ACE_Service_Object::resume (void)
00094 {
00095 ACE_TRACE ("ACE_Service_Object::resume");
00096 return 0;
00097 }
00098
00099 void
00100 ACE_Service_Type::name (const ACE_TCHAR *n)
00101 {
00102 ACE_TRACE ("ACE_Service_Type::name");
00103
00104 delete [] (ACE_TCHAR *) this->name_;
00105 this->name_ = ACE::strnew (n);
00106 }