ImageSources.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  ImageSources.cpp
00003  *
00004  *  (C) 2007 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: $ 
00009  *******************************************************************************/
00010 
00011 #include "ImageSources.h"
00012 
00013 #define THIS ImageSources
00014 
00015 std::map<THIS::SourceId,std::string> THIS::sourceDesc=std::map<THIS::SourceId,std::string>();
00016 Mutex THIS::mutex=Mutex();
00017 
00018 std::map< THIS::SourceId, std::string > THIS::getSourceDesc()
00019 {
00020   initSourceDesc();
00021   mutex.lock();
00022   std::map<SourceId,std::string> descCopy=sourceDesc;
00023   mutex.unlock();
00024   return descCopy;
00025 }
00026 
00027 std::string THIS::getSourceDesc( THIS::SourceId id )
00028 {
00029   initSourceDesc();
00030   mutex.lock();
00031   std::string desc;
00032   std::map< SourceId, std::string >::iterator descItem=sourceDesc.find(id);
00033   if (descItem==sourceDesc.end()) { desc="Unknown image source"; }
00034   else { desc=descItem->second; }
00035   mutex.unlock();
00036   return desc;
00037 };
00038 
00039 void THIS::initSourceDesc() {
00040   mutex.lock();
00041   if (sourceDesc.empty()) {
00042 
00043     fillSourceDesc();
00044 
00045     std::ostringstream stream;
00046     stream << "Registered image sources:" << std::endl;
00047     stream.setf ( std::ios::left, std::ios::adjustfield );
00048     stream.width(7);
00049     stream << "Id" << "Description" << std::endl;
00050     std::map< ImageSources::SourceId, std::string >::iterator it;
00051     for ( it=sourceDesc.begin(); it!=sourceDesc.end(); it++ )
00052     {
00053       stream.width(7);
00054       stream << it->first << it->second << std::endl;
00055     }
00056     // TRACE_SYSTEMINFO(stream.str()); // TODO use ros
00057   }
00058   mutex.unlock();
00059 }
00060 
00061 #undef THIS


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43