TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/graph/ProcessVertex.cpp
Go to the documentation of this file.
00001 #include "ProcessVertex.hpp"
00002 #include "GraphExporter.hpp"
00003 
00004 #include <tuttle/host/ImageEffectNode.hpp>
00005 #include <tuttle/host/InputBufferWrapper.hpp>
00006 
00007 #include <boost/format.hpp>
00008 
00009 namespace tuttle {
00010 namespace host {
00011 namespace graph {
00012 
00013 
00014 ProcessVertex::ProcessVertex()
00015 : IVertex( "Undefined" )
00016 , _data( NULL )
00017 {
00018 }
00019 
00020 ProcessVertex::ProcessVertex( const ProcessVertexData& defaultVertexData, const std::string& name )
00021 : IVertex( name )
00022 , _data( defaultVertexData )
00023 {
00024 }
00025 
00026 ProcessVertex::ProcessVertex( const ProcessVertex& v )
00027 : IVertex( v )
00028 , _data( v._data )
00029 {
00030 }
00031 
00032 std::ostream& ProcessVertex::exportDotDebug( std::ostream& os ) const
00033 {
00034         std::ostringstream s;
00035         s << subDotEntry( "label", getName() );
00036         if( ! isFake() )
00037         {
00038                 /// @todo remove this. Temporary solution
00039                 switch( getProcessNode().getNodeType() )
00040                 {
00041                         case INode::eNodeTypeImageEffect:
00042                         {
00043                                 const ImageEffectNode* ieNode = dynamic_cast<const ImageEffectNode*>( & getProcessNode() );
00044                                 if( !ieNode )
00045                                 {
00046                                         subDotEntry( "ImageEffectNode", "Bad pointer" );
00047                                         break;
00048                                 }
00049                                 s << subDotEntry( "bitdepth",  ieNode->getOutputClip().getBitDepthString()   );
00050                                 s << subDotEntry( "component", ieNode->getOutputClip().getComponentsString() );
00051                                 {
00052                                         double startFrame, endFrame;
00053                                         ieNode->getOutputClip().getFrameRange( startFrame, endFrame );
00054                                         s << subDotEntry( "startFrame", startFrame );
00055                                         s << subDotEntry( "endFrame", endFrame );
00056                                 }
00057                                 s << subDotEntry( "fps", ieNode->getOutputClip().getFrameRate() );
00058                                 break;
00059                         }
00060                         default:
00061                                 break;
00062                 }
00063         }
00064         s << subDotEntry( "timeDomain", ( boost::format("[%1%:%2%]") % _data._timeDomain.min % _data._timeDomain.max ).str() );
00065         s << subDotEntry( "allTimes", _data._times.size() );
00066         std::ostringstream times;
00067         std::copy(
00068         _data._times.begin(),
00069         _data._times.end(),
00070         std::ostream_iterator<OfxTime>( times, "," ) );
00071         s << subDotEntry( "times", times.str() );
00072 
00073         os << "[" << std::endl;
00074         os << dotEntry( "type", "Node" ) << ", " << std::endl;
00075         os << dotEntry( "label", s.str() ) << ", " << std::endl;
00076         os << "]" << std::endl;
00077 
00078         return os;
00079 }
00080 
00081 std::ostream& operator<<( std::ostream& os, const ProcessVertex& v )
00082 {
00083         return operator<<( os, static_cast<const IVertex&>(v) );
00084 }
00085 
00086 }
00087 }
00088 }