当前位置: 首页>>代码示例>>C++>>正文


C++ SimpleClient::get_object方法代码示例

本文整理汇总了C++中SimpleClient::get_object方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleClient::get_object方法的具体用法?C++ SimpleClient::get_object怎么用?C++ SimpleClient::get_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleClient的用法示例。


在下文中一共展示了SimpleClient::get_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc,char* argv[])
{
    // create instance of SimpleClient and init() it.
    SimpleClient ci;
    if(ci.init(argc,argv) == 0)
	{
	ACE_DEBUG((LM_DEBUG,"Cannot init client"));
	return -1;
	}
    ci.login();

    
    try
	{
	// get reference to Clock device
	CORBA::Object_var obj = ci.get_object("CLOCK1",0,true);
	if(CORBA::is_nil(obj.in())) 
	    {
	    return -1;
	    }

	// narrow object to obtain Clock reference
	acstime::Clock_var dev = acstime::Clock::_narrow(obj.in());
	
	if (CORBA::is_nil(dev.in())) 
	    {
	    std::cerr << "Nil Clock reference" << std::endl;
	    return -1;
	    }
	
	//---------------------------------------------------------------
	ACSErr::Completion_var completion;
	ACSErr::Completion* c;
	int rtnVal;
	
	// get pointer to array2TAI Property
	ACS::RWlong_ptr p_a2t = dev->array2TAI();
	

	for (int i = 0; i < 200; i = (i + 1) * 2)
	    {
	    // set array2TAI value
	    c = p_a2t->set_sync(i);
	    
	    if (c->code == 0)
		cout << "Set array2TAI=" << i << endl;
	    else
		cout << "ERROR array2TAI=" << c->code << endl;
	    
	    // get array2TAI value
	    rtnVal = p_a2t->get_sync(completion.out());
	    
	    if (completion->code != 0)
		cout << "ERROR array2TAI get=" << completion->code << endl;
	    else
		{
		cout << "Got array2TAI=" << rtnVal << endl;
		if (i != rtnVal)
		    cout << "ERROR array2TAI get != set" << endl;
		}
	    }
	
	// get pointer to TAI2UTC Property
	ACS::RWlong_ptr p_t2u = dev->TAI2UTC();
	
	
	for (int i = 0; i < 200; i = (i + 1) * 2)
	    {
	    // set TAI2UTC value
	    c = p_t2u->set_sync(i);
	    
	    if (c->code == 0)
		cout << "Set TAI2UTC=" << i << endl;
	    else
		cout << "ERROR TAI2UTC=" << c->code << endl;

	    // get TAI2UTC value
	    rtnVal = p_t2u->get_sync(completion.out());
	    
	    if (completion->code != 0)
		cout << "ERROR TAI2UTC get=" << completion->code << endl;
	    else
		{
		cout << "Got TAI2UTC=" << rtnVal << endl;
		if (i != rtnVal)
		    cout << "ERROR TAI2UTC get != set" << endl;
		}
	    }
	}
    catch( CORBA::Exception &ex )
	{
	ACE_PRINT_EXCEPTION(ex,"Error!");
        ci.logout();
	return -1;
	}

    ci.logout();
    return 0;
}
开发者ID:franciscobeltran,项目名称:ACS,代码行数:99,代码来源:testProp.cpp


注:本文中的SimpleClient::get_object方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。