TuttleOFX  1
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( const std::string& name )
00015 : IVertex( name )
00016 {
00017 }
00018 
00019 ProcessVertex::ProcessVertex( const UVertex& v )
00020 : IVertex( v )
00021 , _data( v.getProcessNode().getNodeType() )
00022 {
00023 }
00024 
00025 ProcessVertex::ProcessVertex( const ProcessVertex& v )
00026 : IVertex( v )
00027 , _data( v._data )
00028 {
00029 }
00030 
00031 
00032 
00033 std::ostream& ProcessVertex::exportDotDebug( std::ostream& os ) const
00034 {
00035         std::ostringstream s;
00036         s << subDotEntry( "label", getName() );
00037         if( ! isFake() )
00038         {
00039                 /// @todo remove this. Temporary solution
00040                 switch( getProcessNode().getNodeType() )
00041                 {
00042                         case INode::eNodeTypeImageEffect:
00043                         {
00044                                 const ImageEffectNode* ieNode = dynamic_cast<const ImageEffectNode*>( & getProcessNode() );
00045                                 s << subDotEntry( "bitdepth",  ieNode->getOutputClip().getBitDepthString()   );
00046                                 s << subDotEntry( "component", ieNode->getOutputClip().getComponentsString() );
00047                                 {
00048                                         double startFrame, endFrame;
00049                                         ieNode->getOutputClip().getFrameRange( startFrame, endFrame );
00050                                         s << subDotEntry( "startFrame", startFrame );
00051                                         s << subDotEntry( "endFrame", endFrame );
00052                                 }
00053                                 s << subDotEntry( "fps", ieNode->getOutputClip().getFrameRate() );
00054                                 break;
00055                         }
00056                         default:
00057                                 break;
00058                 }
00059         }
00060         s << subDotEntry( "timeDomain", ( boost::format("[%1%:%2%]") % _data._timeDomain.min % _data._timeDomain.max ).str() );
00061         s << subDotEntry( "allTimes", _data._times.size() );
00062         std::ostringstream times;
00063         std::copy(
00064         _data._times.begin(),
00065         _data._times.end(),
00066         std::ostream_iterator<OfxTime>( times, "," ) );
00067         s << subDotEntry( "times", times.str() );
00068 
00069         os << "[" << std::endl;
00070         os << dotEntry( "type", "Node" ) << ", " << std::endl;
00071         os << dotEntry( "label", s.str() ) << ", " << std::endl;
00072         os << "]" << std::endl;
00073         return os;
00074         return os;
00075 }
00076 
00077 std::ostream& operator<<( std::ostream& os, const ProcessVertex& v )
00078 {
00079         return operator<<( os, static_cast<const IVertex&>(v) );
00080 }
00081 
00082 }
00083 }
00084 }