TAPs 0.7.7.3
TAPsGraphNode.cpp
Go to the documentation of this file.
00001 /******************************************************************************
00002 TAPsGraphNode.cpp
00003 ******************************************************************************/
00007 /******************************************************************************
00008 SUKITTI PUNAK   (09/12/2005)
00009 UPDATE          (08/15/2010)
00010 ******************************************************************************/
00011 #include "TAPsGraphNode.hpp"
00012 // Using Inclusion Model (i.e. definitions are included in declarations)
00013 //                       (this name.cpp is included in name.hpp)
00014 // Each friend is defined directly inside its declaration.
00015 
00016 BEGIN_NAMESPACE_TAPs__DS
00017 //=============================================================================
00018 // Constructor and Destructor
00019 //-----------------------------------------------------------------------------
00020 template <typename T>
00021 GraphNode<T>::GraphNode ( T & value, int id )
00022     : m_iID( id ), 
00023       m_ptValue( &value ),
00024       m_bMark( false )
00025 {}
00026 //-----------------------------------------------------------------------------
00027 template <typename T>
00028 GraphNode<T>::~GraphNode ()
00029 {}
00030 //-----------------------------------------------------------------------------
00031 template <typename T>
00032 int GraphNode<T>::GetNodeIdOfInPathsNumber ( unsigned int i ) const
00033 {
00034     assert( 0 <= i && i < GetNumOfInPaths() );
00035     return m_vEdges_IN[i].DestNodeID;
00036 }
00037 //-----------------------------------------------------------------------------
00038 template <typename T>
00039 int GraphNode<T>::GetNodeIdOfOutPathsNumber ( unsigned int i ) const
00040 {
00041     assert( 0 <= i && i < GetNumOfOutPaths() );
00042     return m_vEdges_OUT[i].DestNodeID;
00043 }
00044 //-----------------------------------------------------------------------------
00045 template <typename T>
00046 std::string GraphNode<T>::StrInfo () const
00047 {
00048     std::ostringstream ss;
00049     ss  << "GraphNode<" << typeid(T).name() << "> ID:" << m_iID 
00050             << " with a pointer to the object address: " << *m_ptValue
00051             << " and the list of in-paths from nodes with IDs:";
00052     
00053     for ( EdgeList::const_iterator e = m_vEdges_IN.begin();
00054             e != m_vEdges_IN.end(); ++e )
00055     {
00056         ss << ' ' << e->StrInfo();
00057     }
00058     ss << "\n";
00059     ss << " and the list of out-paths to nodes with IDs:";
00060     for ( EdgeList::const_iterator e = m_vEdges_OUT.begin();
00061             e != m_vEdges_OUT.end(); ++e )
00062     {
00063         ss << ' ' << e->StrInfo();
00064     }
00065     ss << "\n";
00066 
00067     return ss.str();
00068 }
00069 //-----------------------------------------------------------------------------
00070 
00071 
00072 //=============================================================================
00073 #if defined(__gl_h_) || defined(__GL_H__)
00074 //-----------------------------------------------------------------------------
00075 template <typename T>
00076 void GraphNode<T>::Draw () const
00077 {
00078     //std::cout << "NodeID: " << GetID() << "\n";
00079     glPushAttrib( GL_ALL_ATTRIB_BITS );
00080     glPushMatrix();
00081     glPointSize( 10 );
00082     glBegin( GL_POINTS );
00083         glVertex3f( 0, 0, 0 );
00084         //m_ptValue->Draw();
00085     glEnd();
00086     glPopMatrix();
00087     glPopAttrib();
00088 }
00089 //-----------------------------------------------------------------------------
00090 #endif
00091 //=============================================================================
00092 END_NAMESPACE_TAPs__DS
00093 //345678901234567890123456789012345678901234567890123456789012345678901234567890
00094 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines