#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 ACE_ENV_ARG_DECL) |
char * | activate_with_poa (PortableServer::Servant servant ACE_ENV_ARG_DECL) |
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 (ACE_ENV_SINGLE_ARG_DECL) |
Binds to the naming service. | |
int | register_vdev (ACE_ENV_SINGLE_ARG_DECL) |
Registers vdev with the naming service. | |
int | register_stream_endpoint (ACE_ENV_SINGLE_ARG_DECL) |
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 152 of file Endpoint_Strategy_T.h.
|
Constructor.
Definition at line 382 of file Endpoint_Strategy_T.cpp. References ACE_ERROR, ACE_OS::getpid(), ACE_OS::hostname(), and LM_ERROR.
00383 : stream_endpoint_name_ (0), 00384 pid_ (-1) 00385 { 00386 this->pid_ = ACE_OS::getpid (); 00387 if (this->pid_ == 0) 00388 ACE_ERROR ((LM_ERROR,"getpid () failed\n")); 00389 ACE_OS::hostname (this->host_, 00390 sizeof this->host_); 00391 } |
|
Destructor.
Definition at line 778 of file Endpoint_Strategy_T.cpp. References TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::unbind_names().
00779 { 00780 this->unbind_names (); 00781 } |
|
Creates the objects and inserts them into the Naming Service, so the parent can pick the IOR's and return them to the client |
|
activate the servant with the poa
Definition at line 444 of file Endpoint_Strategy_T.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_DECL, and ACE_ENV_ARG_PARAMETER.
00446 { 00447 00448 PortableServer::ObjectId_var id = 00449 this->poa_->activate_object (servant 00450 ACE_ENV_ARG_PARAMETER); 00451 ACE_CHECK_RETURN (0); 00452 00453 CORBA::Object_var obj = 00454 this->poa_->id_to_reference (id.in () 00455 ACE_ENV_ARG_PARAMETER); 00456 ACE_CHECK_RETURN (0); 00457 00458 CORBA::String_var str = 00459 this->orb_->object_to_string (obj.in () 00460 ACE_ENV_ARG_PARAMETER); 00461 ACE_CHECK_RETURN (0); 00462 00463 return str._retn (); 00464 } |
|
Binds to the naming service.
Definition at line 523 of file Endpoint_Strategy_T.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_DECL, ACE_ERROR_RETURN, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, CORBA::is_nil(), and LM_ERROR.
00524 { 00525 ACE_TRY 00526 { 00527 CORBA::Object_var naming_obj = 00528 this->orb_->resolve_initial_references ("NameService" ACE_ENV_ARG_PARAMETER); 00529 ACE_TRY_CHECK; 00530 if (CORBA::is_nil (naming_obj.in ())) 00531 ACE_ERROR_RETURN ((LM_ERROR, 00532 " (%P|%t) Unable to resolve the Name Service.\n"), 00533 -1); 00534 // if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s:%d\n", __FILE__, __LINE__)); 00535 this->naming_context_ = 00536 CosNaming::NamingContext::_narrow (naming_obj.in () 00537 ACE_ENV_ARG_PARAMETER); 00538 ACE_TRY_CHECK; 00539 } 00540 ACE_CATCHANY 00541 { 00542 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_AV_Child_Process::bind_to_naming_service"); 00543 return -1; 00544 } 00545 ACE_ENDTRY; 00546 ACE_CHECK_RETURN (-1); 00547 return 0; 00548 } |
|
Initializes the ORB, creates and activates the T_StreamEndpoint, T_VDev, T_MediaCtrl in the POA Definition at line 396 of file Endpoint_Strategy_T.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_ERROR_RETURN, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, and LM_ERROR.
00400 { 00401 ACE_DECLARE_NEW_CORBA_ENV; 00402 ACE_TRY 00403 { 00404 this->orb_ = orb; 00405 00406 this->poa_ = poa; 00407 00408 // create the objects and activate them in the poa 00409 this->activate_objects (argc, 00410 argv 00411 ACE_ENV_ARG_PARAMETER); 00412 ACE_TRY_CHECK; 00413 00414 // Get ourselves a naming_service object reference 00415 this->bind_to_naming_service (ACE_ENV_SINGLE_ARG_PARAMETER); 00416 ACE_TRY_CHECK; 00417 00418 // Register the vdev with the naming service 00419 this->register_vdev (ACE_ENV_SINGLE_ARG_PARAMETER); 00420 ACE_TRY_CHECK; 00421 00422 // register the stream_endpoing with the naming_service 00423 this->register_stream_endpoint (ACE_ENV_SINGLE_ARG_PARAMETER); 00424 ACE_TRY_CHECK; 00425 } 00426 ACE_CATCHANY 00427 { 00428 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_Child_Process"); 00429 return -1; 00430 } 00431 ACE_ENDTRY; 00432 00433 // release the semaphore the parent is waiting on 00434 if (this->release_semaphore () == -1) 00435 ACE_ERROR_RETURN ((LM_ERROR, 00436 "(%P|%t) Error releasing semaphores\n"), 00437 -1); 00438 00439 return 0; 00440 } |
|
Bridge method to create a media_ctrl, a la Acceptor. Applications can override this Definition at line 734 of file Endpoint_Strategy_T.cpp. References ACE_DEBUG, ACE_NEW_RETURN, LM_DEBUG, and TAO_debug_level.
00735 { 00736 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t) TAO_AV_Child_Process::make_mediactrl ()\n")); 00737 ACE_NEW_RETURN (media_ctrl, 00738 T_MediaCtrl, 00739 -1); 00740 return 0; 00741 } |
|
Bridge method to create a stream_endpoint, a la Acceptor. Applications can override this Definition at line 712 of file Endpoint_Strategy_T.cpp. References ACE_NEW_RETURN.
00713 { 00714 ACE_NEW_RETURN (stream_endpoint, 00715 T_StreamEndpoint, 00716 -1); 00717 return 0; 00718 } |
|
Bridge method to create a vdev, a la Acceptor. Applications can override this Definition at line 723 of file Endpoint_Strategy_T.cpp. References ACE_NEW_RETURN.
00724 { 00725 ACE_NEW_RETURN (vdev, 00726 T_VDev, 00727 -1); 00728 return 0; 00729 } |
|
Registers stream_endpoint with the naming service.
Definition at line 675 of file Endpoint_Strategy_T.cpp. References CORBA::Object::_nil(), ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_DECL, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, and ACE_TRY_CHECK.
00676 { 00677 CORBA::Object_ptr stream_endpoint_obj = CORBA::Object::_nil (); 00678 ACE_TRY 00679 { 00680 stream_endpoint_obj = this->stream_endpoint_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); 00681 ACE_TRY_CHECK; 00682 00683 // Create a name for the video control object 00684 // subclasses can define their own name for the streamendpoint 00685 // Register the stream endpoint object with the naming server. 00686 this->naming_context_->bind (this->stream_endpoint_name_, 00687 stream_endpoint_obj 00688 ACE_ENV_ARG_PARAMETER); 00689 ACE_TRY_CHECK; 00690 } 00691 ACE_CATCH (CosNaming::NamingContext::AlreadyBound,ex) 00692 { 00693 // if the name was already there, replace the reference with the new one 00694 this->naming_context_->rebind (this->stream_endpoint_name_, 00695 stream_endpoint_obj 00696 ACE_ENV_ARG_PARAMETER); 00697 ACE_TRY_CHECK; 00698 } 00699 ACE_CATCHANY 00700 { 00701 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_Endpoint_Reactive_Strategy::activate"); 00702 return -1; 00703 } 00704 ACE_ENDTRY; 00705 ACE_CHECK_RETURN (-1); 00706 return 0; 00707 } |
|
Registers vdev with the naming service.
Definition at line 553 of file Endpoint_Strategy_T.cpp. References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_DECL, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, ACE_TRY_CHECK_EX, ACE_TRY_EX, LM_DEBUG, ACE_OS::sprintf(), CORBA::string_dup(), and TAO_debug_level.
00554 { 00555 ACE_TRY 00556 { 00557 char vdev_name [BUFSIZ]; 00558 ACE_OS::sprintf (vdev_name, 00559 "%s:%s:%ld", 00560 "VDev", 00561 this->host_, 00562 static_cast<long> (this->pid_)); 00563 00564 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"(%P|%t)%s\n",vdev_name)); 00565 // create the name 00566 this->vdev_name_.length (1); 00567 this->vdev_name_ [0].id = CORBA::string_dup (vdev_name); 00568 00569 // make the media controller a property of the vdev 00570 CORBA::Any media_ctrl_property; 00571 media_ctrl_obj_ = 00572 this->media_ctrl_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); 00573 ACE_TRY_CHECK; 00574 00575 this->vdev_->define_property ("Related_MediaCtrl", 00576 media_ctrl_obj_.in() 00577 ACE_ENV_ARG_PARAMETER); 00578 ACE_TRY_CHECK; 00579 00580 vdev_obj_ = this->vdev_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); 00581 ACE_TRY_CHECK; 00582 00583 ACE_TRY_CHECK; 00584 ACE_TRY_EX (bind) 00585 { 00586 // Register the vdev with the naming server. 00587 this->naming_context_->bind (this->vdev_name_, 00588 vdev_obj_.in() 00589 ACE_ENV_ARG_PARAMETER); 00590 ACE_TRY_CHECK_EX (bind); 00591 } 00592 ACE_CATCH (CosNaming::NamingContext::AlreadyBound,ex) 00593 { 00594 // If the object was already there, replace the older reference 00595 // with this one 00596 this->naming_context_->rebind (this->vdev_name_, 00597 vdev_obj_.in() 00598 ACE_ENV_ARG_PARAMETER); 00599 ACE_TRY_CHECK; 00600 } 00601 ACE_CATCHANY 00602 { 00603 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_AV_Child_Process::register_vdev"); 00604 return -1; 00605 } 00606 ACE_ENDTRY; 00607 ACE_CHECK_RETURN (-1); 00608 } 00609 ACE_CATCHANY 00610 { 00611 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_AV_Child_Process::register_vdev"); 00612 return -1; 00613 } 00614 ACE_ENDTRY; 00615 ACE_CHECK_RETURN (-1); 00616 return 0; 00617 } |
|
Releases the semaphore on which the parent is waiting on.
Definition at line 642 of file Endpoint_Strategy_T.cpp. References ACE_DEBUG, ACE_ERROR_RETURN, LM_DEBUG, LM_ERROR, ACE_Process_Semaphore::release(), and TAO_debug_level.
00643 { 00644 char sem_str [BUFSIZ]; 00645 00646 long pid = this->pid_; 00647 sprintf (sem_str, 00648 "%s:%s:%ld", 00649 "TAO_AV_Process_Semaphore", 00650 this->host_, 00651 pid); 00652 00653 if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, 00654 "(%P|%t) semaphore is %s\n", 00655 sem_str)); 00656 00657 // Release the lock on which the server is waiting 00658 ACE_Process_Semaphore semaphore (0, // 0 means that the semaphore is 00659 // initially locked 00660 sem_str); 00661 00662 if (semaphore.release () == -1) 00663 ACE_ERROR_RETURN ((LM_ERROR, 00664 "(%P|%t) Error releasing semaphore %s: %p\n", 00665 sem_str, 00666 "semaphore.release ()"), 00667 -1); 00668 00669 return 0; 00670 } |
|
runs the ORB event loop
Definition at line 622 of file Endpoint_Strategy_T.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, and ACE_TRY_CHECK.
00623 { 00624 ACE_DECLARE_NEW_CORBA_ENV; 00625 ACE_TRY 00626 { 00627 this->orb_->run (tv ACE_ENV_ARG_PARAMETER); 00628 ACE_TRY_CHECK; 00629 } 00630 ACE_CATCHANY 00631 { 00632 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"orb.run ()"); 00633 return -1; 00634 } 00635 ACE_ENDTRY; 00636 return 0; 00637 } |
|
Removes the vdev and streamendpoint names from the naming service.
Definition at line 746 of file Endpoint_Strategy_T.cpp. References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_CHECK_RETURN, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, and CORBA::is_nil(). Referenced by TAO_AV_Child_Process< T_StreamEndpoint, T_VDev, T_MediaCtrl >::~TAO_AV_Child_Process().
00747 { 00748 // Remove the names from the naming service 00749 ACE_DECLARE_NEW_CORBA_ENV; 00750 ACE_TRY 00751 { 00752 if (CORBA::is_nil (this->naming_context_.in ()) == 0) 00753 return 0; 00754 this->naming_context_->unbind (this->stream_endpoint_name_ 00755 ACE_ENV_ARG_PARAMETER); 00756 ACE_TRY_CHECK; 00757 00758 this->naming_context_->unbind (this->vdev_name_ 00759 ACE_ENV_ARG_PARAMETER); 00760 ACE_TRY_CHECK; 00761 } 00762 ACE_CATCHANY 00763 { 00764 ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"TAO_Endpoint_Process_Strategy::activate"); 00765 return -1; 00766 } 00767 ACE_ENDTRY; 00768 ACE_CHECK_RETURN (-1); 00769 return 0; 00770 } |
|
Name of the host.
Definition at line 237 of file Endpoint_Strategy_T.h. |
|
Media controller.
Definition at line 228 of file Endpoint_Strategy_T.h. |
|
Definition at line 231 of file Endpoint_Strategy_T.h. |
|
The root Naming Context of the TAO naming service.
Definition at line 210 of file Endpoint_Strategy_T.h. |
|
Definition at line 239 of file Endpoint_Strategy_T.h. |
|
pid of this process
Definition at line 234 of file Endpoint_Strategy_T.h. |
|
Definition at line 241 of file Endpoint_Strategy_T.h. |
|
The stream endpoint member.
Definition at line 219 of file Endpoint_Strategy_T.h. |
|
Name of the stream_endpoint.
Definition at line 216 of file Endpoint_Strategy_T.h. |
|
The virtual device.
Definition at line 222 of file Endpoint_Strategy_T.h. |
|
Name of the vdev.
Definition at line 213 of file Endpoint_Strategy_T.h. |
|
Virtual device CORBA object reference.
Definition at line 225 of file Endpoint_Strategy_T.h. |