本文整理汇总了C++中corba::ORB_var::ptr方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::ptr方法的具体用法?C++ ORB_var::ptr怎么用?C++ ORB_var::ptr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_var
的用法示例。
在下文中一共展示了ORB_var::ptr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: acserrOldTestServer
int acserrOldTestServer (char *szCmdLn){
ACE_OS_Object_Manager ace_os_object_manager;
ACE_Object_Manager ace_object_manager;
int argc;
char *argv[100];
argc = argUnpack(szCmdLn, argv);
argv[0] = "acserrOldTestServer";
#else
int acserrOldTestServer (int argc, char *argv[]){
#endif // defined( MAKE_VXWORKS )
if (argc<2){
ACE_OS::printf ("usage: errorServer <server_name> [destination_server_name] \n");
return -1;
}
ACE_OS::signal(SIGINT, TerminationSignalHandler); // Ctrl+C
ACE_OS::signal(SIGTERM, TerminationSignalHandler); // termination request
// create logging proxy
LoggingProxy m_logger (0, 0, 31, 0);
LoggingProxy::init (&m_logger);
// creating ORB
ACS_TEST_INIT_CORBA;
// init ACS error system (and inside also logging)
ACSError::init (orb.ptr());
try
{
//Get a reference to the RootPOA
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in());
PortableServer::POAManager_var poa_manager = root_poa->the_POAManager();
#ifdef MAKE_VXWORKS
ACSError::processName (szCmdLn);
#else
char *buf;
ACE_OS::argv_to_string (argv, buf);
ACSError::processName (buf);
delete[] buf;
#endif
ACS_DEBUG ("errorServer", "Creating test object ...");
acserrOldTest_var dest;
if (argc>2){
ACS_DEBUG ("errorServer", "Getting object reference ... ");
char refName[64];
sprintf(refName, "file://%s.ior", argv[2]);
CORBA::Object_var destObj = orb->string_to_object (refName);
ACS_DEBUG ("errorServer", "Narrowing it .... ");
dest = acserrOldTest::_narrow (destObj.in());
}//if
acserrOldTestImpl esTest (dest.in(), argv[1]);
acserrOldTest_var testObj = esTest._this ();
poa_manager->activate ();
ACS_DEBUG ("errorServer","POA Manager -> activate");
ACS_DEBUG_PARAM ("errorServer", "Writing ior to the file: %s .... ", argv[1]);
char* ior = orb->object_to_string (testObj.in());
char fileName[64];
sprintf(fileName, "%s.ior", argv[1]);
FILE *output_file = ACE_OS::fopen (fileName, "w");
if (output_file == 0) {
ACS_SHORT_LOG((LM_ERROR,
"Cannot open output files for writing IOR: ior.ior"));
return -1;
}
int result = ACE_OS::fprintf (output_file, "%s", ior);
if (result < 0) {
ACS_SHORT_LOG ((LM_ERROR,
"ACE_OS::fprintf failed while writing %s to ior.ior\n", ior));
return -1;
}
ACE_OS::fclose (output_file);
ACS_DEBUG ("errorServer", "Waiting for requests ...");
orb->run ();
}
catch( CORBA::Exception &ex )
{
//.........这里部分代码省略.........
示例2: main
int main(int argc, char *argv[])
{
if (argc<4){
ACE_OS::printf ("usage: testClient <server_name> <depth> <isError> [iteration]\n");
return -1;
}//if
// create logging proxy
LoggingProxy m_logger (0, 0, 31, 0);
LoggingProxy::init (&m_logger);
CORBA::ORB_var orb;
ACS_TEST_INIT_CORBA;
// init ACS error system
ACSError::init (orb.ptr());
/**************************************/
acserrOldTest_var test;
int depth;
sscanf (argv[2], "%d", &depth);
bool isErr = *argv[3]-'0';
int iteration=1, i=1;
const int size = 20; // max value 1.84 x 10^19
char printBuf[size+1];
if (argc>4)
sscanf (argv[4], "%d", &iteration);
ACS_DEBUG("main", "****** Test Block *****");
try
{
ACS_DEBUG("acserrOldTestClient", "Getting object reference ... ");
char fileName[64];
sprintf(fileName, "file://%s.ior", argv[1]);
CORBA::Object_var testObj = orb->string_to_object (fileName);
ACS_DEBUG("acserrOldTestClient", "Narrowing it .... ");
test = acserrOldTest::_narrow (testObj.in());
unsigned long long numToPrint;
while( iteration >= i ){
ACS_SHORT_LOG((LM_INFO, "Performing test1 (remote call)... (%d/%d)", i, iteration));
ACSErr::ErrorTrace *c = test->test (depth, isErr);
ACSError error(c, true);
ACS_SHORT_LOG((LM_INFO, "Stack depth: %d", error.getDepth()));
error.log();
//ACSError *error = new ACSError (c, true) -> new ACS_ERROR (c, true);
while (c!=NULL){
ACS_SHORT_LOG((LM_INFO, "FileName: \"%s\"",error.getFileName()));
ACS_SHORT_LOG((LM_INFO, "LineNumber: \"%d\"",error.getLineNumber()));
ACS_SHORT_LOG((LM_INFO, "Routine: \"%s\"",error.getRoutine()));
ACS_SHORT_LOG((LM_INFO, "HostName: \"%s\"",error.getHostName()));
ACS_SHORT_LOG((LM_INFO, "Process: \"%s\"",error.getProcess()));
ACS_SHORT_LOG((LM_INFO, "Thread: \"%s\"",error.getThread()));
for (int ii = 0; ii < size; ii++) printBuf[ii] = ' ';
printBuf[size] = '\0';
numToPrint = error.getTimeStamp();
for (int ii = size - 1; ii >= 0; ii--) {
printBuf[ii] = numToPrint % 10 + '0';
numToPrint /= 10;
if (numToPrint == 0)
break;
}
ACS_SHORT_LOG((LM_INFO, "TimeStamp: \"%s\"",printBuf));
ACS_SHORT_LOG((LM_INFO, "ErrorType: \"%d\"",error.getErrorType()));
ACS_SHORT_LOG((LM_INFO, "ErrorCode: \"%d\"",error.getErrorCode()));
ACS_SHORT_LOG((LM_INFO, "Severity: \"%d\"", error.getSeverity()));
ACS_SHORT_LOG((LM_INFO, "Description: \"%s\"",error.getDescription()));
c = error.getNext();
}
i++;
}//while
}
catch( CORBA::Exception &ex)
{
ACE_PRINT_EXCEPTION (ex, "EXCEPTION CAUGHT");
return -1;
}
ACS_SHORT_LOG((LM_INFO, "Test1 performed."));
//test2
i=1;
while (i<=iteration){
try
{
ACS_SHORT_LOG((LM_INFO,
"Performing test2 (remote call - exceptions) ... (%d/%d)", i, iteration));
test->testExceptions (depth, isErr);
}
catch (ACSErr::ACSException &ex)
//.........这里部分代码省略.........