00001 #include "ace/Parse_Node.h"
00002
00003 #if (ACE_USES_CLASSIC_SVC_CONF == 1)
00004
00005 #include "ace/Service_Config.h"
00006 #include "ace/Service_Repository.h"
00007 #include "ace/Service_Types.h"
00008 #include "ace/Task.h"
00009 #include "ace/DLL.h"
00010 #include "ace/ACE.h"
00011 #include "ace/OS_NS_string.h"
00012
00013 ACE_RCSID (ace,
00014 Parse_Node,
00015 "Parse_Node.cpp,v 4.85 2006/05/30 11:38:44 jwillemsen Exp")
00016
00017
00018 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020 ACE_ALLOC_HOOK_DEFINE (ACE_Stream_Node)
00021
00022
00023
00024
00025 void
00026 ACE_Stream_Node::dump (void) const
00027 {
00028 #if defined (ACE_HAS_DUMP)
00029 ACE_TRACE ("ACE_Stream_Node::dump");
00030 #endif
00031 }
00032
00033 void
00034 ACE_Stream_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00035 {
00036 ACE_TRACE ("ACE_Stream_Node::apply");
00037
00038 if (config->initialize (this->node_->record (config),
00039 this->node_->parameters ()) == -1)
00040 ++yyerrno;
00041
00042 #ifndef ACE_NLOGGING
00043 if (ACE::debug ())
00044 ACE_DEBUG ((LM_DEBUG,
00045 ACE_LIB_TEXT ("(%P|%t) Did stream on %s, error = %d\n"),
00046 this->node_->name (),
00047 yyerrno));
00048 #endif
00049 }
00050
00051 ACE_ALLOC_HOOK_DEFINE (ACE_Parse_Node)
00052
00053 void
00054 ACE_Parse_Node::dump (void) const
00055 {
00056 #if defined (ACE_HAS_DUMP)
00057 ACE_TRACE ("ACE_Parse_Node::dump");
00058 #endif
00059 }
00060
00061 const ACE_TCHAR *
00062 ACE_Parse_Node::name (void) const
00063 {
00064 ACE_TRACE ("ACE_Parse_Node::name");
00065 return this->name_;
00066 }
00067
00068 ACE_Parse_Node *
00069 ACE_Parse_Node::link (void) const
00070 {
00071 ACE_TRACE ("ACE_Parse_Node::link");
00072 return this->next_;
00073 }
00074
00075 void
00076 ACE_Parse_Node::link (ACE_Parse_Node *n)
00077 {
00078 ACE_TRACE ("ACE_Parse_Node::link");
00079 this->next_ = n;
00080 }
00081
00082 ACE_Stream_Node::ACE_Stream_Node (const ACE_Static_Node *str_ops,
00083 const ACE_Parse_Node *str_mods)
00084 : ACE_Parse_Node ((str_ops == 0 ? ACE_LIB_TEXT ("<unknown>") : str_ops->name ())),
00085 node_ (str_ops),
00086 mods_ (str_mods)
00087 {
00088 ACE_TRACE ("ACE_Stream_Node::ACE_Stream_Node");
00089 }
00090
00091
00092 ACE_Stream_Node::~ACE_Stream_Node (void)
00093 {
00094 ACE_TRACE ("ACE_Stream_Node::~ACE_Stream_Node");
00095 ACE_Static_Node *n = const_cast<ACE_Static_Node *> (this->node_);
00096 delete n;
00097 ACE_Parse_Node *m = const_cast<ACE_Parse_Node *> (this->mods_);
00098 delete m;
00099 }
00100
00101 ACE_Parse_Node::ACE_Parse_Node (void)
00102 : name_ (0),
00103 next_ (0)
00104 {
00105 ACE_TRACE ("ACE_Parse_Node::ACE_Parse_Node");
00106 }
00107
00108
00109 ACE_Parse_Node::ACE_Parse_Node (const ACE_TCHAR *nm)
00110 : name_ (ACE::strnew (nm)),
00111 next_ (0)
00112 {
00113 ACE_TRACE ("ACE_Parse_Node::ACE_Parse_Node");
00114 }
00115
00116 void
00117 ACE_Parse_Node::print (void) const
00118 {
00119 ACE_TRACE ("ACE_Parse_Node::print");
00120
00121 ACE_DEBUG ((LM_DEBUG,
00122 ACE_LIB_TEXT ("svc = %s\n"),
00123 this->name ()));
00124
00125 if (this->next_)
00126 this->next_->print ();
00127 }
00128
00129
00130 ACE_Parse_Node::~ACE_Parse_Node (void)
00131 {
00132 ACE_TRACE ("ACE_Parse_Node::~ACE_Parse_Node");
00133 delete[] const_cast<ACE_TCHAR*> (this->name_);
00134 delete this->next_;
00135 }
00136
00137 ACE_ALLOC_HOOK_DEFINE (ACE_Suspend_Node)
00138
00139 void
00140 ACE_Suspend_Node::dump (void) const
00141 {
00142 #if defined (ACE_HAS_DUMP)
00143 ACE_TRACE ("ACE_Suspend_Node::dump");
00144 #endif
00145 }
00146
00147 ACE_Suspend_Node::ACE_Suspend_Node (const ACE_TCHAR *name)
00148 : ACE_Parse_Node (name)
00149 {
00150 ACE_TRACE ("ACE_Suspend_Node::ACE_Suspend_Node");
00151 }
00152
00153 ACE_Suspend_Node::~ACE_Suspend_Node (void)
00154 {
00155 }
00156
00157 ACE_ALLOC_HOOK_DEFINE (ACE_Resume_Node)
00158
00159 void
00160 ACE_Resume_Node::dump (void) const
00161 {
00162 #if defined (ACE_HAS_DUMP)
00163 ACE_TRACE ("ACE_Resume_Node::dump");
00164 #endif
00165 }
00166
00167 ACE_Resume_Node::ACE_Resume_Node (const ACE_TCHAR *name)
00168 : ACE_Parse_Node (name)
00169 {
00170 ACE_TRACE ("ACE_Resume_Node::ACE_Resume_Node");
00171 }
00172
00173 ACE_Resume_Node::~ACE_Resume_Node (void)
00174 {
00175 }
00176
00177 void
00178 ACE_Suspend_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00179 {
00180 ACE_TRACE ("ACE_Suspend_Node::apply");
00181
00182 if (config->suspend (this->name ()) == -1)
00183 ++yyerrno;
00184
00185 #ifndef ACE_NLOGGING
00186 if (ACE::debug ())
00187 ACE_DEBUG ((LM_DEBUG,
00188 ACE_LIB_TEXT ("did suspend on %s, error = %d\n"),
00189 this->name (),
00190 yyerrno));
00191 #endif
00192 }
00193
00194 void
00195 ACE_Resume_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00196 {
00197 ACE_TRACE ("ACE_Resume_Node::apply");
00198
00199 if (config->resume (this->name ()) == -1)
00200 ++yyerrno;
00201
00202 #ifndef ACE_NLOGGING
00203 if (ACE::debug ())
00204 ACE_DEBUG ((LM_DEBUG,
00205 ACE_LIB_TEXT ("did resume on %s, error = %d\n"),
00206 this->name (),
00207 yyerrno));
00208 #endif
00209 }
00210
00211 ACE_ALLOC_HOOK_DEFINE (ACE_Remove_Node)
00212
00213 void
00214 ACE_Remove_Node::dump (void) const
00215 {
00216 #if defined (ACE_HAS_DUMP)
00217 ACE_TRACE ("ACE_Remove_Node::dump");
00218 #endif
00219 }
00220
00221 ACE_Remove_Node::ACE_Remove_Node (const ACE_TCHAR *name)
00222 : ACE_Parse_Node (name)
00223 {
00224 ACE_TRACE ("ACE_Remove_Node::ACE_Remove_Node");
00225 }
00226
00227 ACE_Remove_Node::~ACE_Remove_Node (void)
00228 {
00229 }
00230
00231 void
00232 ACE_Remove_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00233 {
00234 ACE_TRACE ("ACE_Remove_Node::apply");
00235
00236 if (config->remove (this->name ()) == -1)
00237 ++yyerrno;
00238
00239 #ifndef ACE_NLOGGING
00240 if (ACE::debug ())
00241 ACE_DEBUG ((LM_DEBUG,
00242 ACE_LIB_TEXT ("(%P|%t) ACE_Remove_Node::apply")
00243 ACE_LIB_TEXT (" - did remove on %s, error = %d\n"),
00244 this->name (),
00245 yyerrno));
00246 #endif
00247 }
00248
00249
00250 ACE_Dynamic_Node::ACE_Dynamic_Node (ACE_Service_Type_Factory const *stf,
00251 ACE_TCHAR *parms)
00252 : ACE_Static_Node (stf->name (), parms)
00253 , factory_ (stf)
00254 {
00255 ACE_TRACE ("ACE_Dynamic_Node::ACE_Dynamic_Node");
00256 }
00257
00258 void
00259 ACE_Dynamic_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00260 {
00261 ACE_TRACE ("ACE_Dynamic_Node::apply");
00262
00263 if (config->initialize (this->factory_.get (),
00264 this->parameters ()) == -1)
00265 ++yyerrno;
00266
00267 #ifndef ACE_NLOGGING
00268 if (ACE::debug ())
00269 ACE_DEBUG ((LM_DEBUG,
00270 ACE_LIB_TEXT ("(%P|%t) ACE_Dynamic_Node::apply")
00271 ACE_LIB_TEXT (" - did dynamic on %s, error = %d\n"),
00272 this->name (),
00273 yyerrno));
00274 #endif
00275 }
00276
00277 ACE_ALLOC_HOOK_DEFINE (ACE_Dynamic_Node)
00278
00279 void
00280 ACE_Dynamic_Node::dump (void) const
00281 {
00282 #if defined (ACE_HAS_DUMP)
00283 ACE_TRACE ("ACE_Dynamic_Node::dump");
00284 #endif
00285 }
00286
00287 ACE_Dynamic_Node::~ACE_Dynamic_Node (void)
00288 {
00289 ACE_TRACE ("ACE_Dynamic_Node::~ACE_Dynamic_Node");
00290 }
00291
00292 ACE_ALLOC_HOOK_DEFINE (ACE_Static_Node)
00293
00294 void
00295 ACE_Static_Node::dump (void) const
00296 {
00297 #if defined (ACE_HAS_DUMP)
00298 ACE_TRACE ("ACE_Static_Node::dump");
00299 #endif
00300 }
00301
00302 ACE_Static_Node::ACE_Static_Node (const ACE_TCHAR *nm,
00303 ACE_TCHAR *params)
00304 : ACE_Parse_Node (nm),
00305 parameters_ (ACE::strnew (params))
00306 {
00307 ACE_TRACE ("ACE_Static_Node::ACE_Static_Node");
00308 }
00309
00310 const ACE_Service_Type *
00311 ACE_Static_Node::record (const ACE_Service_Gestalt *config) const
00312 {
00313 ACE_TRACE ("ACE_Static_Node::record");
00314 ACE_Service_Type *sr = 0;
00315
00316 if (config->find (this->name (), (const ACE_Service_Type **) &sr) == -1)
00317 return 0;
00318
00319 return sr;
00320 }
00321
00322 ACE_TCHAR *
00323 ACE_Static_Node::parameters (void) const
00324 {
00325 ACE_TRACE ("ACE_Static_Node::parameters");
00326 return this->parameters_;
00327 }
00328
00329 void
00330 ACE_Static_Node::apply (ACE_Service_Gestalt *config, int &yyerrno)
00331 {
00332 ACE_TRACE ("ACE_Static_Node::apply");
00333 if (config->initialize (this->name (),
00334 this->parameters ()) == -1)
00335 ++yyerrno;
00336
00337 #ifndef ACE_NLOGGING
00338 if (ACE::debug ())
00339 ACE_DEBUG ((LM_DEBUG,
00340 ACE_LIB_TEXT ("did static on %s, error = %d\n"),
00341 this->name (),
00342 yyerrno));
00343 #endif
00344 }
00345
00346 ACE_Static_Node::~ACE_Static_Node (void)
00347 {
00348 ACE_TRACE ("ACE_Static_Node::~ACE_Static_Node");
00349 delete[] this->parameters_;
00350 }
00351
00352
00353 ACE_ALLOC_HOOK_DEFINE (ACE_Location_Node)
00354
00355 void
00356 ACE_Location_Node::dump (void) const
00357 {
00358 #if defined (ACE_HAS_DUMP)
00359 ACE_TRACE ("ACE_Location_Node::dump");
00360 #endif
00361 }
00362
00363 ACE_Location_Node::ACE_Location_Node (void)
00364 : pathname_ (0),
00365 dll_ (),
00366 symbol_ (0)
00367 {
00368 ACE_TRACE ("ACE_Location_Node::ACE_Location_Node");
00369 }
00370
00371 ACE_Location_Node::~ACE_Location_Node (void)
00372 {
00373 ACE_TRACE ("ACE_Location_Node::~ACE_Location_Node");
00374 }
00375
00376 const ACE_DLL &
00377 ACE_Location_Node::dll (void)
00378 {
00379 return this->dll_;
00380 }
00381
00382 const ACE_TCHAR *
00383 ACE_Location_Node::pathname (void) const
00384 {
00385 ACE_TRACE ("ACE_Location_Node::pathname");
00386 return this->pathname_;
00387 }
00388
00389 void
00390 ACE_Location_Node::pathname (const ACE_TCHAR *p)
00391 {
00392 ACE_TRACE ("ACE_Location_Node::pathname");
00393 this->pathname_ = p;
00394 }
00395
00396 int
00397 ACE_Location_Node::dispose (void) const
00398 {
00399 ACE_TRACE ("ACE_Location_Node::dispose");
00400 return this->must_delete_;
00401 }
00402
00403 int
00404 ACE_Location_Node::open_dll (int & yyerrno)
00405 {
00406 ACE_TRACE ("ACE_Location_Node::open_dll");
00407
00408 #ifndef ACE_NLOGGING
00409 if (ACE::debug ())
00410 ACE_DEBUG ((LM_DEBUG,
00411 ACE_LIB_TEXT ("(%P|%t) LN::open_dll - path=%s\n"),
00412 this->pathname ()));
00413 #endif
00414
00415 if (-1 == this->dll_.open (this->pathname ()))
00416 {
00417 ++yyerrno;
00418
00419 #ifndef ACE_NLOGGING
00420 ACE_TCHAR *errmsg = this->dll_.error ();
00421 ACE_ERROR ((LM_ERROR,
00422 ACE_LIB_TEXT ("(%P|%t) LN - DLL::open failed for %s: %s\n"),
00423 this->pathname (),
00424 errmsg ? errmsg : ACE_LIB_TEXT ("no error reported")));
00425 #endif
00426
00427 return -1;
00428 }
00429
00430 return 0;
00431
00432 }
00433
00434 void
00435 ACE_Location_Node::set_symbol (void *s)
00436 {
00437 ACE_TRACE ("ACE_Location_Node::set_symbol");
00438 this->symbol_ = s;
00439 }
00440
00441 ACE_ALLOC_HOOK_DEFINE (ACE_Object_Node)
00442
00443 void
00444 ACE_Object_Node::dump (void) const
00445 {
00446 #if defined (ACE_HAS_DUMP)
00447 ACE_TRACE ("ACE_Object_Node::dump");
00448 #endif
00449 }
00450
00451 ACE_Object_Node::ACE_Object_Node (const ACE_TCHAR *path,
00452 const ACE_TCHAR *obj_name)
00453 : object_name_ (ACE::strnew (obj_name))
00454 {
00455 ACE_TRACE ("ACE_Object_Node::ACE_Object_Node");
00456 this->pathname (ACE::strnew (path));
00457 this->must_delete_ = 0;
00458 }
00459
00460 void *
00461 ACE_Object_Node::symbol (ACE_Service_Gestalt *,
00462 int &yyerrno,
00463 ACE_Service_Object_Exterminator *)
00464 {
00465 ACE_TRACE ("ACE_Object_Node::symbol");
00466 if (this->open_dll (yyerrno) == 0)
00467 {
00468 ACE_TCHAR *object_name = const_cast<ACE_TCHAR *> (this->object_name_);
00469
00470 this->symbol_ = this->dll_.symbol (object_name);
00471 if (this->symbol_ == 0)
00472 {
00473 ++yyerrno;
00474
00475 #ifndef ACE_NLOGGING
00476 ACE_TCHAR *errmsg = this->dll_.error ();
00477 ACE_ERROR ((LM_ERROR,
00478 ACE_LIB_TEXT ("DLL::symbol failed for object %s: %s\n"),
00479 object_name,
00480 errmsg ? errmsg : ACE_LIB_TEXT ("no error reported")));
00481 #endif
00482
00483 return 0;
00484 }
00485
00486 return this->symbol_;
00487 }
00488
00489 return 0;
00490 }
00491
00492 ACE_Object_Node::~ACE_Object_Node (void)
00493 {
00494 ACE_TRACE ("ACE_Object_Node::~ACE_Object_Node");
00495 delete[] const_cast<ACE_TCHAR *> (this->object_name_);
00496 }
00497
00498 ACE_ALLOC_HOOK_DEFINE (ACE_Function_Node)
00499
00500 void
00501 ACE_Function_Node::dump (void) const
00502 {
00503 #if defined (ACE_HAS_DUMP)
00504 ACE_TRACE ("ACE_Function_Node::dump");
00505 #endif
00506 }
00507
00508 ACE_Function_Node::ACE_Function_Node (const ACE_TCHAR *path,
00509 const ACE_TCHAR *func_name)
00510 : function_name_ (make_func_name (func_name))
00511 {
00512 ACE_TRACE ("ACE_Function_Node::ACE_Function_Node");
00513 this->pathname (ACE::strnew (path));
00514 this->must_delete_ = 1;
00515 }
00516
00517 ACE_TCHAR *
00518 ACE_Function_Node::make_func_name (ACE_TCHAR const * func_name)
00519 {
00520
00521
00522
00523
00524 #if defined (ACE_HAS_VERSIONED_NAMESPACE) && ACE_HAS_VERSIONED_NAMESPACE == 1
00525 # define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME) #NAME
00526 # define ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(NAME) ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING_IMPL(NAME)
00527 # define ACE_VERSIONED_NAMESPACE_NAME_STRING ACE_MAKE_VERSIONED_NAMESPACE_NAME_STRING(ACE_VERSIONED_NAMESPACE_NAME)
00528
00529
00530
00531
00532
00533
00534
00535
00536 static ACE_TCHAR const make_prefix[] = ACE_LIB_TEXT ("_make_");
00537 static size_t const make_prefix_len =
00538 sizeof (make_prefix) / sizeof (make_prefix[0]) - 1;
00539
00540 if (ACE_OS::strncmp (make_prefix, func_name, make_prefix_len) == 0)
00541 {
00542 static ACE_TCHAR const versioned_namespace_name[] =
00543 ACE_LIB_TEXT (ACE_VERSIONED_NAMESPACE_NAME_STRING) ACE_LIB_TEXT("_") ;
00544
00545
00546
00547 static size_t const versioned_namespace_name_len =
00548 sizeof (versioned_namespace_name)
00549 / sizeof (versioned_namespace_name[0]);
00550
00551 size_t const len =
00552 ACE_OS::strlen (func_name)
00553 + versioned_namespace_name_len;
00554
00555
00556 ACE_TCHAR * mangled_func_name;
00557 ACE_NEW_RETURN (mangled_func_name,
00558 ACE_TCHAR[len],
00559 0);
00560
00561 ACE_Auto_Basic_Array_Ptr<ACE_TCHAR> safe (mangled_func_name);
00562
00563 ACE_OS::snprintf (mangled_func_name,
00564 len,
00565 ACE_LIB_TEXT ("%s%s%s"),
00566 make_prefix,
00567 versioned_namespace_name,
00568 func_name + make_prefix_len);
00569
00570 return safe.release ();
00571 }
00572 #endif
00573
00574 return ACE::strnew (func_name);
00575 }
00576
00577 void *
00578 ACE_Function_Node::symbol (ACE_Service_Gestalt *,
00579 int &yyerrno,
00580 ACE_Service_Object_Exterminator *gobbler)
00581 {
00582 typedef ACE_Service_Object *(*ACE_Service_Factory_Ptr)
00583 (ACE_Service_Object_Exterminator *);
00584
00585 ACE_TRACE ("ACE_Function_Node::symbol");
00586 if (this->open_dll (yyerrno) == 0)
00587 {
00588 ACE_Service_Factory_Ptr func = 0;
00589 this->symbol_ = 0;
00590
00591
00592
00593 ACE_TCHAR *function_name = const_cast<ACE_TCHAR *> (this->function_name_);
00594 void *func_p = this->dll_.symbol (function_name);
00595 if (func_p == 0)
00596 {
00597 ++yyerrno;
00598
00599 if (this->symbol_ == 0)
00600 {
00601 ++yyerrno;
00602
00603 #ifndef ACE_NLOGGING
00604 ACE_TCHAR *errmsg = this->dll_.error ();
00605 ACE_ERROR ((LM_ERROR,
00606 ACE_LIB_TEXT ("DLL::symbol failed for function %s: ")
00607 ACE_LIB_TEXT ("%s\n"),
00608 function_name,
00609 errmsg ? errmsg :
00610 ACE_LIB_TEXT ("no error reported")));
00611 #endif
00612
00613 return 0;
00614 }
00615 }
00616 ptrdiff_t temp_p = reinterpret_cast<ptrdiff_t> (func_p);
00617 func = reinterpret_cast<ACE_Service_Factory_Ptr> (temp_p);
00618
00619 this->symbol_ = (*func) (gobbler);
00620
00621 if (this->symbol_ == 0)
00622 {
00623 ++yyerrno;
00624 ACE_ERROR_RETURN ((LM_ERROR,
00625 ACE_LIB_TEXT ("%p\n"),
00626 this->function_name_),
00627 0);
00628 }
00629 }
00630 return this->symbol_;
00631 }
00632
00633 ACE_Function_Node::~ACE_Function_Node (void)
00634 {
00635 ACE_TRACE ("ACE_Function_Node::~ACE_Function_Node");
00636 delete[] const_cast<ACE_TCHAR *> (function_name_);
00637 delete[] const_cast<ACE_TCHAR *> (pathname_);
00638 }
00639
00640 ACE_ALLOC_HOOK_DEFINE (ACE_Dummy_Node)
00641
00642 void
00643 ACE_Dummy_Node::dump (void) const
00644 {
00645 #if defined (ACE_HAS_DUMP)
00646 ACE_TRACE ("ACE_Dummy_Node::dump");
00647 #endif
00648 }
00649
00650 ACE_Dummy_Node::ACE_Dummy_Node (const ACE_Static_Node *static_node,
00651 const ACE_Parse_Node *str_mods)
00652 : ACE_Parse_Node (static_node->name ()),
00653 node_ (static_node),
00654 mods_ (str_mods)
00655 {
00656 ACE_TRACE ("ACE_Dummy_Node::ACE_Dummy_Node");
00657 }
00658
00659 void
00660 ACE_Dummy_Node::apply (ACE_Service_Gestalt *, int &yyerrno)
00661 {
00662 ACE_TRACE ("ACE_Dummy_Node::apply");
00663
00664 #ifndef ACE_NLOGGING
00665 if (ACE::debug ())
00666 ACE_DEBUG ((LM_DEBUG,
00667 ACE_LIB_TEXT ("did operations on stream %s, error = %d\n"),
00668 this->name (),
00669 yyerrno));
00670 #endif
00671 }
00672
00673 ACE_Dummy_Node::~ACE_Dummy_Node (void)
00674 {
00675 ACE_TRACE ("ACE_Dummy_Node::~ACE_Dummy_Node");
00676 ACE_Static_Node *n = const_cast<ACE_Static_Node *> (this->node_);
00677 delete n;
00678 ACE_Parse_Node *m = const_cast<ACE_Parse_Node *> (this->mods_);
00679 delete m;
00680 }
00681
00682 ACE_ALLOC_HOOK_DEFINE (ACE_Static_Function_Node)
00683
00684 void
00685 ACE_Static_Function_Node::dump (void) const
00686 {
00687 #if defined (ACE_HAS_DUMP)
00688 ACE_TRACE ("ACE_Static_Function_Node::dump");
00689 #endif
00690 }
00691
00692 ACE_Static_Function_Node::ACE_Static_Function_Node (const ACE_TCHAR *func_name)
00693 : function_name_ (ACE::strnew (func_name))
00694 {
00695 ACE_TRACE ("ACE_Static_Function_Node::ACE_Static_Function_Node");
00696 this->must_delete_ = 1;
00697 }
00698
00699 void *
00700 ACE_Static_Function_Node::symbol (ACE_Service_Gestalt *config,
00701 int &yyerrno,
00702 ACE_Service_Object_Exterminator *gobbler)
00703 {
00704 ACE_TRACE ("ACE_Static_Function_Node::symbol");
00705
00706 this->symbol_ = 0;
00707
00708
00709
00710
00711 ACE_Static_Svc_Descriptor *ssd = 0;
00712 if (config->find_static_svc_descriptor (this->function_name_, &ssd) == -1)
00713 {
00714 yyerrno++;
00715 ACE_ERROR_RETURN ((LM_ERROR,
00716 ACE_LIB_TEXT ("(%P|%t) No static service ")
00717 ACE_LIB_TEXT ("registered for function %s\n"),
00718 this->function_name_),
00719 0);
00720 }
00721
00722 if (ssd->alloc_ == 0)
00723 {
00724 yyerrno++;
00725
00726 if (this->symbol_ == 0)
00727 {
00728 ++yyerrno;
00729
00730 ACE_ERROR_RETURN ((LM_ERROR,
00731 ACE_LIB_TEXT ("(%P|%t) No static service factory ")
00732 ACE_LIB_TEXT ("function registered for function %s\n"),
00733 this->function_name_),
00734 0);
00735 }
00736 }
00737
00738
00739 this->symbol_ = (*ssd->alloc_) (gobbler);
00740
00741 if (this->symbol_ == 0)
00742 {
00743 ++yyerrno;
00744 ACE_ERROR_RETURN ((LM_ERROR,
00745 ACE_LIB_TEXT ("%p\n"),
00746 this->function_name_),
00747 0);
00748 }
00749
00750 return this->symbol_;
00751 }
00752
00753 ACE_Static_Function_Node::~ACE_Static_Function_Node (void)
00754 {
00755 ACE_TRACE ("ACE_Static_Function_Node::~ACE_Static_Function_Node");
00756 delete[] const_cast<ACE_TCHAR *> (this->function_name_);
00757 }
00758
00759 ACE_END_VERSIONED_NAMESPACE_DECL
00760
00761 #endif