00001 /* 00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico 00003 00004 This file is part of MeRMaID. 00005 00006 MeRMaID is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 MeRMaID is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with MeRMaID. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 00021 00022 00023 // Autogenerated by MermaidLoaderGenerator 00024 00025 #include "config.h" 00026 00027 #include <iostream> 00028 00029 //MeRMaID includes and using directives 00030 #include <ActiveObject.hpp> 00031 #include <ActiveObjectAce.hpp> 00032 #include <ActiveObjectManager.hpp> 00033 #include <ActiveObjectManagerAce.hpp> 00034 #include <CommunicationGateway.hpp> 00035 00036 #include <Service.hpp> 00037 #include <Time.hpp> 00038 #include <XmlDocument.hpp> 00039 00040 00041 // Service Includes 00042 //#include <EchoService.hpp> 00043 //#include <RegistryService.hpp> 00044 00045 #include <Task.hpp> 00046 #include <ServiceUpdateTask.hpp> 00047 //#include <ServiceInterfaceMethod.hpp> 00048 #include <ServiceRequest.hpp> 00049 00050 00051 #define ACE_SYSTEM 00052 00053 00054 00055 using std::cerr; 00056 using std::endl; 00057 00058 using mermaid::support::activeobject::ActiveObject; 00059 using mermaid::support::activeobject::ActiveObjectAce; 00060 using mermaid::support::activeobject::ActiveObjectManager; 00061 using mermaid::support::activeobject::ActiveObjectManagerAce; 00062 using mermaid::support::activeobject::Task; 00063 using mermaid::support::communication::CommunicationGateway; 00064 using boost::shared_ptr; 00065 using mermaid::support::service::Service; 00066 //using mermaid::support::service::ServiceInterfaceMethod; 00067 using mermaid::support::service::ServiceRequest; 00068 using mermaid::support::service::ServiceUpdateTask; 00069 using mermaid::support::system::Time; 00070 using mermaid::support::xml::XmlDocument; 00071 00072 00073 //using mermaid::support::components::RegistryService; 00074 00075 int main (int argc, char *argv[]) 00076 {/* 00077 // Create CommunicationGateway 00078 00079 CommunicationGateway * commGateway = new CommunicationGateway(); 00080 00081 // Create ActiveObjects 00082 shared_ptr<ActiveObject> ao1 = ActiveObjectManagerAce::getInstance()->createActiveObject(); 00083 00084 // Run StartUp procedures on ActiveObjects 00085 ao1->doStartup(); 00086 00087 // ActiveObjects start 00088 ao1->start(); 00089 00090 00091 // Create Services 00092 shared_ptr<Service> registryService; 00093 { 00094 shared_ptr<XmlDocument> registryServiceXml = shared_ptr<XmlDocument>(new XmlDocument()); 00095 registryServiceXml->parseFile("registry-service-description.xml"); 00096 registryService = shared_ptr<Service>(new mermaid::support::components::RegistryService(ao1, registryServiceXml)); 00097 commGateway->registerService( registryService); 00098 } 00099 00100 00101 shared_ptr<Service> echoService; 00102 { 00103 shared_ptr<XmlDocument> echoServiceXml = shared_ptr<XmlDocument>(new XmlDocument()); 00104 echoServiceXml->parseFile("echo-service-description.xml"); 00105 echoService = shared_ptr<Service>(new mermaid::support::components::EchoService(ao1, echoServiceXml)); 00106 commGateway->registerService( echoService); 00107 } 00108 00109 00110 sleep(2); 00111 00112 //Create request 00113 shared_ptr<ServiceRequest> sr(new ServiceRequest("testClient", "RegisterService", 1)); 00114 commGateway->sendServiceAsynchRequest("client", "RegistryService", sr); 00115 00116 //ao1->addTask(st); 00117 //sleep(2); 00118 //ao1->runTask(st); 00119 00120 // Wait for ActiveObjects to stop 00121 //ActiveObjectManagerAce::getInstance()->waitForActiveObjectsToStop(); 00122 00123 sleep(20); 00124 std::cerr << "Ending test..." << std::endl; 00125 00126 //Shutdown ActiveObjects 00127 //ao1->doShutdown(); 00128 return 0; 00129 */ 00130 }; // main 00131 00132 00133 // EOF 00134