Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

OutputVehPoseSource.cc

Go to the documentation of this file.
00001 
00005 #include <iostream>
00006 
00007 #include <utils/ConfigFile.h>
00008 #include <utils/Generator.h>
00009 #include <TimeSource/TimeSource.h>
00010 #include <VehPoseDest/VehPoseDest.h>
00011 
00012 #include "OutputVehPoseSource.h"
00013 
00015 UTILS_INTF_CREATOR(VehPoseSource, out, gen, params, globals)
00016 {
00017   UTILS_INTF_REPORT(VehPoseSource, out);
00018   OutputVehPoseSource* intf = new OutputVehPoseSource();
00019   if (!intf->init(*params, gen, globals)) {
00020     delete intf;
00021     return NULL;
00022   }
00023   return intf;
00024 }
00025 
00026 OutputVehPoseSource::OutputVehPoseSource()
00027 {
00028   _contained = NULL;
00029   _output = NULL;
00030 }
00031 
00032 OutputVehPoseSource::~OutputVehPoseSource()
00033 {
00034   if (_contained)
00035     _contained->unref();
00036   if (_output)
00037     _output->unref();
00038 }
00039 
00040 bool OutputVehPoseSource::init(utils::ConfigFile& params,
00041                                VehPoseSourceGenerator* gen,
00042                                utils::SymbolTable* globals)
00043 {
00044   // create the contained interface
00045   _contained = gen->interface(params.getString("contained"), globals);
00046   if (!_contained) {
00047     std::cerr << "OutputVehPoseSource::init: could not create contained\n";
00048     return false;
00049   }
00050   _contained->ref();
00051 
00052   _output =
00053     VehPoseDest::generate(params.getString("output", "logger"), globals);
00054   if (!_output) {
00055     std::cerr << "OutputVehPoseSource::init: could not create output\n";
00056     return false;
00057   }
00058   _output->ref();
00059   
00060   return true;
00061 }
00062 
00063 bool OutputVehPoseSource::getCurPose(utils::Time& time, VehPose& pose, 
00064                                      bool blocking)
00065 {
00066   if (_contained->getCurPose(time, pose, blocking)) {
00067     _output->outputPose(time, pose);
00068     return true;
00069   } 
00070   return false;
00071 }
00072 
00073 bool OutputVehPoseSource::getPose(utils::Time time, VehPose& pose)
00074 {
00075   if (_contained->getPose(time, pose)) {
00076     _output->outputPose(time, pose);
00077     return true;
00078   } 
00079   return false;
00080 }

Generated on Fri Jun 16 13:21:19 2006 for ModUtils by  doxygen 1.4.4