#include <Endpoint_Strategy_T.h>
Inheritance diagram for TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >:
Public Member Functions | |
TAO_AV_Child_Process () | |
Constructor. | |
virtual | ~TAO_AV_Child_Process () |
Destructor. | |
int | init (int argc, char **argv, CORBA::ORB_ptr orb, PortableServer::POA_ptr poa) |
int | run (ACE_Time_Value *tv=0) |
runs the ORB event loop | |
Protected Member Functions | |
int | activate_objects (int argc, char **argv) |
char * | activate_with_poa (PortableServer::Servant servant) |
activate the servant with the poa | |
int | unbind_names (void) |
Removes the vdev and streamendpoint names from the naming service. | |
int | bind_to_naming_service (void) |
Binds to the naming service. | |
int | register_vdev (void) |
Registers vdev with the naming service. | |
int | register_stream_endpoint (void) |
Registers stream_endpoint with the naming service. | |
int | release_semaphore () |
Releases the semaphore on which the parent is waiting on. | |
virtual int | make_vdev (T_VDev *&vdev) |
virtual int | make_stream_endpoint (T_StreamEndpoint *&stream_endpoint) |
virtual int | make_mediactrl (T_MediaCtrl *&media_ctrl) |
Protected Attributes | |
CosNaming::NamingContext_var | naming_context_ |
The root Naming Context of the TAO naming service. | |
CosNaming::Name | vdev_name_ |
Name of the vdev. | |
CosNaming::Name | stream_endpoint_name_ |
Name of the stream_endpoint. | |
T_StreamEndpoint * | stream_endpoint_ |
The stream endpoint member. | |
T_VDev * | vdev_ |
The virtual device. | |
CORBA::Object_var | vdev_obj_ |
Virtual device CORBA object reference. | |
T_MediaCtrl * | media_ctrl_ |
Media controller. | |
CORBA::Object_var | media_ctrl_obj_ |
pid_t | pid_ |
pid of this process | |
char | host_ [MAXHOSTNAMELEN] |
Name of the host. | |
CORBA::ORB_ptr | orb_ |
PortableServer::POA_ptr | poa_ |
Definition at line 150 of file Endpoint_Strategy_T.h.
TAO_AV_Child_Process< T_StreamEndpoint_B, T_VDev, T_MediaCtrl >::TAO_AV_Child_Process | ( | ) |
Constructor.
Definition at line 341 of file Endpoint_Strategy_T.cpp.
References ACE_ERROR, ACE_OS::getpid(), ACE_OS::hostname(), and LM_ERROR.
00342 : stream_endpoint_name_ (0), 00343 pid_ (-1) 00344 { 00345 this->pid_ = ACE_OS::getpid (); 00346 if (this->pid_ == 0) 00347 ACE_ERROR ((LM_ERROR,"getpid () failed\n")); 00348 ACE_OS::hostname (this->host_, 00349 sizeof this->host_); 00350 }
TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::~TAO_AV_Child_Process | ( | ) | [virtual] |
Destructor.
Definition at line 684 of file Endpoint_Strategy_T.cpp.
References TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::unbind_names().
00685 { 00686 this->unbind_names (); 00687 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::activate_objects | ( | int | argc, | |
char ** | argv | |||
) | [protected] |
Creates the objects and inserts them into the Naming Service, so the parent can pick the IOR's and return them to the client
Definition at line 414 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, LM_DEBUG, and TAO_debug_level.
00416 { 00417 try 00418 { 00419 // bridge method to make a new stream endpoint 00420 if (this->make_stream_endpoint (this->stream_endpoint_) == -1) 00421 return -1; 00422 00423 // bridge method to make a new vdev 00424 if (this->make_vdev (this->vdev_) == -1) 00425 return -1; 00426 00427 // bridge method to make a new media controller 00428 if (this->make_mediactrl (this->media_ctrl_) == -1) 00429 return -1; 00430 00431 // activate the stream_endpoint 00432 CORBA::String_var stream_endpoint_ior = this->activate_with_poa (this->stream_endpoint_); 00433 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, 00434 "(%P|%t)TAO_AV_Child_Process::activate_objects,stream_endpoint_ior :%s\n", 00435 stream_endpoint_ior.in ())); 00436 00437 // activate the vdev 00438 CORBA::String_var vdev_ior = this->activate_with_poa (this->vdev_); 00439 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, 00440 "(%P|%t)TAO_AV_Child_Process::activate_objects, vdev ior is :%s\n", 00441 vdev_ior.in ())); 00442 00443 // activate the media controller 00444 CORBA::String_var media_ctrl_ior = this->activate_with_poa (this->media_ctrl_); 00445 00446 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t)TAO_AV_Child_Process::activate_objects,media_ctrl_ior is: %s\n",media_ctrl_ior.in ())); 00447 } 00448 catch (const CORBA::Exception& ex) 00449 { 00450 ex._tao_print_exception ("TAO_AV_Child_Process::init "); 00451 return -1; 00452 } 00453 return 0; 00454 }
char * TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::activate_with_poa | ( | PortableServer::Servant | servant | ) | [protected] |
activate the servant with the poa
Definition at line 396 of file Endpoint_Strategy_T.cpp.
References TAO_Pseudo_Var_T< T >::in().
00397 { 00398 00399 PortableServer::ObjectId_var id = 00400 this->poa_->activate_object (servant); 00401 00402 CORBA::Object_var obj = 00403 this->poa_->id_to_reference (id.in ()); 00404 00405 CORBA::String_var str = 00406 this->orb_->object_to_string (obj.in ()); 00407 00408 return str._retn (); 00409 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::bind_to_naming_service | ( | void | ) | [protected] |
Binds to the naming service.
Definition at line 459 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_ERROR_RETURN, CORBA::is_nil(), and LM_ERROR.
00460 { 00461 try 00462 { 00463 CORBA::Object_var naming_obj = 00464 this->orb_->resolve_initial_references ("NameService"); 00465 if (CORBA::is_nil (naming_obj.in ())) 00466 ACE_ERROR_RETURN ((LM_ERROR, 00467 " (%P|%t) Unable to resolve the Name Service.\n"), 00468 -1); 00469 // if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); 00470 this->naming_context_ = 00471 CosNaming::NamingContext::_narrow (naming_obj.in ()); 00472 } 00473 catch (const CORBA::Exception& ex) 00474 { 00475 ex._tao_print_exception ( 00476 "TAO_AV_Child_Process::bind_to_naming_service"); 00477 return -1; 00478 } 00479 return 0; 00480 }
int TAO_AV_Child_Process< T_StreamEndpoint_B, T_VDev, T_MediaCtrl >::init | ( | int | argc, | |
char ** | argv, | |||
CORBA::ORB_ptr | orb, | |||
PortableServer::POA_ptr | poa | |||
) |
Initializes the ORB, creates and activates the T_StreamEndpoint, T_VDev, T_MediaCtrl in the POA
Definition at line 355 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_ERROR_RETURN, LM_ERROR, and TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::poa_.
00359 { 00360 try 00361 { 00362 this->orb_ = orb; 00363 00364 this->poa_ = poa; 00365 00366 // create the objects and activate them in the poa 00367 this->activate_objects (argc, 00368 argv); 00369 00370 // Get ourselves a naming_service object reference 00371 this->bind_to_naming_service (); 00372 00373 // Register the vdev with the naming service 00374 this->register_vdev (); 00375 00376 // register the stream_endpoing with the naming_service 00377 this->register_stream_endpoint (); 00378 } 00379 catch (const CORBA::Exception& ex) 00380 { 00381 ex._tao_print_exception ("TAO_Child_Process"); 00382 return -1; 00383 } 00384 00385 // release the semaphore the parent is waiting on 00386 if (this->release_semaphore () == -1) 00387 ACE_ERROR_RETURN ((LM_ERROR, 00388 "(%P|%t) Error releasing semaphores\n"), 00389 -1); 00390 00391 return 0; 00392 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::make_mediactrl | ( | T_MediaCtrl *& | media_ctrl | ) | [protected, virtual] |
Bridge method to create a media_ctrl, a la Acceptor. Applications can override this
Definition at line 646 of file Endpoint_Strategy_T.cpp.
References ACE_DEBUG, ACE_NEW_RETURN, LM_DEBUG, and TAO_debug_level.
00647 { 00648 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t) TAO_AV_Child_Process::make_mediactrl ()\n")); 00649 ACE_NEW_RETURN (media_ctrl, 00650 T_MediaCtrl, 00651 -1); 00652 return 0; 00653 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::make_stream_endpoint | ( | T_StreamEndpoint *& | stream_endpoint | ) | [protected, virtual] |
Bridge method to create a stream_endpoint, a la Acceptor. Applications can override this
Definition at line 624 of file Endpoint_Strategy_T.cpp.
References ACE_NEW_RETURN.
00625 { 00626 ACE_NEW_RETURN (stream_endpoint, 00627 T_StreamEndpoint, 00628 -1); 00629 return 0; 00630 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::make_vdev | ( | T_VDev *& | vdev | ) | [protected, virtual] |
Bridge method to create a vdev, a la Acceptor. Applications can override this
Definition at line 635 of file Endpoint_Strategy_T.cpp.
References ACE_NEW_RETURN.
00636 { 00637 ACE_NEW_RETURN (vdev, 00638 T_VDev, 00639 -1); 00640 return 0; 00641 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::register_stream_endpoint | ( | void | ) | [protected] |
Registers stream_endpoint with the naming service.
Definition at line 593 of file Endpoint_Strategy_T.cpp.
References CORBA::Object::_nil(), and CORBA::Exception::_tao_print_exception().
00594 { 00595 CORBA::Object_ptr stream_endpoint_obj = CORBA::Object::_nil (); 00596 try 00597 { 00598 stream_endpoint_obj = this->stream_endpoint_->_this (); 00599 00600 // Create a name for the video control object 00601 // subclasses can define their own name for the streamendpoint 00602 // Register the stream endpoint object with the naming server. 00603 this->naming_context_->bind (this->stream_endpoint_name_, 00604 stream_endpoint_obj); 00605 } 00606 catch (const CosNaming::NamingContext::AlreadyBound& ) 00607 { 00608 // if the name was already there, replace the reference with the new one 00609 this->naming_context_->rebind (this->stream_endpoint_name_, 00610 stream_endpoint_obj); 00611 } 00612 catch (const CORBA::Exception& ex) 00613 { 00614 ex._tao_print_exception ( 00615 "TAO_Endpoint_Reactive_Strategy::activate"); 00616 return -1; 00617 } 00618 return 0; 00619 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::register_vdev | ( | void | ) | [protected] |
Registers vdev with the naming service.
Definition at line 485 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception(), ACE_DEBUG, LM_DEBUG, ACE_OS::sprintf(), CORBA::string_dup(), and TAO_debug_level.
00486 { 00487 try 00488 { 00489 char vdev_name [BUFSIZ]; 00490 ACE_OS::sprintf (vdev_name, 00491 "%s:%s:%ld", 00492 "VDev", 00493 this->host_, 00494 static_cast<long> (this->pid_)); 00495 00496 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t)%s\n",vdev_name)); 00497 // create the name 00498 this->vdev_name_.length (1); 00499 this->vdev_name_ [0].id = CORBA::string_dup (vdev_name); 00500 00501 // make the media controller a property of the vdev 00502 CORBA::Any media_ctrl_property; 00503 media_ctrl_obj_ = 00504 this->media_ctrl_->_this (); 00505 00506 this->vdev_->define_property ("Related_MediaCtrl", 00507 media_ctrl_obj_.in()); 00508 00509 vdev_obj_ = this->vdev_->_this (); 00510 00511 try 00512 { 00513 // Register the vdev with the naming server. 00514 this->naming_context_->bind (this->vdev_name_, 00515 vdev_obj_.in()); 00516 } 00517 catch (const CosNaming::NamingContext::AlreadyBound& ) 00518 { 00519 // If the object was already there, replace the older reference 00520 // with this one 00521 this->naming_context_->rebind (this->vdev_name_, 00522 vdev_obj_.in()); 00523 } 00524 catch (const CORBA::Exception& ex) 00525 { 00526 ex._tao_print_exception ( 00527 "TAO_AV_Child_Process::register_vdev"); 00528 return -1; 00529 } 00530 } 00531 catch (const CORBA::Exception& ex) 00532 { 00533 ex._tao_print_exception ( 00534 "TAO_AV_Child_Process::register_vdev"); 00535 return -1; 00536 } 00537 return 0; 00538 }
int TAO_AV_Child_Process< T_StreamEndpoint_B, T_VDev, T_MediaCtrl >::release_semaphore | ( | ) | [protected] |
Releases the semaphore on which the parent is waiting on.
Definition at line 560 of file Endpoint_Strategy_T.cpp.
References ACE_DEBUG, ACE_ERROR_RETURN, LM_DEBUG, LM_ERROR, ACE_Process_Semaphore::release(), ACE_OS::sprintf(), and TAO_debug_level.
00561 { 00562 char sem_str [BUFSIZ]; 00563 00564 long pid = this->pid_; 00565 ACE_OS::sprintf (sem_str, 00566 "%s:%s:%ld", 00567 "TAO_AV_Process_Semaphore", 00568 this->host_, 00569 pid); 00570 00571 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, 00572 "(%P|%t) semaphore is %s\n", 00573 sem_str)); 00574 00575 // Release the lock on which the server is waiting 00576 ACE_Process_Semaphore semaphore (0, // 0 means that the semaphore is 00577 // initially locked 00578 sem_str); 00579 00580 if (semaphore.release () == -1) 00581 ACE_ERROR_RETURN ((LM_ERROR, 00582 "(%P|%t) Error releasing semaphore %s: %p\n", 00583 sem_str, 00584 "semaphore.release ()"), 00585 -1); 00586 00587 return 0; 00588 }
int TAO_AV_Child_Process< T_StreamEndpoint_B, T_VDev, T_MediaCtrl >::run | ( | ACE_Time_Value * | tv = 0 |
) |
runs the ORB event loop
Definition at line 543 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception().
00544 { 00545 try 00546 { 00547 this->orb_->run (tv); 00548 } 00549 catch (const CORBA::Exception& ex) 00550 { 00551 ex._tao_print_exception ("orb.run ()"); 00552 return -1; 00553 } 00554 return 0; 00555 }
int TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::unbind_names | ( | void | ) | [protected] |
Removes the vdev and streamendpoint names from the naming service.
Definition at line 658 of file Endpoint_Strategy_T.cpp.
References CORBA::Exception::_tao_print_exception(), CORBA::is_nil(), and TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::naming_context_.
Referenced by TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::~TAO_AV_Child_Process().
00659 { 00660 // Remove the names from the naming service 00661 try 00662 { 00663 if (CORBA::is_nil (this->naming_context_.in ()) == 0) 00664 return 0; 00665 this->naming_context_->unbind (this->stream_endpoint_name_); 00666 00667 this->naming_context_->unbind (this->vdev_name_); 00668 } 00669 catch (const CORBA::Exception& ex) 00670 { 00671 ex._tao_print_exception ( 00672 "TAO_Endpoint_Process_Strategy::activate"); 00673 return -1; 00674 } 00675 return 0; 00676 }
char TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::host_[MAXHOSTNAMELEN] [protected] |
T_MediaCtrl* TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::media_ctrl_ [protected] |
CORBA::Object_var TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::media_ctrl_obj_ [protected] |
Definition at line 228 of file Endpoint_Strategy_T.h.
CosNaming::NamingContext_var TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::naming_context_ [protected] |
The root Naming Context of the TAO naming service.
Definition at line 207 of file Endpoint_Strategy_T.h.
Referenced by TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::unbind_names().
CORBA::ORB_ptr TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::orb_ [protected] |
Definition at line 236 of file Endpoint_Strategy_T.h.
pid_t TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::pid_ [protected] |
PortableServer::POA_ptr TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::poa_ [protected] |
Definition at line 238 of file Endpoint_Strategy_T.h.
Referenced by TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::init().
T_StreamEndpoint* TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::stream_endpoint_ [protected] |
CosNaming::Name TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::stream_endpoint_name_ [protected] |
Name of the stream_endpoint.
Definition at line 213 of file Endpoint_Strategy_T.h.
Referenced by TAO_AV_Child_Process_A< T_StreamEndpoint, T_VDev, T_MediaCtrl >::TAO_AV_Child_Process_A().
T_VDev* TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::vdev_ [protected] |
CosNaming::Name TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::vdev_name_ [protected] |
CORBA::Object_var TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::vdev_obj_ [protected] |