本文整理汇总了C++中corba::ORB_var::lookup_value_factory方法的典型用法代码示例。如果您正苦于以下问题:C++ ORB_var::lookup_value_factory方法的具体用法?C++ ORB_var::lookup_value_factory怎么用?C++ ORB_var::lookup_value_factory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corba::ORB_var
的用法示例。
在下文中一共展示了ORB_var::lookup_value_factory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//
// cleaner object for a ValueFactory
//
ValueFactoryCleaner::ValueFactoryCleaner (class CORBA::ValueFactoryBase* factory, char* repid)
: factory_ (factory), is_registered_(false), repid_(repid)
{
int dummy = 0;
CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0);
// check whether there is already a factory
if (orb->lookup_value_factory( repid ))
{
DEBUG_OUT3("..... factory for ", repid, " already registered");
}
else
{
DEBUG_OUT2( "..... register factory for ", repid );
orb->register_value_factory( repid, factory_ );
is_registered_ = true;
}
}
示例2: main
int main(int argc, char** argv)
{
try {
#ifdef CORBA_ORB_INIT_HAVE_3_ARGS
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv,CORBA_ORB_INIT_THIRD_ARG);
#else
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
#endif
initUAKGQuery2(orb.in());
CORBA::ValueFactory vf=orb->lookup_value_factory(
"IDL:gradsoft.kiev.ua/UAKGQuery2/RecordSet:1.0");
recordSetFactory=RecordSet_init::_downcast(vf);
if (recordSetFactory==NULL) {
cerr << "Internal error: can't find valuetype factory for RecordSet"
<< endl;
return 1;
}
CORBA::Object_var obj;
try {
obj = orb->resolve_initial_references("UAKGQueryService");
}catch(const CORBA::ORB::InvalidName&){
cerr << argv[0] << ": can't resolve UAKGQueryService" << endl;
return 1;
}
if(CORBA::is_nil(obj)) {
cerr << argv[0] << ": UAKGQueryService is a nil object reference" << endl;
return 1;
}
DBConnectionManager_var dbManager = DBConnectionManager::_narrow(obj);
if (CORBA::is_nil(dbManager)) {
cerr << argv[0] << ": can't narrow dbManager to correct type" << endl;
return 1;
}
QueryManager_var queryManager;
try {
queryManager =
dbManager->create_query_manager("scott","tiger","","Oracle8","");
}catch(QueryManagerNotFound){
cerr << argv[0] <<": can't find query manager." << endl;
return 1;
}
run_query(queryManager);
//time to disconnect.
//
cout << "disconnecting." << endl;
queryManager->destroy();
orb->destroy();
}catch(const CORBA::SystemException& ex){
cerr << ex << endl;
return 1;
}
return 0;
}
示例3: main
int main(int argc, char* argv[])
{
if ( parse_options( argc, argv ) ) {
usage(); return 0;
}
try {
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
initUAKGQuery2(orb.in());
#ifdef UAKGQUERY_2
CORBA::ValueFactory vf=orb->lookup_value_factory(
"IDL:gradsoft.kiev.ua/UAKGQuery2/RecordSet:1.0");
recordSetFactory=RecordSet_init::_downcast(vf);
if (recordSetFactory==NULL) {
cerr << "Internal error: can't find valuetype factory for RecordSet"
<< endl;
return 1;
}
vf=orb->lookup_value_factory(
"IDL:gradsoft.kiev.ua/UAKGQuery2/Numeric:1.0");
numericFactory=Numeric_init::_downcast(vf);
if (numericFactory==NULL) {
cerr << "Internal error: can't find valuetype factory for Numeric"
<< endl;
return 1;
}
#endif
CORBA::Object_var obj;
try {
obj = orb->resolve_initial_references("UAKGQueryService2");
} catch(const CORBA::ORB::InvalidName& ex){
cerr << argv[0] << ": can't resolve UAKGQueryService" << endl;
return 1;
}
if(CORBA::is_nil(obj)) {
cerr << argv[0]
<< ": UAKGQueryService is a nil object reference" << endl;
return 1;
}
DBConnectionManager_var dbManager = DBConnectionManager::_narrow(obj);
if (CORBA::is_nil(dbManager)) {
cerr << argv[0] << ": can't narrow dbManager to correct type" << endl;
return 1;
}
QueryManager_var queryManager;
try {
queryManager =
#ifdef UAKGQUERY_1
dbManager->createQueryManager
#endif
#ifdef UAKGQUERY_2
dbManager->create_query_manager
#endif
("scott",
"tiger",
"trolldb",
"Oracle8","");
}catch(QueryManagerNotFound){
cerr << argv[0] <<": can't find query manager." << endl;
return 1;
}
init();
test_query( queryManager );
query_delete_all( queryManager );
cout << "disconnecting." << endl;
queryManager->destroy();
// dbManager->shutdown();
orb->destroy();
}catch(const CORBA::SystemException& ex){
cerr << ex << endl;
return 1;
}
return 0;
}