Changeset 9914

Show
Ignore:
Timestamp:
02/25/10 13:56:33 (3 years ago)
Author:
shereef
Message:

a few component updates

Location:
ossiedev/trunk/components
Files:
13 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/components/Decimator/main.cpp

    r9807 r9914  
    2424#include <iostream> 
    2525#include <cstdlib> 
     26 
     27#ifndef HAVE_LEGACY 
     28#include <omniORB4/omniURI.h> 
     29#endif 
     30 
    2631#include "ossie/ossieSupport.h" 
     32#include "ossie/debug.h" 
    2733 
    2834#include "Decimator.h" 
     
    3137using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3238 
    33  
    3439int main(int argc, char* argv[]) 
    3540{ 
    3641    ossieDebugLevel = 3; 
    37     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    38     omni_mutex component_running_mutex; 
    39     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    40  
     42#ifdef HAVE_LEGACY 
    4143    if (argc != 3) { 
    4244        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4446    } 
    4547 
     48    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     49 
    4650    char *uuid = argv[1]; 
    4751    char *label = argv[2]; 
    4852 
    4953    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     54#else 
     55    if ( argc < 7 ) { 
     56        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     57        exit(EXIT_FAILURE); 
     58    } 
     59 
     60    int i = 0; 
     61    char *uuid = NULL; 
     62    char *label = NULL; 
     63    char *ior = NULL; 
     64 
     65    while ( i < argc ) { 
     66        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     67        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     68        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     69        ++i; 
     70    } 
     71 
     72    if ( uuid == NULL ) { 
     73        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     74        exit(EXIT_FAILURE); 
     75    } 
     76 
     77    if ( label == NULL ) { 
     78        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     79        exit(EXIT_FAILURE); 
     80    } 
     81 
     82    if ( ior == NULL ) { 
     83        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     84        exit(EXIT_FAILURE); 
     85    } 
     86 
     87    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     88 
     89    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     90 
     91    try { 
     92        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     93        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     94        CORBA::release(_ncobj); 
     95    } catch ( ... ) { 
     96        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     97        exit(EXIT_FAILURE); 
     98    } 
     99 
     100    try { 
     101        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     102        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     103        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     104        ossieSupport::ORB::pman->activate(); 
     105    } catch ( ... ) { 
     106        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     107        exit(EXIT_FAILURE); 
     108    } 
     109#endif 
     110    omni_mutex component_running_mutex; 
     111    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    50112 
    51113    Decimator_i* decimator_servant; 
     
    57119    decimator_var = decimator_servant->_this(); 
    58120 
     121#ifdef HAVE_LEGACY 
    59122    orb->bind_object_to_name((CORBA::Object_ptr) decimator_var, label); 
     123#else 
     124    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     125    try { 
     126        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) decimator_var); 
     127    } catch ( ... ) { 
     128        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     129        exit(EXIT_FAILURE); 
     130    } 
     131#endif 
    60132 
    61133// This bit is ORB specific 
    62134// omniorb is threaded and the servants are running at this point 
    63 // so we block on the semaphore 
    64 // The releaseObject method clear the semaphore and the component exits 
     135// so we block on the condition 
     136// The releaseObject method clear the condition and the component exits 
    65137 
    66138    component_running->wait(); 
    67  
     139#ifdef HAVE_LEGACY 
    68140    orb->unbind_name(label); 
    69  
    70141    orb->orb->shutdown(0); 
     142#else 
     143    ossieSupport::ORB::inc->unbind(_bindingname); 
     144    ossieSupport::ORB::orb->destroy(); 
     145#endif 
     146    return 0; 
    71147} 
  • ossiedev/trunk/components/DigitalModem/src/main_demod.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530#include "ossie/debug.h" 
     
    3035using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3136 
    32  
    3337int main(int argc, char* argv[]) 
    34  
    3538{ 
    3639    ossieDebugLevel = 3; 
    37     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    38     omni_mutex component_running_mutex; 
    39     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    40  
     40#ifdef HAVE_LEGACY 
    4141    if (argc != 3) { 
    4242        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4444    } 
    4545 
     46    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     47 
    4648    char *uuid = argv[1]; 
    4749    char *label = argv[2]; 
    4850 
    4951    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     52#else 
     53    if ( argc < 7 ) { 
     54        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     55        exit(EXIT_FAILURE); 
     56    } 
     57 
     58    int i = 0; 
     59    char *uuid = NULL; 
     60    char *label = NULL; 
     61    char *ior = NULL; 
     62 
     63    while ( i < argc ) { 
     64        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     65        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     66        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     67        ++i; 
     68    } 
     69 
     70    if ( uuid == NULL ) { 
     71        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     72        exit(EXIT_FAILURE); 
     73    } 
     74 
     75    if ( label == NULL ) { 
     76        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     77        exit(EXIT_FAILURE); 
     78    } 
     79 
     80    if ( ior == NULL ) { 
     81        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     82        exit(EXIT_FAILURE); 
     83    } 
     84 
     85    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     86 
     87    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     88 
     89    try { 
     90        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     91        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     92        CORBA::release(_ncobj); 
     93    } catch ( ... ) { 
     94        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     95        exit(EXIT_FAILURE); 
     96    } 
     97 
     98    try { 
     99        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     100        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     101        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     102        ossieSupport::ORB::pman->activate(); 
     103    } catch ( ... ) { 
     104        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     105        exit(EXIT_FAILURE); 
     106    } 
     107#endif 
     108    omni_mutex component_running_mutex; 
     109    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    50110 
    51111    DigitalDemodulator_i* digitaldemod_servant; 
     
    57117    digitaldemod_var = digitaldemod_servant->_this(); 
    58118 
     119#ifdef HAVE_LEGACY 
    59120    orb->bind_object_to_name((CORBA::Object_ptr) digitaldemod_var, label); 
     121#else 
     122    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     123    try { 
     124        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) digitaldemod_var); 
     125    } catch ( ... ) { 
     126        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     127        exit(EXIT_FAILURE); 
     128    } 
     129#endif 
    60130 
    61131// This bit is ORB specific 
     
    65135 
    66136    component_running->wait(); 
     137#ifdef HAVE_LEGACY 
    67138    orb->unbind_name(label); 
    68139    orb->orb->shutdown(0); 
    69  
     140#else 
     141    ossieSupport::ORB::inc->unbind(_bindingname); 
     142    ossieSupport::ORB::orb->destroy(); 
     143#endif 
     144    return 0; 
    70145} 
  • ossiedev/trunk/components/DigitalModem/src/main_mod.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530#include "ossie/debug.h" 
     
    3035using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3136 
    32  
    3337int main(int argc, char* argv[]) 
    34  
    3538{ 
    3639    ossieDebugLevel = 3; 
    37     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    38     omni_mutex component_running_mutex; 
    39     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    40  
     40#ifdef HAVE_LEGACY 
    4141    if (argc != 3) { 
    4242        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4444    } 
    4545 
     46    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     47 
    4648    char *uuid = argv[1]; 
    4749    char *label = argv[2]; 
    4850 
    4951    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     52#else 
     53    if ( argc < 7 ) { 
     54        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     55        exit(EXIT_FAILURE); 
     56    } 
     57 
     58    int i = 0; 
     59    char *uuid = NULL; 
     60    char *label = NULL; 
     61    char *ior = NULL; 
     62 
     63    while ( i < argc ) { 
     64        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     65        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     66        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     67        ++i; 
     68    } 
     69 
     70    if ( uuid == NULL ) { 
     71        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     72        exit(EXIT_FAILURE); 
     73    } 
     74 
     75    if ( label == NULL ) { 
     76        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     77        exit(EXIT_FAILURE); 
     78    } 
     79 
     80    if ( ior == NULL ) { 
     81        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     82        exit(EXIT_FAILURE); 
     83    } 
     84 
     85    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     86 
     87    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     88 
     89    try { 
     90        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     91        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     92        CORBA::release(_ncobj); 
     93    } catch ( ... ) { 
     94        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     95        exit(EXIT_FAILURE); 
     96    } 
     97 
     98    try { 
     99        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     100        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     101        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     102        ossieSupport::ORB::pman->activate(); 
     103    } catch ( ... ) { 
     104        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     105        exit(EXIT_FAILURE); 
     106    } 
     107#endif 
     108    omni_mutex component_running_mutex; 
     109    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    50110 
    51111    DigitalModulator_i* digitalmod_servant; 
     
    57117    digitalmod_var = digitalmod_servant->_this(); 
    58118 
     119#ifdef HAVE_LEGACY 
    59120    orb->bind_object_to_name((CORBA::Object_ptr) digitalmod_var, label); 
     121#else 
     122    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     123    try { 
     124        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) digitalmod_var); 
     125    } catch ( ... ) { 
     126        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     127        exit(EXIT_FAILURE); 
     128    } 
     129#endif 
    60130 
    61131// This bit is ORB specific 
     
    65135 
    66136    component_running->wait(); 
     137#ifdef HAVE_LEGACY 
    67138    orb->unbind_name(label); 
    68139    orb->orb->shutdown(0); 
    69  
     140#else 
     141    ossieSupport::ORB::inc->unbind(_bindingname); 
     142    ossieSupport::ORB::orb->destroy(); 
     143#endif 
     144    return 0; 
    70145} 
  • ossiedev/trunk/components/FrameAssembler/src/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530#include "ossie/debug.h" 
     
    3035using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3136 
    32  
    3337int main(int argc, char* argv[]) 
    3438{ 
    3539    ossieDebugLevel = 0; 
    36     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    37     omni_mutex component_running_mutex; 
    38     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    39  
     40#ifdef HAVE_LEGACY 
    4041    if (argc != 3) { 
    4142        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4344    } 
    4445 
     46    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     47 
    4548    char *uuid = argv[1]; 
    4649    char *label = argv[2]; 
    4750 
    4851    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     52#else 
     53    if ( argc < 7 ) { 
     54        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     55        exit(EXIT_FAILURE); 
     56    } 
     57 
     58    int i = 0; 
     59    char *uuid = NULL; 
     60    char *label = NULL; 
     61    char *ior = NULL; 
     62 
     63    while ( i < argc ) { 
     64        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     65        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     66        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     67        ++i; 
     68    } 
     69 
     70    if ( uuid == NULL ) { 
     71        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     72        exit(EXIT_FAILURE); 
     73    } 
     74 
     75    if ( label == NULL ) { 
     76        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     77        exit(EXIT_FAILURE); 
     78    } 
     79 
     80    if ( ior == NULL ) { 
     81        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     82        exit(EXIT_FAILURE); 
     83    } 
     84 
     85    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     86 
     87    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     88 
     89    try { 
     90        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     91        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     92        CORBA::release(_ncobj); 
     93    } catch ( ... ) { 
     94        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     95        exit(EXIT_FAILURE); 
     96    } 
     97 
     98    try { 
     99        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     100        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     101        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     102        ossieSupport::ORB::pman->activate(); 
     103    } catch ( ... ) { 
     104        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     105        exit(EXIT_FAILURE); 
     106    } 
     107#endif 
     108    omni_mutex component_running_mutex; 
     109    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    49110 
    50111    FrameAssembler_i* frameassembler_servant; 
     
    56117    frameassembler_var = frameassembler_servant->_this(); 
    57118 
     119#ifdef HAVE_LEGACY 
    58120    orb->bind_object_to_name((CORBA::Object_ptr) frameassembler_var, label); 
     121#else 
     122    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     123    try { 
     124        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) frameassembler_var); 
     125    } catch ( ... ) { 
     126        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     127        exit(EXIT_FAILURE); 
     128    } 
     129#endif 
    59130 
    60131// This bit is ORB specific 
     
    64135 
    65136    component_running->wait(); 
     137#ifdef HAVE_LEGACY 
    66138    orb->unbind_name(label); 
    67139    orb->orb->shutdown(0); 
    68  
     140#else 
     141    ossieSupport::ORB::inc->unbind(_bindingname); 
     142    ossieSupport::ORB::orb->destroy(); 
     143#endif 
     144    return 0; 
    69145} 
  • ossiedev/trunk/components/Interpolator/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530#include "ossie/debug.h" 
     
    3035using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3136 
    32  
    3337int main(int argc, char* argv[]) 
    3438{ 
    3539    ossieDebugLevel = 3; 
    36     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    37     omni_mutex component_running_mutex; 
    38     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    39  
     40#ifdef HAVE_LEGACY 
    4041    if (argc != 3) { 
    4142        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4344    } 
    4445 
     46    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     47 
    4548    char *uuid = argv[1]; 
    4649    char *label = argv[2]; 
    4750 
    4851    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     52#else 
     53    if ( argc < 7 ) { 
     54        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     55        exit(EXIT_FAILURE); 
     56    } 
     57 
     58    int i = 0; 
     59    char *uuid = NULL; 
     60    char *label = NULL; 
     61    char *ior = NULL; 
     62 
     63    while ( i < argc ) { 
     64        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     65        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     66        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     67        ++i; 
     68    } 
     69 
     70    if ( uuid == NULL ) { 
     71        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     72        exit(EXIT_FAILURE); 
     73    } 
     74 
     75    if ( label == NULL ) { 
     76        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     77        exit(EXIT_FAILURE); 
     78    } 
     79 
     80    if ( ior == NULL ) { 
     81        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     82        exit(EXIT_FAILURE); 
     83    } 
     84 
     85    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     86 
     87    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     88 
     89    try { 
     90        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     91        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     92        CORBA::release(_ncobj); 
     93    } catch ( ... ) { 
     94        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     95        exit(EXIT_FAILURE); 
     96    } 
     97 
     98    try { 
     99        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     100        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     101        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     102        ossieSupport::ORB::pman->activate(); 
     103    } catch ( ... ) { 
     104        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     105        exit(EXIT_FAILURE); 
     106    } 
     107#endif 
     108    omni_mutex component_running_mutex; 
     109    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    49110 
    50111    Interpolator_i* interpolator_servant; 
     
    56117    interpolator_var = interpolator_servant->_this(); 
    57118 
     119#ifdef HAVE_LEGACY 
    58120    orb->bind_object_to_name((CORBA::Object_ptr) interpolator_var, label); 
     121#else 
     122    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     123    try { 
     124        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) interpolator_var); 
     125    } catch ( ... ) { 
     126        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     127        exit(EXIT_FAILURE); 
     128    } 
     129#endif 
    59130 
    60131// This bit is ORB specific 
     
    64135 
    65136    component_running->wait(); 
     137#ifdef HAVE_LEGACY 
    66138    orb->unbind_name(label); 
    67139    orb->orb->shutdown(0); 
    68  
     140#else 
     141    ossieSupport::ORB::inc->unbind(_bindingname); 
     142    ossieSupport::ORB::orb->destroy(); 
     143#endif 
     144    return 0; 
    69145} 
  • ossiedev/trunk/components/JPEG_VideoViewer/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
     30#include "ossie/debug.h" 
    2531 
    2632#include "JPEG_VideoViewer.h" 
    2733 
     34using namespace std; 
    2835using namespace standardInterfaces;  // For standard OSSIE interface classes 
    2936 
    30  
    3137int main(int argc, char* argv[]) 
    32  
    3338{ 
    3439    ossieDebugLevel = 3; 
    3540 
    36     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    37     omni_mutex component_running_mutex; 
    38     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    39  
     41#ifdef HAVE_LEGACY 
    4042    if (argc != 3) { 
    41         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
     43        cout << argv[0] << " <id> <usage name> " << endl; 
    4244        exit (-1); 
    4345    } 
     46 
     47    ossieSupport::ORB *orb = new ossieSupport::ORB; 
    4448 
    4549    char *uuid = argv[1]; 
    4650    char *label = argv[2]; 
    4751 
    48     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
     52    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     53#else 
     54    if ( argc < 7 ) { 
     55        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     56        exit(EXIT_FAILURE); 
     57    } 
     58 
     59    int i = 0; 
     60    char *uuid = NULL; 
     61    char *label = NULL; 
     62    char *ior = NULL; 
     63 
     64    while ( i < argc ) { 
     65        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     66        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     67        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     68        ++i; 
     69    } 
     70 
     71    if ( uuid == NULL ) { 
     72        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     73        exit(EXIT_FAILURE); 
     74    } 
     75 
     76    if ( label == NULL ) { 
     77        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     78        exit(EXIT_FAILURE); 
     79    } 
     80 
     81    if ( ior == NULL ) { 
     82        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     83        exit(EXIT_FAILURE); 
     84    } 
     85 
     86    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     87 
     88    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     89 
     90    try { 
     91        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     92        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     93        CORBA::release(_ncobj); 
     94    } catch ( ... ) { 
     95        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     96        exit(EXIT_FAILURE); 
     97    } 
     98 
     99    try { 
     100        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     101        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     102        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     103        ossieSupport::ORB::pman->activate(); 
     104    } catch ( ... ) { 
     105        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     106        exit(EXIT_FAILURE); 
     107    } 
     108#endif 
     109    omni_mutex component_running_mutex; 
     110    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    49111 
    50112    JPEG_VideoViewer_i* jpeg_videoviewer_servant; 
     
    56118    jpeg_videoviewer_var = jpeg_videoviewer_servant->_this(); 
    57119 
     120#ifdef HAVE_LEGACY 
    58121    orb->bind_object_to_name((CORBA::Object_ptr) jpeg_videoviewer_var, label); 
     122#else 
     123    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     124    try { 
     125        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) jpeg_videoviewer_var); 
     126    } catch ( ... ) { 
     127        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     128        exit(EXIT_FAILURE); 
     129    } 
     130#endif 
    59131 
    60132// This bit is ORB specific 
     
    64136 
    65137    component_running->wait(); 
     138#ifdef HAVE_LEGACY 
    66139    orb->unbind_name(label); 
    67140    orb->orb->shutdown(0); 
    68  
     141#else 
     142    ossieSupport::ORB::inc->unbind(_bindingname); 
     143    ossieSupport::ORB::orb->destroy(); 
     144#endif 
     145    return 0; 
    69146} 
  • ossiedev/trunk/components/PacketResizer/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
     30#include "ossie/debug.h" 
    2531 
    2632#include "PacketResizer.h" 
    2733 
     34using namespace std; 
    2835 
    2936int main(int argc, char* argv[]) 
    30  
    3137{ 
    3238    ossieDebugLevel = 3; 
    33     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    34     omni_mutex component_running_mutex; 
    35     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    36  
     39#ifdef HAVE_LEGACY 
    3740    if (argc != 3) { 
    38         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
     41        cout << argv[0] << " <id> <usage name> " << endl; 
    3942        exit (-1); 
    4043    } 
     44 
     45    ossieSupport::ORB *orb = new ossieSupport::ORB; 
    4146 
    4247    char *uuid = argv[1]; 
    4348    char *label = argv[2]; 
    4449 
    45     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
     50    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     51#else 
     52    if ( argc < 7 ) { 
     53        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     54        exit(EXIT_FAILURE); 
     55    } 
     56 
     57    int i = 0; 
     58    char *uuid = NULL; 
     59    char *label = NULL; 
     60    char *ior = NULL; 
     61 
     62    while ( i < argc ) { 
     63        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     64        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     65        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     66        ++i; 
     67    } 
     68 
     69    if ( uuid == NULL ) { 
     70        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     71        exit(EXIT_FAILURE); 
     72    } 
     73 
     74    if ( label == NULL ) { 
     75        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     76        exit(EXIT_FAILURE); 
     77    } 
     78 
     79    if ( ior == NULL ) { 
     80        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     81        exit(EXIT_FAILURE); 
     82    } 
     83 
     84    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     85 
     86    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     87 
     88    try { 
     89        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     90        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     91        CORBA::release(_ncobj); 
     92    } catch ( ... ) { 
     93        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     94        exit(EXIT_FAILURE); 
     95    } 
     96 
     97    try { 
     98        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     99        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     100        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     101        ossieSupport::ORB::pman->activate(); 
     102    } catch ( ... ) { 
     103        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     104        exit(EXIT_FAILURE); 
     105    } 
     106#endif 
     107    omni_mutex component_running_mutex; 
     108    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    46109 
    47110    PacketResizer_i* packetresizer_servant; 
     
    53116    packetresizer_var = packetresizer_servant->_this(); 
    54117 
     118#ifdef HAVE_LEGACY 
    55119    orb->bind_object_to_name((CORBA::Object_ptr) packetresizer_var, label); 
     120#else 
     121    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     122    try { 
     123        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) packetresizer_var); 
     124    } catch ( ... ) { 
     125        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     126        exit(EXIT_FAILURE); 
     127    } 
     128#endif 
    56129 
    57130// This bit is ORB specific 
     
    61134 
    62135    component_running->wait(); 
     136#ifdef HAVE_LEGACY 
    63137    orb->unbind_name(label); 
    64138    orb->orb->shutdown(0); 
    65  
     139#else 
     140    ossieSupport::ORB::inc->unbind(_bindingname); 
     141    ossieSupport::ORB::orb->destroy(); 
     142#endif 
     143    return 0; 
    66144} 
  • ossiedev/trunk/components/SymbolSyncPoly/src/main_FrameSynchronizer.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530#include "ossie/debug.h" 
     
    3035using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3136 
    32  
    3337int main(int argc, char* argv[]) 
    3438{ 
    3539    ossieDebugLevel = 3; 
    36     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    37     omni_mutex component_running_mutex; 
    38     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    39  
     40#ifdef HAVE_LEGACY 
    4041    if (argc != 3) { 
    4142        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4344    } 
    4445 
     46    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     47 
    4548    char *uuid = argv[1]; 
    4649    char *label = argv[2]; 
    4750 
    4851    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     52#else 
     53    if ( argc < 7 ) { 
     54        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     55        exit(EXIT_FAILURE); 
     56    } 
     57 
     58    int i = 0; 
     59    char *uuid = NULL; 
     60    char *label = NULL; 
     61    char *ior = NULL; 
     62 
     63    while ( i < argc ) { 
     64        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     65        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     66        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     67        ++i; 
     68    } 
     69 
     70    if ( uuid == NULL ) { 
     71        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     72        exit(EXIT_FAILURE); 
     73    } 
     74 
     75    if ( label == NULL ) { 
     76        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     77        exit(EXIT_FAILURE); 
     78    } 
     79 
     80    if ( ior == NULL ) { 
     81        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     82        exit(EXIT_FAILURE); 
     83    } 
     84 
     85    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     86 
     87    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     88 
     89    try { 
     90        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     91        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     92        CORBA::release(_ncobj); 
     93    } catch ( ... ) { 
     94        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     95        exit(EXIT_FAILURE); 
     96    } 
     97 
     98    try { 
     99        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     100        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     101        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     102        ossieSupport::ORB::pman->activate(); 
     103    } catch ( ... ) { 
     104        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     105        exit(EXIT_FAILURE); 
     106    } 
     107#endif 
     108    omni_mutex component_running_mutex; 
     109    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    49110 
    50111    FrameSynchronizer_i* framesynchronizer_servant; 
     
    56117    framesynchronizer_var = framesynchronizer_servant->_this(); 
    57118 
     119#ifdef HAVE_LEGACY 
    58120    orb->bind_object_to_name((CORBA::Object_ptr) framesynchronizer_var, label); 
     121#else 
     122    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     123    try { 
     124        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) framesynchronizer_var); 
     125    } catch ( ... ) { 
     126        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     127        exit(EXIT_FAILURE); 
     128    } 
     129#endif 
    59130 
    60131// This bit is ORB specific 
     
    64135 
    65136    component_running->wait(); 
     137#ifdef HAVE_LEGACY 
    66138    orb->unbind_name(label); 
    67139    orb->orb->shutdown(0); 
    68  
     140#else 
     141    ossieSupport::ORB::inc->unbind(_bindingname); 
     142    ossieSupport::ORB::orb->destroy(); 
     143#endif 
     144    return 0; 
    69145} 
  • ossiedev/trunk/components/SymbolSyncPoly/src/main_MultirateSynchronizer.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530 
     
    2934using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3035 
    31  
    3236int main(int argc, char* argv[]) 
    33  
    3437{ 
    35     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    36     omni_mutex component_running_mutex; 
    37     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    38  
     38#ifdef HAVE_LEGACY 
    3939    if (argc != 3) { 
    4040        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4242    } 
    4343 
     44    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     45 
    4446    char *uuid = argv[1]; 
    4547    char *label = argv[2]; 
    4648 
    4749    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     50#else 
     51    if ( argc < 7 ) { 
     52        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     53        exit(EXIT_FAILURE); 
     54    } 
     55 
     56    int i = 0; 
     57    char *uuid = NULL; 
     58    char *label = NULL; 
     59    char *ior = NULL; 
     60 
     61    while ( i < argc ) { 
     62        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     63        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     64        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     65        ++i; 
     66    } 
     67 
     68    if ( uuid == NULL ) { 
     69        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     70        exit(EXIT_FAILURE); 
     71    } 
     72 
     73    if ( label == NULL ) { 
     74        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     75        exit(EXIT_FAILURE); 
     76    } 
     77 
     78    if ( ior == NULL ) { 
     79        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     80        exit(EXIT_FAILURE); 
     81    } 
     82 
     83    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     84 
     85    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     86 
     87    try { 
     88        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     89        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     90        CORBA::release(_ncobj); 
     91    } catch ( ... ) { 
     92        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     93        exit(EXIT_FAILURE); 
     94    } 
     95 
     96    try { 
     97        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     98        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     99        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     100        ossieSupport::ORB::pman->activate(); 
     101    } catch ( ... ) { 
     102        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     103        exit(EXIT_FAILURE); 
     104    } 
     105#endif 
     106    omni_mutex component_running_mutex; 
     107    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    48108 
    49109    MultirateSynchronizer_i* multiratesynchronizer_servant; 
     
    55115    multiratesynchronizer_var = multiratesynchronizer_servant->_this(); 
    56116 
     117#ifdef HAVE_LEGACY 
    57118    orb->bind_object_to_name((CORBA::Object_ptr) multiratesynchronizer_var, label); 
     119#else 
     120    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     121    try { 
     122        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) multiratesynchronizer_var); 
     123    } catch ( ... ) { 
     124        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     125        exit(EXIT_FAILURE); 
     126    } 
     127#endif 
    58128 
    59129// This bit is ORB specific 
     
    63133 
    64134    component_running->wait(); 
     135#ifdef HAVE_LEGACY 
    65136    orb->unbind_name(label); 
    66137    orb->orb->shutdown(0); 
    67  
     138#else 
     139    ossieSupport::ORB::inc->unbind(_bindingname); 
     140    ossieSupport::ORB::orb->destroy(); 
     141#endif 
     142    return 0; 
    68143} 
  • ossiedev/trunk/components/SymbolSyncPoly/src/main_SymbolSyncPoly.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530 
     
    2934using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3035 
    31  
    3236int main(int argc, char* argv[]) 
    33  
    3437{ 
    35     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    36     omni_mutex component_running_mutex; 
    37     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    38  
     38#ifdef HAVE_LEGACY 
    3939    if (argc != 3) { 
    4040        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4242    } 
    4343 
     44    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     45 
    4446    char *uuid = argv[1]; 
    4547    char *label = argv[2]; 
    4648 
    4749    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     50#else 
     51    if ( argc < 7 ) { 
     52        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     53        exit(EXIT_FAILURE); 
     54    } 
     55 
     56    int i = 0; 
     57    char *uuid = NULL; 
     58    char *label = NULL; 
     59    char *ior = NULL; 
     60 
     61    while ( i < argc ) { 
     62        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     63        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     64        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     65        ++i; 
     66    } 
     67 
     68    if ( uuid == NULL ) { 
     69        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     70        exit(EXIT_FAILURE); 
     71    } 
     72 
     73    if ( label == NULL ) { 
     74        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     75        exit(EXIT_FAILURE); 
     76    } 
     77 
     78    if ( ior == NULL ) { 
     79        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     80        exit(EXIT_FAILURE); 
     81    } 
     82 
     83    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     84 
     85    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     86 
     87    try { 
     88        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     89        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     90        CORBA::release(_ncobj); 
     91    } catch ( ... ) { 
     92        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     93        exit(EXIT_FAILURE); 
     94    } 
     95 
     96    try { 
     97        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     98        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     99        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     100        ossieSupport::ORB::pman->activate(); 
     101    } catch ( ... ) { 
     102        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     103        exit(EXIT_FAILURE); 
     104    } 
     105#endif 
     106    omni_mutex component_running_mutex; 
     107    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    48108 
    49109    SymbolSyncPoly_i* symbolsyncpoly_servant; 
     
    55115    symbolsyncpoly_var = symbolsyncpoly_servant->_this(); 
    56116 
     117#ifdef HAVE_LEGACY 
    57118    orb->bind_object_to_name((CORBA::Object_ptr) symbolsyncpoly_var, label); 
     119#else 
     120    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     121    try { 
     122        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) symbolsyncpoly_var); 
     123    } catch ( ... ) { 
     124        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     125        exit(EXIT_FAILURE); 
     126    } 
     127#endif 
    58128 
    59129// This bit is ORB specific 
     
    63133 
    64134    component_running->wait(); 
     135#ifdef HAVE_LEGACY 
    65136    orb->unbind_name(label); 
    66137    orb->orb->shutdown(0); 
    67  
     138#else 
     139    ossieSupport::ORB::inc->unbind(_bindingname); 
     140    ossieSupport::ORB::orb->destroy(); 
     141#endif 
     142    return 0; 
    68143} 
  • ossiedev/trunk/components/USRP_Commander/src/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530 
     
    2934using namespace standardInterfaces;  // For standard OSSIE interface classes 
    3035 
    31  
    3236int main(int argc, char* argv[]) 
    33  
    3437{ 
    35     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    36     omni_mutex component_running_mutex; 
    37     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    38  
     38#ifdef HAVE_LEGACY 
    3939    if (argc != 3) { 
    4040        cout << argv[0] << " <id> <usage name> " << endl; 
     
    4242    } 
    4343 
     44    ossieSupport::ORB *orb = new ossieSupport::ORB; 
     45 
    4446    char *uuid = argv[1]; 
    4547    char *label = argv[2]; 
    4648 
    4749    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     50#else 
     51    if ( argc < 7 ) { 
     52        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     53        exit(EXIT_FAILURE); 
     54    } 
     55 
     56    int i = 0; 
     57    char *uuid = NULL; 
     58    char *label = NULL; 
     59    char *ior = NULL; 
     60 
     61    while ( i < argc ) { 
     62        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     63        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     64        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     65        ++i; 
     66    } 
     67 
     68    if ( uuid == NULL ) { 
     69        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     70        exit(EXIT_FAILURE); 
     71    } 
     72 
     73    if ( label == NULL ) { 
     74        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     75        exit(EXIT_FAILURE); 
     76    } 
     77 
     78    if ( ior == NULL ) { 
     79        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     80        exit(EXIT_FAILURE); 
     81    } 
     82 
     83    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     84 
     85    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     86 
     87    try { 
     88        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     89        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     90        CORBA::release(_ncobj); 
     91    } catch ( ... ) { 
     92        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     93        exit(EXIT_FAILURE); 
     94    } 
     95 
     96    try { 
     97        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     98        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     99        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     100        ossieSupport::ORB::pman->activate(); 
     101    } catch ( ... ) { 
     102        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     103        exit(EXIT_FAILURE); 
     104    } 
     105#endif 
     106    omni_mutex component_running_mutex; 
     107    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    48108 
    49109    USRP_Commander_i* usrp_commander_servant; 
     
    55115    usrp_commander_var = usrp_commander_servant->_this(); 
    56116 
     117#ifdef HAVE_LEGACY 
    57118    orb->bind_object_to_name((CORBA::Object_ptr) usrp_commander_var, label); 
     119#else 
     120    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     121    try { 
     122        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) usrp_commander_var); 
     123    } catch ( ... ) { 
     124        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     125        exit(EXIT_FAILURE); 
     126    } 
     127#endif 
    58128 
    59129// This bit is ORB specific 
     
    63133 
    64134    component_running->wait(); 
     135#ifdef HAVE_LEGACY 
    65136    orb->unbind_name(label); 
    66137    orb->orb->shutdown(0); 
    67  
     138#else 
     139    ossieSupport::ORB::inc->unbind(_bindingname); 
     140    ossieSupport::ORB::orb->destroy(); 
     141#endif 
     142    return 0; 
    68143} 
  • ossiedev/trunk/components/WFMDemod/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
    2530 
    2631#include "WFMDemod.h" 
    2732 
     33using namespace std; 
    2834 
    2935int main(int argc, char* argv[]) 
    30  
    3136{ 
    32     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    33     omni_mutex component_running_mutex; 
    34     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    35  
     37#ifdef HAVE_LEGACY 
    3638    if (argc != 3) { 
    37         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
     39        cout << argv[0] << " <id> <usage name> " << endl; 
    3840        exit (-1); 
    3941    } 
     42 
     43    ossieSupport::ORB *orb = new ossieSupport::ORB; 
    4044 
    4145    char *uuid = argv[1]; 
    4246    char *label = argv[2]; 
    4347 
    44     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
     48    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     49#else 
     50    if ( argc < 7 ) { 
     51        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     52        exit(EXIT_FAILURE); 
     53    } 
     54 
     55    int i = 0; 
     56    char *uuid = NULL; 
     57    char *label = NULL; 
     58    char *ior = NULL; 
     59 
     60    while ( i < argc ) { 
     61        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     62        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     63        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     64        ++i; 
     65    } 
     66 
     67    if ( uuid == NULL ) { 
     68        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     69        exit(EXIT_FAILURE); 
     70    } 
     71 
     72    if ( label == NULL ) { 
     73        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     74        exit(EXIT_FAILURE); 
     75    } 
     76 
     77    if ( ior == NULL ) { 
     78        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     79        exit(EXIT_FAILURE); 
     80    } 
     81 
     82    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     83 
     84    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     85 
     86    try { 
     87        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     88        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     89        CORBA::release(_ncobj); 
     90    } catch ( ... ) { 
     91        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     92        exit(EXIT_FAILURE); 
     93    } 
     94 
     95    try { 
     96        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     97        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     98        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     99        ossieSupport::ORB::pman->activate(); 
     100    } catch ( ... ) { 
     101        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     102        exit(EXIT_FAILURE); 
     103    } 
     104#endif 
     105    omni_mutex component_running_mutex; 
     106    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    45107 
    46108    WFMDemod_i* wfmdemod_servant; 
     
    52114    wfmdemod_var = wfmdemod_servant->_this(); 
    53115 
     116#ifdef HAVE_LEGACY 
    54117    orb->bind_object_to_name((CORBA::Object_ptr) wfmdemod_var, label); 
     118#else 
     119    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     120    try { 
     121        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) wfmdemod_var); 
     122    } catch ( ... ) { 
     123        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     124        exit(EXIT_FAILURE); 
     125    } 
     126#endif 
    55127 
    56128// This bit is ORB specific 
     
    60132 
    61133    component_running->wait(); 
     134#ifdef HAVE_LEGACY 
    62135    orb->unbind_name(label); 
    63136    orb->orb->shutdown(0); 
    64  
     137#else 
     138    ossieSupport::ORB::inc->unbind(_bindingname); 
     139    ossieSupport::ORB::orb->destroy(); 
     140#endif 
     141    return 0; 
    65142} 
  • ossiedev/trunk/components/WebCamCapture/main.cpp

    r9807 r9914  
    2222 
    2323#include <iostream> 
     24 
     25#ifndef HAVE_LEGACY 
     26#include <omniORB4/omniURI.h> 
     27#endif 
     28 
    2429#include "ossie/ossieSupport.h" 
     30#include "ossie/debug.h" 
    2531 
    2632#include "WebCamCapture.h" 
    2733 
     34using namespace std; 
    2835using namespace standardInterfaces;  // For standard OSSIE interface classes 
    2936 
    30  
    3137int main(int argc, char* argv[]) 
    32  
    3338{ 
    3439    ossieDebugLevel = 3; 
    3540 
    36     ossieSupport::ORB *orb = new ossieSupport::ORB; 
    37     omni_mutex component_running_mutex; 
    38     omni_condition *component_running = new omni_condition(&component_running_mutex); 
    39  
     41#ifdef HAVE_LEGACY 
    4042    if (argc != 3) { 
    41         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
     43        cout << argv[0] << " <id> <usage name> " << endl; 
    4244        exit (-1); 
    4345    } 
     46 
     47    ossieSupport::ORB *orb = new ossieSupport::ORB; 
    4448 
    4549    char *uuid = argv[1]; 
    4650    char *label = argv[2]; 
    4751 
    48     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
     52    cout << "Identifier - " << uuid << "  Label - " << label << endl; 
     53#else 
     54    if ( argc < 7 ) { 
     55        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     56        exit(EXIT_FAILURE); 
     57    } 
     58 
     59    int i = 0; 
     60    char *uuid = NULL; 
     61    char *label = NULL; 
     62    char *ior = NULL; 
     63 
     64    while ( i < argc ) { 
     65        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     66        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     67        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     68        ++i; 
     69    } 
     70 
     71    if ( uuid == NULL ) { 
     72        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     73        exit(EXIT_FAILURE); 
     74    } 
     75 
     76    if ( label == NULL ) { 
     77        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     78        exit(EXIT_FAILURE); 
     79    } 
     80 
     81    if ( ior == NULL ) { 
     82        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     83        exit(EXIT_FAILURE); 
     84    } 
     85 
     86    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     87 
     88    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     89 
     90    try { 
     91        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     92        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     93        CORBA::release(_ncobj); 
     94    } catch ( ... ) { 
     95        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     96        exit(EXIT_FAILURE); 
     97    } 
     98 
     99    try { 
     100        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     101        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     102        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     103        ossieSupport::ORB::pman->activate(); 
     104    } catch ( ... ) { 
     105        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     106        exit(EXIT_FAILURE); 
     107    } 
     108#endif 
     109    omni_mutex component_running_mutex; 
     110    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    49111 
    50112    WebCamCapture_i* webcamcapture_servant; 
     
    56118    webcamcapture_var = webcamcapture_servant->_this(); 
    57119 
     120#ifdef HAVE_LEGACY 
    58121    orb->bind_object_to_name((CORBA::Object_ptr) webcamcapture_var, label); 
     122#else 
     123    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     124    try { 
     125        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) webcamcapture_var); 
     126    } catch ( ... ) { 
     127        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     128        exit(EXIT_FAILURE); 
     129    } 
     130#endif 
    59131 
    60132// This bit is ORB specific 
     
    64136 
    65137    component_running->wait(); 
     138#ifdef HAVE_LEGACY 
    66139    orb->unbind_name(label); 
    67140    orb->orb->shutdown(0); 
    68  
     141#else 
     142    ossieSupport::ORB::inc->unbind(_bindingname); 
     143    ossieSupport::ORB::orb->destroy(); 
     144#endif 
     145    return 0; 
    69146}