本文整理汇总了C++中cosnotification::NotificationServiceMonitorControl_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ NotificationServiceMonitorControl_var::in方法的具体用法?C++ NotificationServiceMonitorControl_var::in怎么用?C++ NotificationServiceMonitorControl_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cosnotification::NotificationServiceMonitorControl_var
的用法示例。
在下文中一共展示了NotificationServiceMonitorControl_var::in方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
int
ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
#if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
CORBA::Object_var obj =
orb->string_to_object (
"corbaloc:iiop:127.0.0.1:32101/TAO_MonitorAndControl");
CosNotification::NotificationServiceMonitorControl_var monitor =
CosNotification::NotificationServiceMonitorControl::_narrow (
obj.in ());
if (CORBA::is_nil (monitor.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Unable to resolve the TAO_MonitorAndControl\n"),
-1);
}
monitor->shutdown ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("MonitorClient: ");
}
catch (...)
{
error ("Caught an unexpected exception type");
}
#else /* TAO_HAS_MONITOR_FRAMEWORK==1 */
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
#endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */
return 0;
}
示例2: owner_transfer
int
ACE_TMAIN (int argc, ACE_TCHAR* argv[])
{
int status = 0;
#if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
try
{
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) != 0)
{
return 1;
}
CORBA::Object_var obj =
orb->string_to_object (monitor_ior);
CosNotification::NotificationServiceMonitorControl_var nsm =
CosNotification::NotificationServiceMonitorControl::_narrow (obj.in ());
if (CORBA::is_nil (nsm.in ()))
{
ACE_ERROR_RETURN ((LM_ERROR,
"Monitor: Unable to locate the "
"Notification Service Monitor\n"),
1);
}
MonitorTestInterface_i* mti = 0;
ACE_NEW_RETURN (mti, MonitorTestInterface_i (nsm.in ()), 1);
PortableServer::ServantBase_var owner_transfer (mti);
CORBA::Object_var poa_object =
orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa =
PortableServer::POA::_narrow (poa_object.in ());
PortableServer::ObjectId_var id = root_poa->activate_object (mti);
CORBA::Object_var object = root_poa->id_to_reference (id.in ());
MonitorTestInterface_var test =
MonitorTestInterface::_narrow (object.in ());
CORBA::String_var ior = orb->object_to_string (test.in ());
// Test the case where there are no consumers or suppliers first
// before we write out our IOR
mti->running (MonitorTestInterface::NotifyService);
FILE *output_file= ACE_OS::fopen (ACE_TEXT_ALWAYS_CHAR(ior_output_file), ACE_TEXT ("w"));
if (output_file == 0)
{
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot open output file for writing IOR: %s\n",
ior_output_file),
1);
}
ACE_OS::fprintf (output_file, "%s", ior.in ());
ACE_OS::fclose (output_file);
PortableServer::POAManager_var poa_manager =
root_poa->the_POAManager ();
poa_manager->activate ();
orb->run ();
orb->destroy ();
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("test_monitor: ");
status++;
}
#else
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
#endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */
return status;
}
示例3: owner_transfer
int
TAO_MonitorManager::ORBTask::svc (void)
{
try
{
if (CORBA::is_nil (this->orb_.in ()))
{
ORBSVCS_ERROR_RETURN ((LM_ERROR,
"(%P|%t) TAO_MonitorManager: Unable to "
"initialize the ORB\n"),
1);
}
PortableServer::POA_var poa;
{
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->mutex_, -1);
CORBA::Object_var obj =
this->orb_->resolve_initial_references ("RootPOA");
poa = PortableServer::POA::_narrow (obj.in ());
if (CORBA::is_nil (poa.in ()))
{
ORBSVCS_ERROR_RETURN ((LM_ERROR,
"(%P|%t) TAO_MonitorManager: Unable to "
"resolve the RootPOA\n"),
1);
}
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
// Activate the object
NotificationServiceMonitor_i* servant;
ACE_NEW_RETURN (servant,
NotificationServiceMonitor_i (this->orb_.in ()), 1);
PortableServer::ServantBase_var owner_transfer(servant);
PortableServer::ObjectId_var id = poa->activate_object (servant);
// Register the object with the IORTable
obj = poa->id_to_reference (id.in ());
CosNotification::NotificationServiceMonitorControl_var monitor =
CosNotification::NotificationServiceMonitorControl::_narrow (obj.in ());
CORBA::String_var ior = this->orb_->object_to_string (monitor.in ());
obj = this->orb_->resolve_initial_references ("IORTable");
IORTable::Table_var iortable = IORTable::Table::_narrow (obj.in ());
if (CORBA::is_nil (iortable.in ()))
{
ORBSVCS_ERROR_RETURN ((LM_ERROR,
"(%P|%t) TAO_MonitorManager: Unable to "
"resolve the IORTable\n"),
1);
}
iortable->bind(ACE_TEXT_ALWAYS_CHAR(mc_orb_name_.c_str()), ior.in ());
if (this->use_name_svc_)
{
TAO_Naming_Client nc;
nc.init (this->orb_.in ());
CosNaming::Name name (1);
name.length (1);
name[0].id = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(mc_orb_name_.c_str()));
nc->rebind (name, monitor.in ());
}
if (this->ior_output_.length () > 0)
{
FILE* fp = ACE_OS::fopen (this->ior_output_.c_str (), "w");
if (fp == 0)
{
ORBSVCS_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("(%P|%t) TAO_MonitorManager: "
ACE_TEXT ("Unable to write to %s\n")),
this->ior_output_.c_str ()),
1);
}
else
{
ACE_OS::fprintf (fp, "%s", ior.in ());
ACE_OS::fclose (fp);
}
}
}
// R1: race condition (partially fixed):
// TAO_MonitorManager::fini() is called directly after
// TAO_MonitorManager::run(), the shutdown call on the ORB could
// happen but the ORB::run() loop won't exit.
startup_barrier_.wait ();
this->orb_->run ();
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->mutex_, -1);
// Destroy the POA and ORB
if (!CORBA::is_nil (poa.in ()))
//.........这里部分代码省略.........