00001 /*************************************************************************** 00002 node.h - description 00003 ------------------- 00004 begin : Mon Jun 26 2000 00005 copyright : (C) 2000-2004 by Michael Repplinger 00006 email : repplix@studcs.uni-sb.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef NODE_H 00019 #define NODE_H 00020 00021 #include <iostream> 00022 00023 #include "l1394_qarray.h" 00024 00025 namespace L1394{ 00026 namespace internal{ 00027 00028 /*! \class TopoNode 00029 * \ingroup Internal 00030 * \brief A TopoNode represent an node in the topologie structure. 00031 * 00032 * A TopoNode store also information from the physical layer. 00033 * This value describe the information like speed, ports, powerclass 00034 * and so on. 00035 * 00036 * @author Michael Repplinger 00037 */ 00038 00039 00040 class TopoNode { 00041 00042 public: 00043 00044 /*! \fn TopoNode(int , TopoNode*) 00045 * \brief Constructor 00046 * \param int Integer Value that specify the port count 00047 * \param TopoNode* pointer to parent node 00048 */ 00049 TopoNode(int , TopoNode*); 00050 00051 /*! \fn ~TopoNode() 00052 * \brief Destructor 00053 */ 00054 ~TopoNode(); 00055 00056 /*! \fn setChild(int i, TopoNode *node) 00057 * \brief add a child to a port 00058 * \param int Integer value that specify the port 00059 * \param TopoNode* pointer to the childnode. 00060 */ 00061 void setChild(int i, TopoNode *node){ if (i < max_port) child[i] = node; } 00062 00063 /*! \fn setPortStatus(int, unsigned short int) 00064 */ 00065 void setPortStatus(int, unsigned short int); 00066 00067 /*! \fn getChild(int i) 00068 * \brief return a pointer to the i'th node 00069 * \param int Integer value that specify the port 00070 */ 00071 TopoNode* getChild(int i) { if (i < max_port) return child[i]; else return NULL;} 00072 00073 /*! \fn unsigned short int getPortStatus(int i) 00074 * \brief 00075 */ 00076 unsigned short int getPortStatus(int i) {if (i < max_port) return port_status[i]; else return 10;} 00077 00078 int getMaxPort() {return max_port;} 00079 int getPhyId() {return node_info.getBitRange(24,29);} 00080 int getPhySpeed() {return node_info.getBitRange(14,15);} 00081 int getPhyDelay() {return node_info.getBitRange(12,13);} 00082 int getPwrClass() {return node_info.getBitRange(8,10);} 00083 int getGapCount() {return node_info.getBitRange(16,21);} 00084 int getLinkActive() {return node_info.getBit(22);} 00085 00086 void setNodeInfo(Quadlet *t); 00087 void printNode(); 00088 const char* getPhySpeedSpec(int i) {return phy_speed_spec[i];} 00089 00090 00091 friend ostream& operator<<(ostream &, TopoNode&); 00092 // friend Html& operator<<(Html&, TopoNode&); 00093 00094 00095 static const char* phy_speed_spec[]; 00096 static const char* phy_delay_spec[]; 00097 static const char* pwr_class_spec[]; 00098 static const char* port_value[]; 00099 00100 private: 00101 //disable copy constructor 00102 TopoNode(const TopoNode&); 00103 00104 int max_port; 00105 00106 Quadlet node_info; 00107 00108 unsigned short int *port_status; 00109 TopoNode **child; 00110 TopoNode *parent; 00111 00112 }; 00113 } 00114 } 00115 #endif