TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/graph/IVertex.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_IVERTEX_HPP_
00002 #define _TUTTLE_HOST_IVERTEX_HPP_
00003 
00004 #include <tuttle/host/INode.hpp>
00005 #include <tuttle/host/exceptions.hpp>
00006 #include <tuttle/common/utils/global.hpp>
00007 
00008 #include <iostream>
00009 #include <set>
00010 
00011 namespace tuttle {
00012 namespace host {
00013 namespace graph {
00014 
00015 class IVertex
00016 {
00017 public:
00018         IVertex( const std::string& name = "Undefined" );
00019 
00020         IVertex( const std::string& name, INode& processNode );
00021 
00022         IVertex( const IVertex& v );
00023 
00024         virtual ~IVertex() = 0;
00025 
00026         IVertex& operator=( const IVertex& v )
00027         {
00028                 _name           = v._name;
00029                 _processNode    = v._processNode;
00030                 _fake           = v._fake;
00031                 _used           = v._used;
00032                 return *this;
00033         }
00034 
00035         bool                  isFake() const                                     { return _fake; }
00036         void                  setUsed( const bool used = true )                  { _used = used; }
00037         bool                  isUsed() const                                     { return _used; }
00038         const std::string&    getName() const                                    { return _name; }
00039         INode&                getProcessNode()
00040         {
00041                 if( !_processNode )
00042                 {
00043                         BOOST_THROW_EXCEPTION( exception::Bug()
00044                                 << exception::dev() + "Process node not set on IVertex \"" + getName() + "\"." );
00045                 }
00046                 return *_processNode;
00047         }
00048         const INode&          getProcessNode() const
00049         {
00050                 if( !_processNode )
00051                 {
00052                         BOOST_THROW_EXCEPTION( exception::Bug()
00053                                 << exception::dev() + "Process node not set on IVertex \"" + getName() + "\"." );
00054                 }
00055                 return *_processNode;
00056         }
00057         void                  setProcessNode( INode* p )
00058         {
00059                 _processNode = p;
00060         }
00061 
00062         virtual std::ostream& exportDotDebug( std::ostream& os ) const;
00063         friend std::ostream& operator<<( std::ostream& os, const IVertex& v );
00064 
00065 public:
00066         std::string _name;
00067         
00068 private:
00069         INode* _processNode;
00070         bool _fake;
00071         bool _used;
00072         static int _count;
00073 
00074 public:
00075         int _id;
00076 
00077 };
00078 
00079 }
00080 }
00081 }
00082 
00083 #endif
00084