TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/graph/ProcessVertexAtTime.cpp
Go to the documentation of this file.
00001 #include "ProcessVertexAtTime.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 
00010 namespace tuttle {
00011 namespace host {
00012 namespace graph {
00013 
00014 
00015 ProcessVertexAtTime::ProcessVertexAtTime( )
00016 { }
00017 
00018 ProcessVertexAtTime::ProcessVertexAtTime( const ProcessVertex& v, const OfxTime t )
00019 : IVertex( v )
00020 , _clipName( v._name )
00021 , _data( v._data, t )
00022 {
00023         this->_name += "_at_" + boost::lexical_cast<std::string>(t);
00024 }
00025 
00026 ProcessVertexAtTime::ProcessVertexAtTime( const ProcessVertexAtTime& other )
00027 : IVertex( other )
00028 , _clipName( other._clipName )
00029 , _data( other._data )
00030 {
00031 }
00032 
00033 ProcessVertexAtTime::~ProcessVertexAtTime( )
00034 {
00035 }
00036 
00037 std::ostream& ProcessVertexAtTime::exportDotDebug( std::ostream& os ) const
00038 {
00039         std::ostringstream s;
00040         s << subDotEntry( "label", getName() );
00041         if( ! isFake() )
00042         {
00043                 /// @todo remove this. Temporary solution
00044                 switch( getProcessNode().getNodeType() )
00045                 {
00046                         case INode::eNodeTypeImageEffect:
00047                         {
00048                                 const ImageEffectNode* ieNode = dynamic_cast<const ImageEffectNode*>( & getProcessNode() );
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                                 s << subDotEntry( "output RoD", ieNode->getOutputClip().fetchRegionOfDefinition(_data._time) );
00059                                 s << subDotEntry( "par", ieNode->getOutputClip().getPixelAspectRatio() );
00060                                 break;
00061                         }
00062                         default:
00063                                 break;
00064                 }
00065         }
00066         s << subDotEntry( "timeDomain", ( boost::format("[%1%:%2%]") % _data._nodeData->_timeDomain.min % _data._nodeData->_timeDomain.max ).str() );
00067         
00068         s << subDotEntry( "localMemory", _data._localInfos._memory );
00069         s << subDotEntry( "globalMemory", _data._globalInfos._memory );
00070         s << subDotEntry( "time", _data._time );
00071 
00072         os << "[" << std::endl;
00073         os << dotEntry( "type", "Node" ) << ", " << std::endl;
00074         os << dotEntry( "label", s.str() ) << ", " << std::endl;
00075         os << "]" << std::endl;
00076         return os;
00077 }
00078 
00079 std::ostream& operator<<( std::ostream& os, const ProcessVertexAtTime& v )
00080 {
00081         //Lexical_cast is used, here, to prevent an error ("error C2593: 'operator <<' is ambiguous") with ostream operator and OFXTime in msvc10-express (at least).
00082         os <<  boost::lexical_cast<std::string>(v.getKey());
00083         return os;
00084 }
00085 
00086 
00087 }
00088 }
00089 }