Exemplo n.º 1
0
//-----------------------------------------------------------------------------//
std::string CCorbaErrorHelper::ToString(const CORBA::SystemException& err)
{
	std::string errDescription;
	TCHAR buf[50];
	memset(buf, 0, sizeof(TCHAR) * 50);
	
	CORBA::Any tmp;
	tmp <<= err;
	CORBA::TypeCode_var tc = tmp.type();

	errDescription = std::string(tc->name()) + _T(" Description: ") + err.NP_minorString();
	errDescription += _T(" Minor code: ");
	errDescription += _ltoa_s(err.minor(), buf, 50, 10);

	return errDescription;
}
Exemplo n.º 2
0
inline void et_CORBA_SystemException( const CORBA::SystemException & e ) {
	std::ostringstream os;
	os<<"CORBA system exception: ";
#if defined(MICO_VERSION)
	e._print(os);
#elif defined(OMNIORB_DIST_DATE)
	os<<"minor: "<<e.NP_minorString()<<"; completed: ";
	switch(e.completed()) {
	case CORBA::COMPLETED_YES: os<<"YES"; break;
	case CORBA::COMPLETED_NO: os<<"NO"; break;
	default: os<<"MAYBE";
	}
#else
	os<<"minor: "<<e.minor()<<"; completed: ";
	switch(e.completed()) {
	case CORBA::COMPLETED_YES: os<<"YES"; break;
	case CORBA::COMPLETED_NO: os<<"NO"; break;
	default: os<<"MAYBE";
	}
#endif
	BOOST_ERROR(os.str());
}
Exemplo n.º 3
0
int main()
{
	printf("start...\n");
	int a = 2;
	time_t sta_sec;
	sta_sec = time (NULL);
	printf("start:%d\n", sta_sec);
	Base_Bus::AccessCorbaDef_Impl obj(5555, "my_client_obj");
	CORBA::ORB& o = obj.getOrb();

	CORBA::String_var objToString((o.object_to_string((CORBA::Object *)&obj)) );
    printf("ObjectToString: %s\n", objToString.in() );
	
	printf("string_to_object bgn\n");
	CORBA::Object_var tmpVar = o.string_to_object("corbaloc::192.168.253.124:6000/my_first_obj");

	printf("string_to_object ok\n");

	CORBA::String_var objToString2((o.object_to_string(tmpVar)) );
    printf("ObjectToString2: %s\n", objToString2.in() );

    //omniORB::setClientCallTimeout(tmpVar, 20000);
	try
	{
		Base_Bus::IAccessCorbaDef_var objRep = Base_Bus::IAccessCorbaDef::_narrow(tmpVar);

		if ( !CORBA::is_nil(objRep) )
		{
			objRep->SetATestValue(Base_Bus::CorbaTypes::HighAlarm);
			objRep->SetATestValue(Base_Bus::CorbaTypes::OverScaleHighAlarm);
			objRep->SetATestValue(Base_Bus::CorbaTypes::GeneralAlarm);

			char s[1024];
			while (scanf("%s", &s))
			{
				if (s[0] == 'e')
					break;
				objRep->sendStringToSvt(s);
			}
		}
		CORBA::release(objRep);
	}
	catch( const CORBA::Exception& ex )
    {
		CORBA::SystemException* sysEx = CORBA::SystemException::_downcast((CORBA::SystemException *)&ex );
        if (sysEx == NULL)
        {
            throw 0;
        }
		const char* buf = sysEx->NP_minorString();
		if ( NULL != buf )
		{
			printf("[CL-21230] Caught COBAException: %s\n", buf);
		}

    }
    catch( ... )
    {
        
    }
	time_t end_sec;
	end_sec = time (NULL);
	printf("end_sec - sta_sec = %ds\n", end_sec - sta_sec);

	printf("end.\n");
	char c;
	while (scanf("%c", &c))
	{
		break;
	}
	return 0;
}
Exemplo n.º 4
0
void NamingContextHelper::putExceptionMessage(CORBA::SystemException& ex)
{
    os() << format("CORBA {0} ({1}), {2}.", ex._name(), ex._rep_id(), ex.NP_minorString()) << endl;
}
Exemplo n.º 5
0
void NamingContextHelper::putExceptionMessage(CORBA::SystemException& ex)
{
    os() << format("CORBA %1% (%2%), %3%.") %  ex._name() % ex._rep_id() % ex.NP_minorString() << endl;
}