Changeset 4402

Show
Ignore:
Timestamp:
07/17/07 16:21:22 (6 years ago)
Author:
hvolos
Message:

main.cpp update

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/DataGenerator/main.cpp

    r2751 r4402  
    11/**************************************************************************** 
    22 
    3 Copyright 2006 Virginia Polytechnic Institute and State University 
     3Copyright 2006, 2007 Virginia Polytechnic Institute and State University 
    44 
    55This file is part of the OSSIE DataGenerator. 
     
    2222 
    2323#include <iostream> 
     24 
    2425#include "ossie/ossieSupport.h" 
    2526 
    2627#include "DataGenerator.h" 
    27  
    28 using namespace standardInterfaces;  // For standard OSSIE interface classes 
    2928 
    3029 
     
    3837    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    3938 
    40     if (argc != 3) { 
    41         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
    42         exit (-1); 
    43     } 
    44  
    45     char *uuid = argv[1]; 
    46     char *label = argv[2]; 
    47  
    48     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
     39    ossieSupport::ossieComponent DataGenerator(orb, argc, argv); 
    4940 
    5041    DataGenerator_i* datagenerator_servant; 
     
    5344    // Create the datagenerator component servant and object reference 
    5445 
    55     datagenerator_servant = new DataGenerator_i(uuid, component_running); 
     46    datagenerator_servant = new DataGenerator_i(DataGenerator.getUuid(), component_running); 
    5647    datagenerator_var = datagenerator_servant->_this(); 
    57  
    58     // For Resource port 
    5948    datagenerator_servant->post_constructor(datagenerator_var); 
    6049 
    61     orb->bind_object_to_name((CORBA::Object_ptr) datagenerator_var, label); 
     50    PortableServer::ObjectId_var servantId = orb->poa->reference_to_id(datagenerator_var); 
     51 
     52    DataGenerator.bind(datagenerator_var); 
    6253 
    6354    // This bit is ORB specific 
     
    6758 
    6859    component_running->wait(); 
    69     orb->unbind_name(label); 
     60 
     61    DataGenerator.unbind(); 
     62 
     63    DEBUG(4, DataGenerator, "Deactivate object."); 
     64    orb->poa->deactivate_object(servantId); 
     65 
     66    DEBUG(4, DataGenerator, "Destroy POA."); 
     67    orb->poa->destroy(false, false); 
     68 
     69    DEBUG(4, DataGenerator, "Shutdown orb."); 
    7070    orb->orb->shutdown(0); 
    71  
    7271}