本文整理汇总了C++中rteceventcomm::PushSupplier_var::in方法的典型用法代码示例。如果您正苦于以下问题:C++ PushSupplier_var::in方法的具体用法?C++ PushSupplier_var::in怎么用?C++ PushSupplier_var::in使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rteceventcomm::PushSupplier_var
的用法示例。
在下文中一共展示了PushSupplier_var::in方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Test_Supplier::connect (const char* name,
int event_a,
int event_b,
RtecEventChannelAdmin::EventChannel_ptr ec)
{
this->supplier_id_ = ACE::crc32 (name);
ACE_DEBUG ((LM_DEBUG,
"ID for <%s> is %04.4x\n",
name,
this->supplier_id_));
ACE_SupplierQOS_Factory qos;
qos.insert (this->supplier_id_,
event_a,
0, 1);
qos.insert (this->supplier_id_,
event_b,
0, 1);
qos.insert (this->supplier_id_,
ACE_ES_EVENT_SHUTDOWN,
0, 1);
RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
ec->for_suppliers ();
this->consumer_proxy_ =
supplier_admin->obtain_push_consumer ();
RtecEventComm::PushSupplier_var objref =
this->supplier_._this ();
this->consumer_proxy_->connect_push_supplier (objref.in (),
qos.get_SupplierQOS ());
}
示例2:
void
Loopback_Supplier::connect (RtecEventChannelAdmin::EventChannel_ptr ec)
{
RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
ec->for_suppliers ();
{
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
if (!CORBA::is_nil (this->proxy_consumer_.in ()))
return;
this->proxy_consumer_ =
supplier_admin->obtain_push_consumer ();
}
RtecEventComm::PushSupplier_var supplier =
this->_this ();
RtecEventChannelAdmin::SupplierQOS supplier_qos;
supplier_qos.is_gateway = 0;
supplier_qos.publications.length (1);
RtecEventComm::EventHeader& sh0 =
supplier_qos.publications[0].event.header;
sh0.type = this->response_type_;
sh0.source = this->experiment_id_;
this->proxy_consumer_->connect_push_supplier (supplier.in (),
supplier_qos);
}
示例3:
void
Supplier::connect (RtecEventChannelAdmin::EventChannel_ptr ec)
{
RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
ec->for_suppliers ();
{
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
if (!CORBA::is_nil (this->proxy_consumer_.in ()))
return;
this->proxy_consumer_ =
supplier_admin->obtain_push_consumer ();
}
RtecEventComm::PushSupplier_var supplier =
this->_this ();
RtecEventChannelAdmin::SupplierQOS supplier_qos;
supplier_qos.is_gateway = 0;
supplier_qos.publications.length (this->event_range_);
for (CORBA::Long i = 0; i != this->event_range_; ++i)
{
RtecEventComm::EventHeader& sh =
supplier_qos.publications[i].event.header;
sh.type = this->event_type_ + 2 * i;
sh.source = this->experiment_id_;
}
this->proxy_consumer_->connect_push_supplier (supplier.in (),
supplier_qos);
}
示例4:
void
EC_Counting_Supplier::connect (
RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin,
const RtecEventChannelAdmin::SupplierQOS &qos)
{
RtecEventComm::PushSupplier_var supplier =
this->_this ();
if (CORBA::is_nil (this->consumer_proxy_.in ()))
{
this->consumer_proxy_ =
supplier_admin->obtain_push_consumer ();
}
this->consumer_proxy_->connect_push_supplier (supplier.in (),
qos);
}
示例5: catch
void
TAO_EC_Default_ProxyPushConsumer::disconnect_push_consumer ()
{
RtecEventComm::PushSupplier_var supplier;
int connected = 0;
{
ACE_GUARD_THROW_EX (
ACE_Lock, ace_mon, *this->lock_,
CORBA::INTERNAL ());
// @@ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
connected = this->is_connected_i ();
supplier = this->supplier_._retn ();
this->connected_ = 0;
if (connected)
this->cleanup_i ();
}
// Notify the event channel...
this->event_channel_->disconnected (this);
if (CORBA::is_nil (supplier.in ()))
{
return;
}
if (this->event_channel_->disconnect_callbacks ())
{
try
{
supplier->disconnect_push_supplier ();
}
catch (const CORBA::Exception&)
{
// Ignore exceptions, we must isolate other clients from
// failures on this one.
}
}
}
示例6: init
int PushSupplier_impl::init(RtecEventChannelAdmin::EventChannel_ptr channel)
{
ACE_DEBUG((LM_DEBUG, "for_suppliers\n"));
RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
channel->for_suppliers();
ACE_DEBUG((LM_DEBUG, "obtain_push_consumer\n"));
consumer_ =
supplier_admin->obtain_push_consumer();
ACE_DEBUG((LM_DEBUG, "got push_consumer with %d profiles\n",
consumer_->_stubobj ()->base_profiles ().profile_count ()));
RtecEventChannelAdmin::SupplierQOS qos;
qos.publications.length (1);
RtecEventComm::EventHeader& h0 =
qos.publications[0].event.header;
h0.type = ACE_ES_EVENT_UNDEFINED; // first free event type
h0.source = 1; // first free event source
RtecEventComm::PushSupplier_var supplier = _this();
ACE_DEBUG((LM_DEBUG, "connect_push_supplier\n"));
consumer_->connect_push_supplier(supplier.in(),
qos);
ACE_DEBUG((LM_DEBUG, "push_consumer connected\n"));
if (!reactor_task_.thr_count() &&
reactor_task_.activate (THR_NEW_LWP | THR_JOINABLE, 1) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"Cannot activate reactor thread\n"),
-1);
return 0;
}
示例7:
void
Supplier::connect (RtecEventChannelAdmin::SupplierAdmin_ptr supplier_admin)
{
this->proxy_ =
supplier_admin->obtain_push_consumer ();
RtecEventComm::PushSupplier_var me =
this->_this ();
// Simple publication, but usually the helper classes in
// $TAO_ROOT/orbsvcs/Event_Utils.h are a better way to do this.
RtecEventChannelAdmin::SupplierQOS qos;
qos.is_gateway = 0;
qos.publications.length (1);
RtecEventComm::EventHeader& h0 =
qos.publications[0].event.header;
h0.type = ACE_ES_EVENT_UNDEFINED; // first free event type
h0.source = 1; // first free event source
this->proxy_->connect_push_supplier (me.in (), qos);
}
示例8: catch
void
TAO_EC_ProxyPushConsumer::shutdown (void)
{
RtecEventComm::PushSupplier_var supplier;
{
ACE_GUARD_THROW_EX (
ACE_Lock, ace_mon, *this->lock_,
RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
supplier = this->supplier_._retn ();
this->connected_ = false;
this->shutdown_hook ();
if (this->filter_ != 0)
{
this->filter_->shutdown ();
this->cleanup_i ();
}
}
this->deactivate ();
if (CORBA::is_nil (supplier.in ()))
return;
try
{
supplier->disconnect_push_supplier ();
}
catch (const CORBA::Exception&)
{
// Ignore exceptions, we must isolate other clients from
// failures on this one.
}
}
示例9: main
int main (int argc, char* argv[])
{
try
{
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// Find the Naming Service.
CORBA::Object_var obj = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var naming_client = CosNaming::NamingContextExt::_narrow(obj.in());
// Get the Event Channel using Naming Services
obj = naming_client->resolve_str("EventService");
// Downcast the object reference to an EventChannel reference.
RtecEventChannelAdmin::EventChannel_var ec =
RtecEventChannelAdmin::EventChannel::_narrow(obj.in());
if (CORBA::is_nil(ec.in())) {
cerr << "Could not resolve EchoEventChannel." << endl;
return 1;
}
// Get a SupplierAdmin object from the EventChannel.
RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers();
// Get a ProxyPushConsumer from the SupplierAdmin.
RtecEventChannelAdmin::ProxyPushConsumer_var consumer =
admin->obtain_push_consumer();
// Get the RootPOA.
obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow(obj.in());
// Instantiate an EchoEventConsumer_i servant.
EchoEventSupplier_i servant(orb.in());
// Register it with the RootPOA.
PortableServer::ObjectId_var oid = poa->activate_object(&servant);
CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in());
RtecEventComm::PushSupplier_var supplier =
RtecEventComm::PushSupplier::_narrow(supplier_obj.in());
// Publish the events the supplier provides.
ACE_SupplierQOS_Factory qos;
qos.insert (MY_SOURCE_ID, // Supplier's unique id
MY_EVENT_TYPE, // Event type
0, // handle to the rt_info structure
1); // number of calls
// Connect as a supplier of the published events.
consumer->connect_push_supplier (supplier.in (),
qos.get_SupplierQOS ());
// Activate the POA via its POAManager.
PortableServer::POAManager_var poa_manager = poa->the_POAManager();
poa_manager->activate();
// Create an event (just a string in this case).
const CORBA::String_var eventData = CORBA::string_dup("Hello, world.");
// Create an event set for one event
RtecEventComm::EventSet events (1);
events.length (1);
// Initialize event header.
events[0].header.source = MY_SOURCE_ID;
events[0].header.type = MY_EVENT_TYPE;
// Initialize data fields in event.
events[0].data.any_value <<= eventData;
cout << "Supplier starting sending of events" << endl;
while (1) {
consumer->push (events);
ACE_Time_Value tv(0, 1000 * EVENT_DELAY_MS);
orb->run(tv);
}
orb->destroy();
return 0;
}
catch (CORBA::Exception& ex)
{
cerr << "Supplier::main() Caught CORBA::Exception" << endl << ex << endl;
}
return 1;
}
示例10: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the EC Factory so we can customize the EC
TAO_EC_Default_Factory::init_svcs ();
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
const ACE_TCHAR* ecname = ACE_TEXT ("EventService");
const ACE_TCHAR* remote_ecname = 0;
const ACE_TCHAR* iorfile = 0;
for (int i = 0; argv[i] != 0; i++) {
if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) {
if (argv[i+1] != 0) {
i++;
ecname = argv[i];
} else {
std::cerr << "Missing Event channel name" << std::endl;
}
}
if (ACE_OS::strcmp(argv[i], ACE_TEXT("-gateway")) == 0) {
if (argv[i+1] != 0) {
i++;
remote_ecname = argv[i];
} else {
std::cerr << "Missing Event channel name" << std::endl;
}
}
if (ACE_OS::strcmp(argv[i], ACE_TEXT("-iorfile")) == 0) {
if (argv[i+1] != 0) {
i++;
iorfile = argv[i];
}
}
}
// Get the POA
CORBA::Object_var object = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
// Spawn a thread for the orb
ACE_Thread_Manager *thread_mgr = ACE_Thread_Manager::instance();
thread_mgr->spawn(orb_thread, orb.in());
// Create a local event channel and register it with the RootPOA.
TAO_EC_Event_Channel_Attributes attributes (poa.in (), poa.in ());
PortableServer::Servant_var<TAO_EC_Event_Channel> ec_impl =
new TAO_EC_Event_Channel(attributes);
ec_impl->activate ();
PortableServer::ObjectId_var oid = poa->activate_object(ec_impl.in());
CORBA::Object_var ec_obj = poa->id_to_reference(oid.in());
RtecEventChannelAdmin::EventChannel_var ec =
RtecEventChannelAdmin::EventChannel::_narrow(ec_obj.in());
// Find the Naming Service.
object = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(object.in());
CosNaming::Name_var name = root_context->to_name (ACE_TEXT_ALWAYS_CHAR (ecname));
root_context->rebind(name.in(), ec.in());
// Get a SupplierAdmin object from the EventChannel.
RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers();
// Get a ProxyPushConsumer from the SupplierAdmin.
RtecEventChannelAdmin::ProxyPushConsumer_var consumer =
admin->obtain_push_consumer();
// Instantiate an EchoEventSupplier_i servant.
PortableServer::Servant_var<EchoEventSupplier_i> servant =
new EchoEventSupplier_i(orb.in());
// Register it with the RootPOA.
oid = poa->activate_object(servant.in());
CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in());
RtecEventComm::PushSupplier_var supplier =
RtecEventComm::PushSupplier::_narrow(supplier_obj.in());
// Publish the events the supplier provides.
ACE_SupplierQOS_Factory qos;
qos.insert (MY_SOURCE_ID, // Supplier's unique id
MY_EVENT_TYPE, // Event type
0, // handle to the rt_info structure
1); // number of calls
// Connect as a supplier of the published events.
consumer->connect_push_supplier (supplier.in (),
qos.get_SupplierQOS ());
// Create an event (just a string in this case).
const CORBA::String_var eventData = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (ecname));
// Create an event set for one event
RtecEventComm::EventSet event (1);
event.length (1);
// Initialize event header.
event[0].header.source = MY_SOURCE_ID;
//.........这里部分代码省略.........
示例11: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the EC Factory so we can customize the EC
TAO_EC_Default_Factory::init_svcs ();
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
const ACE_TCHAR *ecname = ACE_TEXT ("EventService");
const ACE_TCHAR *address = ACE_TEXT ("localhost");
const ACE_TCHAR *iorfile = 0;
u_short port = 12345;
u_short listenport = 12345;
int mcast = 1;
for (int i = 0; argv[i] != 0; i++)
{
if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-ecname")) == 0)
{
if (argv[i+1] != 0)
ecname = argv[++i];
else
ACE_ERROR_RETURN ((LM_ERROR, "Missing Event channel name\n"),0);
}
else if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-address")) == 0)
{
if (argv[i+1] != 0)
address = argv[++i];
else
ACE_ERROR_RETURN ((LM_ERROR, "Missing address\n"),0);
}
else if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-port")) == 0)
{
if (argv[i+1] != 0)
port = ACE_OS::atoi(argv[++i]);
else
ACE_ERROR_RETURN ((LM_ERROR, "Missing port\n"),0);
}
else if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-listenport")) == 0)
{
if (argv[i+1] != 0)
listenport = ACE_OS::atoi(argv[++i]);
else
ACE_ERROR_RETURN ((LM_ERROR, "Missing port\n"), 0);
}
else if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-iorfile")) == 0)
{
if (argv[i+1] != 0)
iorfile = argv[++i];
else
ACE_ERROR_RETURN ((LM_ERROR, "Missing ior file\n"), 0);
}
else if (ACE_OS::strcasecmp(argv[i], ACE_TEXT ("-udp")) == 0)
mcast = 0;
}
// Get the POA
CORBA::Object_var tmpobj = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow (tmpobj.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
// Create a local event channel and register it
TAO_EC_Event_Channel_Attributes attributes (poa.in (), poa.in ());
TAO_EC_Event_Channel ec_impl (attributes);
ec_impl.activate ();
PortableServer::ObjectId_var oid = poa->activate_object(&ec_impl);
tmpobj = poa->id_to_reference(oid.in());
RtecEventChannelAdmin::EventChannel_var ec =
RtecEventChannelAdmin::EventChannel::_narrow(tmpobj.in());
// Find the Naming Service.
tmpobj = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var root_context =
CosNaming::NamingContextExt::_narrow(tmpobj.in());
// Bind the Event Channel using Naming Services
CosNaming::Name_var name =
root_context->to_name (ACE_TEXT_ALWAYS_CHAR (ecname));
root_context->rebind(name.in(), ec.in());
// Get a proxy push consumer from the EventChannel.
RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers();
RtecEventChannelAdmin::ProxyPushConsumer_var consumer =
admin->obtain_push_consumer();
// Instantiate an EchoEventSupplier_i servant.
EchoEventSupplier_i servant(orb.in());
// Register it with the RootPOA.
oid = poa->activate_object(&servant);
tmpobj = poa->id_to_reference(oid.in());
RtecEventComm::PushSupplier_var supplier =
RtecEventComm::PushSupplier::_narrow(tmpobj.in());
// Connect to the EC.
ACE_SupplierQOS_Factory qos;
//.........这里部分代码省略.........
示例12: schedule_name
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
TAO_EC_Default_Factory::init_svcs ();
try
{
// ORB initialization boiler plate...
CORBA::ORB_var orb =
CORBA::ORB_init (argc, argv);
if (parse_args (argc, argv) == -1)
{
ACE_ERROR ((LM_ERROR,
"Usage: Service [-o IOR_file_name]\n"));
return 1;
}
CORBA::Object_var object =
orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa =
PortableServer::POA::_narrow (object.in ());
PortableServer::POAManager_var poa_manager =
poa->the_POAManager ();
poa_manager->activate ();
// ****************************************************************
#if 0
// Obtain a reference to the naming service...
CORBA::Object_var naming_obj =
orb->resolve_initial_references ("NameService");
CosNaming::NamingContext_var naming_context =
CosNaming::NamingContext::_narrow (naming_obj.in ());
#endif /* 0 */
// ****************************************************************
// Create an scheduling service
POA_RtecScheduler::Scheduler* sched_impl = 0;
if (config_run)
{
ACE_NEW_RETURN (sched_impl,
RECONFIG_SCHED_TYPE,
1);
}
else
{
ACE_NEW_RETURN (sched_impl,
RECONFIG_SCHED_TYPE (configs_size,
configs,
infos_size,
infos,
0, 0,
0),
1);
}
RtecScheduler::Scheduler_var scheduler =
sched_impl->_this ();
#if 0
// Bind the scheduler with the naming service so clients
// (consumers and suppliers) can resolve it, some (old)
// implementations of the EC will try to do the same thing
// (yikes!)
CosNaming::Name schedule_name (1);
schedule_name.length (1);
schedule_name[0].id = CORBA::string_dup ("ScheduleService");
// Register the servant with the Naming Context....
naming_context->rebind (schedule_name, scheduler.in ());
#endif /* 0 */
// ****************************************************************
TAO_EC_Event_Channel_Attributes attributes (poa.in (),
poa.in ());
attributes.scheduler = scheduler.in (); // no need to dup
TAO_EC_Event_Channel ec_impl (attributes);
ACE_DEBUG ((LM_DEBUG, "activating EC\n"));
ec_impl.activate ();
ACE_DEBUG ((LM_DEBUG, "EC activated\n"));
RtecEventChannelAdmin::EventChannel_var event_channel =
ec_impl._this ();
// ****************************************************************
// Create a consumer, intialize its RT_Info structures, and
// connnect to the event channel....
Consumer consumer_impl;
RtecScheduler::handle_t consumer_rt_info1 =
scheduler->create ("consumer_event_1");
// Let's say that the execution time for event 1 is 2
// milliseconds...
//.........这里部分代码省略.........
示例13: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
try
{
// Initialize the EC Factory so we can customize the EC
TAO_EC_Default_Factory::init_svcs ();
// Initialize the ORB.
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
const ACE_TCHAR* ecname = ACE_TEXT ("EventService");
const ACE_TCHAR* address = ACE_TEXT ("localhost");
const ACE_TCHAR* iorfile = 0;
u_short port = 12345;
u_short listenport = 12345;
int mcast = 1;
for (int i = 0; argv[i] != 0; i++) {
if (ACE_OS::strcmp(argv[i], ACE_TEXT("-ecname")) == 0) {
if (argv[i+1] != 0) {
i++;
ecname = argv[i];
} else {
std::cerr << "Missing Event channel name" << std::endl;
}
} else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-address")) == 0) {
if (argv[i+1] != 0) {
i++;
address = argv[i];
} else {
std::cerr << "Missing address" << std::endl;
}
} else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-port")) == 0) {
if (argv[i+1] != 0) {
i++;
port = ACE_OS::atoi(argv[i]);
} else {
std::cerr << "Missing port" << std::endl;
}
} else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-listenport")) == 0) {
if (argv[i+1] != 0) {
i++;
listenport = ACE_OS::atoi(argv[i]);
} else {
std::cerr << "Missing port" << std::endl;
}
} else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-iorfile")) == 0) {
if (argv[i+1] != 0) {
i++;
iorfile = argv[i];
}
} else if (ACE_OS::strcmp(argv[i], ACE_TEXT("-udp")) == 0) {
mcast = 0;
}
}
// Get the POA
CORBA::Object_var object = orb->resolve_initial_references ("RootPOA");
PortableServer::POA_var poa = PortableServer::POA::_narrow (object.in ());
PortableServer::POAManager_var poa_manager = poa->the_POAManager ();
poa_manager->activate ();
// Create a local event channel and register it
TAO_EC_Event_Channel_Attributes attributes (poa.in (), poa.in ());
PortableServer::Servant_var<TAO_EC_Event_Channel> ec_impl =
new TAO_EC_Event_Channel(attributes);
ec_impl->activate ();
PortableServer::ObjectId_var oid = poa->activate_object(ec_impl.in());
CORBA::Object_var ec_obj = poa->id_to_reference(oid.in());
RtecEventChannelAdmin::EventChannel_var ec =
RtecEventChannelAdmin::EventChannel::_narrow(ec_obj.in());
// Find the Naming Service.
CORBA::Object_var obj = orb->resolve_initial_references("NameService");
CosNaming::NamingContextExt_var root_context = CosNaming::NamingContextExt::_narrow(obj.in());
// Bind the Event Channel using Naming Services
CosNaming::Name_var name = root_context->to_name (ACE_TEXT_ALWAYS_CHAR (ecname));
root_context->rebind(name.in(), ec.in());
// Get a proxy push consumer from the EventChannel.
RtecEventChannelAdmin::SupplierAdmin_var admin = ec->for_suppliers();
RtecEventChannelAdmin::ProxyPushConsumer_var consumer =
admin->obtain_push_consumer();
// Instantiate an EchoEventSupplier_i servant.
PortableServer::Servant_var<EchoEventSupplier_i> servant =
new EchoEventSupplier_i(orb.in());
// Register it with the RootPOA.
oid = poa->activate_object(servant.in());
CORBA::Object_var supplier_obj = poa->id_to_reference(oid.in());
RtecEventComm::PushSupplier_var supplier =
RtecEventComm::PushSupplier::_narrow(supplier_obj.in());
// Connect to the EC.
ACE_SupplierQOS_Factory qos;
qos.insert (MY_SOURCE_ID, MY_EVENT_TYPE, 0, 1);
consumer->connect_push_supplier (supplier.in (), qos.get_SupplierQOS ());
//.........这里部分代码省略.........
示例14: tv
void
Test_Supplier::connect (RtecScheduler::Scheduler_ptr scheduler,
const char* name,
int burst_count,
int burst_size,
int event_size,
int burst_pause,
int type_start,
int type_count,
RtecEventChannelAdmin::EventChannel_ptr ec)
{
this->burst_count_ = burst_count;
this->burst_size_ = burst_size;
this->event_size_ = event_size;
this->burst_pause_ = burst_pause;
this->type_start_ = type_start;
this->type_count_ = type_count;
RtecScheduler::handle_t rt_info =
scheduler->create (name);
ACE_Time_Value tv (0, burst_pause);
RtecScheduler::Period_t rate = tv.usec () * 10;
// The execution times are set to reasonable values, but
// actually they are changed on the real execution, i.e. we
// lie to the scheduler to obtain right priorities; but we
// don't care if the set is schedulable.
tv.set (0, 2000);
TimeBase::TimeT time;
ORBSVCS_Time::Time_Value_to_TimeT (time, tv);
scheduler->set (rt_info,
RtecScheduler::VERY_HIGH_CRITICALITY,
time, time, time,
rate,
RtecScheduler::VERY_LOW_IMPORTANCE,
time,
1,
RtecScheduler::OPERATION);
this->supplier_id_ = ACE::crc32 (name);
ACE_DEBUG ((LM_DEBUG, "ID for <%s> is %04.4x\n", name,
this->supplier_id_));
ACE_SupplierQOS_Factory qos;
for (int i = 0; i != type_count; ++i)
{
qos.insert (this->supplier_id_,
type_start + i,
rt_info, 1);
}
qos.insert (this->supplier_id_,
ACE_ES_EVENT_SHUTDOWN,
rt_info, 1);
RtecEventChannelAdmin::SupplierAdmin_var supplier_admin =
ec->for_suppliers ();
this->consumer_proxy_ =
supplier_admin->obtain_push_consumer ();
RtecEventComm::PushSupplier_var objref =
this->supplier_._this ();
this->consumer_proxy_->connect_push_supplier (objref.in (),
qos.get_SupplierQOS ());
}