Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #define ORO_MEMORY_POOL
00023 #include <rtt/os/tlsf/tlsf.h>
00024
00025 #include <transports/corba/TaskContextServer.hpp>
00026 #include <transports/corba/TaskContextProxy.hpp>
00027 #include <rtt/Port.hpp>
00028 #include <rtt/plugin/PluginLoader.hpp>
00029 #include <os/main.h>
00030 #include <fstream>
00031
00032 using namespace std;
00033 using namespace RTT;
00034 using namespace RTT::detail;
00035
00036 class TheServer : public TaskContext
00037 {
00038 public:
00039
00040 InputPort<double> mi1;
00041 OutputPort<double> mo1;
00042
00043 TheServer(string name) : TaskContext(name), mi1("mr"), mo1("mw") {
00044 ports()->addEventPort( mi1 );
00045 ports()->addPort( mo1 );
00046 this->start();
00047 ts = corba::TaskContextServer::Create( this, false );
00048 }
00049 ~TheServer() {
00050 this->stop();
00051 }
00052
00053 void updateHook(){
00054 double d = 123456.789;
00055 mi1.read(d);
00056 mo1.write(d);
00057 }
00058
00059 corba::TaskContextServer* ts;
00060
00061 };
00062
00063 int ORO_main(int argc, char** argv)
00064 {
00065 #ifdef OR_RT_MALLOC
00066 void* rtMem=0;
00067 size_t freeMem=0;
00068
00070 rtMem = malloc(BUILD_TEST_RT_MEM_POOL_SIZE);
00071 assert(0 != rtMem);
00072 freeMem = init_memory_pool(BUILD_TEST_RT_MEM_POOL_SIZE, rtMem);
00073 assert((size_t)-1 != freeMem);
00074 #endif
00075 corba::TaskContextProxy::InitOrb(argc,argv);
00076
00077 PluginLoader::Instance()->loadTypekits("../rtt");
00078
00079 #ifndef WIN32
00080 pid_t pid = getpid();
00081 std::ofstream pidfile("corba-mqueue-ipc-server.pid");
00082 pidfile << pid << endl;
00083 pidfile.close();
00084 #endif
00085
00086 {
00087 TheServer cmt("other");
00088 corba::TaskContextServer::RunOrb();
00089 }
00090 corba::TaskContextServer::ShutdownOrb(true);
00091 corba::TaskContextServer::DestroyOrb();
00092 return 0;
00093 }
00094
00095