diff options
| author | Manuel Traut <manut@mecka.net> | 2014-03-31 16:53:55 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@mecka.net> | 2014-03-31 16:53:55 +0200 |
| commit | 1adba473e6917b227e1b0a1118148101dca202e7 (patch) | |
| tree | 13180ede9564ba50c528b274ee5719b4e030ef06 /quellcode/demo1/Executor/Executor_i.cpp | |
| parent | eacbf5bb4d57af21c731f41251015d3b991ad490 (diff) | |
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'quellcode/demo1/Executor/Executor_i.cpp')
| -rwxr-xr-x | quellcode/demo1/Executor/Executor_i.cpp | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/quellcode/demo1/Executor/Executor_i.cpp b/quellcode/demo1/Executor/Executor_i.cpp new file mode 100755 index 0000000..0961b3b --- /dev/null +++ b/quellcode/demo1/Executor/Executor_i.cpp @@ -0,0 +1,146 @@ +// -*- C++ -*- +// +// $Id$ + +// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** +// TAO and the TAO IDL Compiler have been developed by: +// Center for Distributed Object Computing +// Washington University +// St. Louis, MO +// USA +// http://www.cs.wustl.edu/~schmidt/doc-center.html +// and +// Distributed Object Computing Laboratory +// University of California at Irvine +// Irvine, CA +// USA +// http://doc.ece.uci.edu/ +// and +// Institute for Software Integrated Systems +// Vanderbilt University +// Nashville, TN +// USA +// http://www.isis.vanderbilt.edu/ +// +// Information about TAO is available at: +// http://www.cs.wustl.edu/~schmidt/TAO.html + +// TAO_IDL - Generated from +// be/be_codegen.cpp:1063 + +#include "Executor_i.h" +#include "orbsvcs/CosNamingC.h" +#include <tao/RTCORBA/RTCORBA.h> + +#include <iostream> + +// Implementation skeleton constructor +Executor_ExecCmd_i::Executor_ExecCmd_i () +{ +} + +Executor_ExecCmd_i::Executor_ExecCmd_i (int argc, char* argv[], CORBA::ORB_var orb) +{ + + try{ + // get RTORB + CORBA::Object_var rtorb = orb->resolve_initial_references("RTORB"); + RTCORBA::RTORB_var rtORB = RTCORBA::RTORB::_narrow(rtorb.in()); + std::cout<<"RTORB ok"<<std::endl; + + // NameService + CORBA::Object_var namingObject = orb->resolve_initial_references("NameService"); + CosNaming::NamingContext_var namingContext = CosNaming::NamingContext::_narrow(namingObject.in()); + CosNaming::Name name(1); + name.length(1); + + // Connect to Receiver + name[0].id = CORBA::string_dup("Receiver"); + + // receive Object + CORBA::Object_var benchObj = namingContext->resolve(name); + put = Receiver::Put::_narrow(benchObj.in()); + std::cout<<"TransferObjekt ok"<<std::endl; + + name.length(2); + name[0].id = CORBA::string_dup("manut.Controller"); + name[1].id = CORBA::string_dup("Disp"); + + benchObj = namingContext->resolve(name); + display = Controller::Display::_narrow(benchObj.in()); + std::cout<<"DisplayObjekt ok"<<std::endl; + + // auf Interface schreiben + // ... + put->connect(); + put->allPorts(0, 0, 0); + sleep(1); + put->allPorts(255, 255, 255); + sleep(1); + put->allPorts(0, 0, 0); + + display->show("ready!!!"); + + }catch(CORBA::Exception &e){ + std::cout<<e<<std::endl; + } + +} +// Implementation skeleton destructor +Executor_ExecCmd_i::~Executor_ExecCmd_i (void) +{ +} + +::CORBA::Boolean Executor_ExecCmd_i::changeMode ( + ::CORBA::Short mode + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) +{ + // Add your implementation here + std::cout<<"changeMode called\n"; + switch(mode){ + case 1: + display->show("moving..."); + for(int i = 0; i<255; i++){ + put->allPorts(i,i,i); + } + break; + + case 2: + display->show("blinking..."); + std::cout<<"blink"<<std::endl; + for(int i = 0; i<255; i++){ + if(i%2) put->allPorts(255,255,255); + else put->allPorts(0,0,0); + } + break; + + case 3: + display->show("flashing..."); + std::cout<<"flash"<<std::endl; + for(int i = 0; i<255; i++){ + if(i%3)put->allPorts(255,255,255); + else put->allPorts(0,0,0); + } + break; + default: + std::cout<<"Mode not implemented"<<std::endl; + } + return true; +} + +::CORBA::Boolean Executor_ExecCmd_i::setPorts ( + ::CORBA::Short one, + ::CORBA::Short two, + ::CORBA::Short three + ) + ACE_THROW_SPEC (( + ::CORBA::SystemException + )) +{ + // Add your implementation here + put->allPorts(one, two, three); + return true; +} |
