| 1 | /**************************************************************************** |
|---|
| 2 | |
|---|
| 3 | Copyright 2006 Virginia Polytechnic Institute and State University |
|---|
| 4 | |
|---|
| 5 | This file is part of the OSSIE DataComparator. |
|---|
| 6 | |
|---|
| 7 | OSSIE DataComparator is free software; you can redistribute it and/or modify |
|---|
| 8 | it under the terms of the GNU General Public License as published by |
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | (at your option) any later version. |
|---|
| 11 | |
|---|
| 12 | OSSIE DataComparator is distributed in the hope that it will be useful, |
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | GNU General Public License for more details. |
|---|
| 16 | |
|---|
| 17 | You should have received a copy of the GNU General Public License |
|---|
| 18 | along with OSSIE DataComparator; if not, write to the Free Software |
|---|
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | |
|---|
| 21 | ****************************************************************************/ |
|---|
| 22 | |
|---|
| 23 | #include <iostream> |
|---|
| 24 | #include "ossie/ossieSupport.h" |
|---|
| 25 | |
|---|
| 26 | #include "DataComparator.h" |
|---|
| 27 | |
|---|
| 28 | using namespace standardInterfaces; // For standard OSSIE interface classes |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | int main(int argc, char* argv[]) |
|---|
| 32 | |
|---|
| 33 | { |
|---|
| 34 | ossieDebugLevel = 2; |
|---|
| 35 | |
|---|
| 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 | 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; |
|---|
| 49 | |
|---|
| 50 | DataComparator_i* datacomparator_servant; |
|---|
| 51 | CF::Resource_var datacomparator_var; |
|---|
| 52 | |
|---|
| 53 | // Create the datacomparator component servant and object reference |
|---|
| 54 | |
|---|
| 55 | datacomparator_servant = new DataComparator_i(uuid, component_running); |
|---|
| 56 | datacomparator_var = datacomparator_servant->_this(); |
|---|
| 57 | |
|---|
| 58 | orb->bind_object_to_name((CORBA::Object_ptr) datacomparator_var, label); |
|---|
| 59 | |
|---|
| 60 | // This bit is ORB specific |
|---|
| 61 | // omniorb is threaded and the servants are running at this point |
|---|
| 62 | // so we block on the condition |
|---|
| 63 | // The releaseObject method clear the condition and the component exits |
|---|
| 64 | |
|---|
| 65 | component_running->wait(); |
|---|
| 66 | orb->unbind_name(label); |
|---|
| 67 | orb->orb->shutdown(0); |
|---|
| 68 | |
|---|
| 69 | } |
|---|