diff options
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp')
-rw-r--r-- | TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp | 129 |
1 files changed, 63 insertions, 66 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp b/TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp index 095de573009..e1bbf112a42 100644 --- a/TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp +++ b/TAO/orbsvcs/tests/AVStreams/Full_Profile/server.cpp @@ -3,7 +3,7 @@ #include "server.h" FTP_Server_FlowEndPoint::FTP_Server_FlowEndPoint (void) - :TAO_FlowConsumer ("Data",FTP_SERVER::instance ()->protocols (),FTP_SERVER::instance ()->format ()) + :TAO_FlowConsumer ("Data",FTP_SERVER::instance ()->protocols (), FTP_SERVER::instance ()->format ()) { AVStreams::protocolSpec protocols (2); protocols.length (3); @@ -19,7 +19,7 @@ FTP_Server_FlowEndPoint::FTP_Server_FlowEndPoint (void) } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"FTP_Server_FlowEndPoint::FTP_Server_FlowEndPoint"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"FTP_Server_FlowEndPoint::FTP_Server_FlowEndPoint\n"); } ACE_ENDTRY; ACE_CHECK; @@ -29,17 +29,20 @@ int FTP_Server_FlowEndPoint::get_callback (const char *, TAO_AV_Callback *&callback) { - ACE_DEBUG ((LM_DEBUG,"FTP_Server_StreamEndPoint::get_sfp_callback\n")); ACE_NEW_RETURN (callback, FTP_Server_Callback, -1); return 0; } +FTP_Server_Callback::FTP_Server_Callback (void) +{ +} + int FTP_Server_Callback::handle_stop (void) { - ACE_DEBUG ((LM_DEBUG,"FTP_Server_Callback::stop")); + ACE_DEBUG ((LM_DEBUG,"FTP_Server_Callback::stop\n")); ACE_OS::fclose (FTP_SERVER::instance ()->file ()); return 0; } @@ -66,36 +69,15 @@ FTP_Server_Callback::receive_frame (ACE_Message_Block *frame, int FTP_Server_Callback::handle_end_stream (void) { - ACE_DEBUG ((LM_DEBUG,"FTP_SFP_Callback::end_stream\n")); - CORBA::ORB_var orb = TAO_AV_CORE::instance ()->orb_manager ()->orb (); + CORBA::ORB_var orb = TAO_AV_CORE::instance ()->orb (); orb->shutdown (); return 0; } -// FTP_Server_FDev::FTP_Server_FDev (void) -// :TAO_FDev ("Data") -// { -// } - -// AVStreams::FlowConsumer_ptr -// FTP_Server_FDev::make_consumer (AVStreams::FlowConnection_ptr the_requester, -// AVStreams::QoS & the_qos, -// CORBA::Boolean_out met_qos, -// char *& named_fdev, -// CORBA::Environment &ACE_TRY_ENV) -// { -// ACE_DEBUG ((LM_DEBUG,"FTP_Server_FDev::make_consumer")); -// FTP_Server_FlowEndPoint *endpoint; -// ACE_NEW_RETURN (endpoint, -// FTP_Server_FlowEndPoint, -// 0); -// return endpoint->_this (ACE_TRY_ENV); -// ACE_CHECK_RETURN (0); -// } - Server::Server (void) - :orb_manager_ (TAO_AV_CORE::instance ()->orb_manager ()), - reactive_strategy_ (orb_manager_) + :reactive_strategy_ (TAO_AV_CORE::instance ()->orb (), TAO_AV_CORE::instance ()->poa ()), + orb_ (TAO_AV_CORE::instance ()->orb ()), + poa_ (TAO_AV_CORE::instance ()->poa ()) { } @@ -122,39 +104,22 @@ Server::init (int argc, ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - TAO_AV_CORE::instance ()->init (argc, - argv, - ACE_TRY_ENV); - ACE_TRY_CHECK; - this->orb_manager_ = - TAO_AV_CORE::instance ()->orb_manager (); - - // Initialize the orb_manager - this->orb_manager_->init_child_poa (argc, - argv, - "child_poa", - ACE_TRY_ENV); - ACE_TRY_CHECK; - - CORBA::ORB_var orb = - this->orb_manager_->orb (); - - PortableServer::POA_var child_poa = - this->orb_manager_->child_poa (); - + PortableServer::POAManager_var mgr + = this->poa_->the_POAManager (); + + mgr->activate (); + int result = this->parse_args (argc,argv); if (result == -1) ACE_ERROR_RETURN ((LM_ERROR,"parse args failed\n"),-1); + // Initialize the naming services - - if (my_naming_client_.init (orb.in ()) != 0) + if (my_naming_client_.init (this->orb_.in ()) != 0) ACE_ERROR_RETURN ((LM_ERROR, " (%P|%t) Unable to initialize " "the TAO_Naming_Client. \n"), -1); - this->orb_manager_->activate_poa_manager (ACE_TRY_ENV); - ACE_TRY_CHECK; // Register the video mmdevice object with the ORB ACE_NEW_RETURN (this->mmdevice_, TAO_MMDevice (&this->reactive_strategy_), @@ -163,19 +128,22 @@ Server::init (int argc, ACE_NEW_RETURN (this->fdev_, FTP_Server_FDev, -1); + this->fdev_->flowname ("Data"); - + AVStreams::MMDevice_var mmdevice = this->mmdevice_->_this (ACE_TRY_ENV); ACE_TRY_CHECK; + AVStreams::FDev_var fdev = this->fdev_->_this (ACE_TRY_ENV); ACE_TRY_CHECK; - mmdevice->add_fdev (fdev.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - // create the video server mmdevice with the naming service pointer. - this->orb_manager_->activate_under_child_poa ("Server_MMDevice", - this->mmdevice_, - ACE_TRY_ENV); + + if (CORBA::is_nil (fdev.in ())) + cout << "FDev is nil" << endl; + + if (CORBA::is_nil (mmdevice.in ())) + cout << "MMDevice is nil" << endl; + + mmdevice->add_fdev (fdev.in (), ACE_TRY_ENV); ACE_TRY_CHECK; // Register the mmdevice with the naming service. @@ -205,12 +173,12 @@ Server::run (void) ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY { - this->orb_manager_->run (ACE_TRY_ENV); + this->orb_->run (ACE_TRY_ENV); ACE_TRY_CHECK; } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"server::init"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"server::init\n"); return -1; } ACE_ENDTRY; @@ -256,12 +224,41 @@ main (int argc, char **argv) { int result = 0; + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv); + + CORBA::Object_var obj + = orb->resolve_initial_references ("RootPOA"); + + PortableServer::POA_var poa + = PortableServer::POA::_narrow (obj); + + ACE_DECLARE_NEW_CORBA_ENV; + + ACE_TRY + { + TAO_AV_CORE::instance ()->init (orb.in (), + poa.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"server::init"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + result = FTP_SERVER::instance ()->init (argc,argv); + if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR,"FTP_SERVER::init failed\n"),1); + ACE_ERROR_RETURN ((LM_ERROR,"SERVER::init failed\n"),1); + result = FTP_SERVER::instance ()->run (); + if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR,"FTP_SERVER::run failed\n"),1); + ACE_ERROR_RETURN ((LM_ERROR,"SERVER::run failed\n"),1); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) @@ -270,7 +267,7 @@ template class TAO_AV_Endpoint_Reactive_Strategy_B <TAO_StreamEndPoint_B,TAO_VDe template class TAO_AV_Endpoint_Reactive_Strategy <TAO_StreamEndPoint_B,TAO_VDev,AV_Null_MediaCtrl>; template class TAO_FDev <TAO_FlowProducer, FTP_Server_FlowEndPoint>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton <Server,ACE_Null_Mutex> +s#pragma instantiate ACE_Singleton <Server,ACE_Null_Mutex> #pragma instantiate TAO_AV_Endpoint_Reactive_Strategy_B <TAO_StreamEndPoint_B,TAO_VDev,AV_Null_MediaCtrl> #pragma instantiate TAO_AV_Endpoint_Reactive_Strategy <TAO_StreamEndPoint_B,TAO_VDev,AV_Null_MediaCtrl> #pragma instantiate TAO_FDev <TAO_FlowProducer, FTP_Server_FlowEndPoint> |