Orocos Real-Time Toolkit
2.6.0
|
00001 #include "StreamFactory.hpp" 00002 #include "../rtt-config.h" 00003 00004 using namespace std; 00005 using namespace RTT; 00006 using namespace RTT::detail; 00007 00008 #ifdef OS_HAVE_STREAMS 00009 #include <sstream> 00010 #endif 00011 00012 string StreamFactory::toString( DataSourceBase::shared_ptr in ) const 00013 { 00014 #ifdef OS_HAVE_STREAMS 00015 stringstream result; 00016 this->write( result, in ); 00017 return result.str(); 00018 #else 00019 return string("(") + in->getTypeInfo()->getTypeName() + ")"; 00020 #endif 00021 } 00022 00023 bool StreamFactory::fromString( const std::string& value, DataSourceBase::shared_ptr out ) const 00024 { 00025 stringstream result(value); 00026 return this->read( result, out ).good(); 00027 }