--- a/doc/doxygen/html/nodelist_8py-source.html Tue Jun 05 17:34:33 2007 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,302 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
-<title>CanFestival: /home/epimerde/documents/tc11/CanFestival-3/objdictgen/nodelist.py Source File</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
-</head><body>
-<!-- Generated by Doxygen 1.5.1 -->
-<div class="tabs">
- <ul>
- <li><a href="main.html"><span>Main Page</span></a></li>
- <li><a href="namespaces.html"><span>Namespaces</span></a></li>
- <li><a href="annotated.html"><span>Data Structures</span></a></li>
- <li id="current"><a href="files.html"><span>Files</span></a></li>
- </ul></div>
-<div class="tabs">
- <ul>
- <li><a href="files.html"><span>File List</span></a></li>
- <li><a href="globals.html"><span>Globals</span></a></li>
- </ul></div>
-<h1>/home/epimerde/documents/tc11/CanFestival-3/objdictgen/nodelist.py</h1><a href="nodelist_8py.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a><a class="code" href="namespacenodelist.html">00001</a> <span class="comment">#!/usr/bin/env python</span>
-<a name="l00002"></a>00002 <span class="comment"># -*- coding: utf-8 -*-</span>
-<a name="l00003"></a>00003
-<a name="l00004"></a>00004 <span class="comment">#This file is part of CanFestival, a library implementing CanOpen Stack. </span>
-<a name="l00005"></a>00005 <span class="comment">#</span>
-<a name="l00006"></a>00006 <span class="comment">#Copyright (C): Edouard TISSERANT, Francis DUPIN and Laurent BESSARD</span>
-<a name="l00007"></a>00007 <span class="comment">#</span>
-<a name="l00008"></a>00008 <span class="comment">#See COPYING file for copyrights details.</span>
-<a name="l00009"></a>00009 <span class="comment">#</span>
-<a name="l00010"></a>00010 <span class="comment">#This library is free software; you can redistribute it and/or</span>
-<a name="l00011"></a>00011 <span class="comment">#modify it under the terms of the GNU Lesser General Public</span>
-<a name="l00012"></a>00012 <span class="comment">#License as published by the Free Software Foundation; either</span>
-<a name="l00013"></a>00013 <span class="comment">#version 2.1 of the License, or (at your option) any later version.</span>
-<a name="l00014"></a>00014 <span class="comment">#</span>
-<a name="l00015"></a>00015 <span class="comment">#This library is distributed in the hope that it will be useful,</span>
-<a name="l00016"></a>00016 <span class="comment">#but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
-<a name="l00017"></a>00017 <span class="comment">#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
-<a name="l00018"></a>00018 <span class="comment">#Lesser General Public License for more details.</span>
-<a name="l00019"></a>00019 <span class="comment">#</span>
-<a name="l00020"></a>00020 <span class="comment">#You should have received a copy of the GNU Lesser General Public</span>
-<a name="l00021"></a>00021 <span class="comment">#License along with this library; if not, write to the Free Software</span>
-<a name="l00022"></a>00022 <span class="comment">#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</span>
-<a name="l00023"></a>00023
-<a name="l00024"></a>00024 <span class="keyword">from</span> gnosis.xml.pickle <span class="keyword">import</span> *
-<a name="l00025"></a>00025 <span class="keyword">from</span> gnosis.xml.pickle.util <span class="keyword">import</span> setParanoia
-<a name="l00026"></a>00026 setParanoia(0)
-<a name="l00027"></a>00027
-<a name="l00028"></a>00028 <span class="keyword">from</span> node <span class="keyword">import</span> *
-<a name="l00029"></a>00029 <span class="keyword">import</span> eds_utils
-<a name="l00030"></a>00030 <span class="keyword">import</span> os, shutil
-<a name="l00031"></a>00031
-<a name="l00032"></a>00032 <span class="comment">#-------------------------------------------------------------------------------</span>
-<a name="l00033"></a>00033 <span class="comment"># Definition of NodeList Object</span>
-<a name="l00034"></a>00034 <span class="comment">#-------------------------------------------------------------------------------</span>
-<a name="l00035"></a>00035
-<a name="l00036"></a>00036 <span class="stringliteral">"""</span>
-<a name="l00037"></a>00037 <span class="stringliteral">Class recording a node list for a CANOpen network.</span>
-<a name="l00038"></a>00038 <span class="stringliteral">"""</span>
-<a name="l00039"></a>00039
-<a name="l00040"></a><a class="code" href="classnodelist_1_1NodeList.html">00040</a> <span class="keyword">class </span><a class="code" href="classnodelist_1_1NodeList.html">NodeList</a>:
-<a name="l00041"></a>00041
-<a name="l00042"></a><a class="code" href="classnodelist_1_1NodeList.html#c6e80d9c4b17421a74aae47e39e22ffb">00042</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#c6e80d9c4b17421a74aae47e39e22ffb">__init__</a>(self, manager):
-<a name="l00043"></a><a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">00043</a> self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root = <span class="stringliteral">""</span>
-<a name="l00044"></a><a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">00044</a> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager = manager
-<a name="l00045"></a><a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">00045</a> self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = <span class="stringliteral">""</span>
-<a name="l00046"></a><a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">00046</a> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes = {}
-<a name="l00047"></a><a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">00047</a> self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes = {}
-<a name="l00048"></a><a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">00048</a> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected = <span class="keywordtype">None</span>
-<a name="l00049"></a>00049
-<a name="l00050"></a><a class="code" href="classnodelist_1_1NodeList.html#f251a2599ab39f05f72debe9194ef730">00050</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#f251a2599ab39f05f72debe9194ef730">GetNetworkName</a>(self):
-<a name="l00051"></a>00051 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName
-<a name="l00052"></a>00052
-<a name="l00053"></a><a class="code" href="classnodelist_1_1NodeList.html#9d82bcfef0a88d2c9135cf5a8e2ff047">00053</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#9d82bcfef0a88d2c9135cf5a8e2ff047">SetNetworkName</a>(self, name):
-<a name="l00054"></a>00054 self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = name
-<a name="l00055"></a>00055
-<a name="l00056"></a><a class="code" href="classnodelist_1_1NodeList.html#1b2aa331c3a0f257629450ffbb658714">00056</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#1b2aa331c3a0f257629450ffbb658714">GetManager</a>(self):
-<a name="l00057"></a>00057 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager
-<a name="l00058"></a>00058
-<a name="l00059"></a><a class="code" href="classnodelist_1_1NodeList.html#5660c96280f53eb22d49ae3ef87857b5">00059</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#5660c96280f53eb22d49ae3ef87857b5">GetRoot</a>(self):
-<a name="l00060"></a>00060 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
-<a name="l00061"></a>00061
-<a name="l00062"></a><a class="code" href="classnodelist_1_1NodeList.html#88204b493bfb5af7a4106f79ce65e377">00062</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#88204b493bfb5af7a4106f79ce65e377">GetSlaveNumber</a>(self):
-<a name="l00063"></a>00063 <span class="keywordflow">return</span> len(self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes)
-<a name="l00064"></a>00064
-<a name="l00065"></a><a class="code" href="classnodelist_1_1NodeList.html#ae2a228b04ac23eced9749346e06cf09">00065</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#ae2a228b04ac23eced9749346e06cf09">GetSlaveNames</a>(self):
-<a name="l00066"></a>00066 nodes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
-<a name="l00067"></a>00067 nodes.sort()
-<a name="l00068"></a>00068 <span class="keywordflow">return</span> [<span class="stringliteral">"0x%2.2X %s"</span>%(idx, self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[idx][<span class="stringliteral">"Name"</span>]) <span class="keywordflow">for</span> idx <span class="keywordflow">in</span> nodes]
-<a name="l00069"></a>00069
-<a name="l00070"></a><a class="code" href="classnodelist_1_1NodeList.html#e95b562c7c695ea8c2a3dee38b7c4ef2">00070</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e95b562c7c695ea8c2a3dee38b7c4ef2">GetSlaveIDs</a>(self):
-<a name="l00071"></a>00071 nodes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
-<a name="l00072"></a>00072 nodes.sort()
-<a name="l00073"></a>00073 <span class="keywordflow">return</span> nodes
-<a name="l00074"></a>00074
-<a name="l00075"></a><a class="code" href="classnodelist_1_1NodeList.html#007fad3e7173fb04f35df65d93690c19">00075</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#007fad3e7173fb04f35df65d93690c19">SetCurrentSelected</a>(self, selected):
-<a name="l00076"></a>00076 self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected = selected
-<a name="l00077"></a>00077
-<a name="l00078"></a><a class="code" href="classnodelist_1_1NodeList.html#31139aa84f679ccd6b60c0d2e291cead">00078</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#31139aa84f679ccd6b60c0d2e291cead">GetCurrentSelected</a>(self):
-<a name="l00079"></a>00079 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected
-<a name="l00080"></a>00080
-<a name="l00081"></a><a class="code" href="classnodelist_1_1NodeList.html#e0c626e2b7b68c2497f77b822b6fa88f">00081</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e0c626e2b7b68c2497f77b822b6fa88f">LoadProject</a>(self, root):
-<a name="l00082"></a>00082 self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes = {}
-<a name="l00083"></a>00083 self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes = {}
-<a name="l00084"></a>00084
-<a name="l00085"></a>00085 self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root = root
-<a name="l00086"></a>00086 <span class="keywordflow">if</span> <span class="keywordflow">not</span> os.path.exists(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root):
-<a name="l00087"></a>00087 <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" folder doesn't exist"</span>%self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
-<a name="l00088"></a>00088
-<a name="l00089"></a><a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">00089</a> self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"eds"</span>)
-<a name="l00090"></a>00090 <span class="keywordflow">if</span> <span class="keywordflow">not</span> os.path.exists(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder):
-<a name="l00091"></a>00091 <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" folder doesn't contain a \"eds\" folder"</span>%self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root
-<a name="l00092"></a>00092
-<a name="l00093"></a>00093 files = os.listdir(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder)
-<a name="l00094"></a>00094 <span class="keywordflow">for</span> file <span class="keywordflow">in</span> files:
-<a name="l00095"></a>00095 result = self.<a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>LoadEDS(file)
-<a name="l00096"></a>00096 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00097"></a>00097 <span class="keywordflow">return</span> result
-<a name="l00098"></a>00098
-<a name="l00099"></a>00099 result = self.<a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">LoadMasterNode</a>LoadMasterNode()
-<a name="l00100"></a>00100 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00101"></a>00101 <span class="keywordflow">return</span> result
-<a name="l00102"></a>00102
-<a name="l00103"></a>00103 result = self.<a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">LoadSlaveNodes</a>LoadSlaveNodes()
-<a name="l00104"></a>00104 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00105"></a>00105 <span class="keywordflow">return</span> result
-<a name="l00106"></a>00106
-<a name="l00107"></a><a class="code" href="classnodelist_1_1NodeList.html#b90b33e930a1d08ad4bb81f912c30a68">00107</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#b90b33e930a1d08ad4bb81f912c30a68">SaveProject</a>(self):
-<a name="l00108"></a>00108 result = self.<a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">SaveMasterNode</a>SaveMasterNode()
-<a name="l00109"></a>00109 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00110"></a>00110 <span class="keywordflow">return</span> result
-<a name="l00111"></a>00111
-<a name="l00112"></a>00112 result = self.<a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">SaveNodeList</a>SaveNodeList()
-<a name="l00113"></a>00113 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00114"></a>00114 <span class="keywordflow">return</span> result
-<a name="l00115"></a>00115
-<a name="l00116"></a><a class="code" href="classnodelist_1_1NodeList.html#2bf9abf09b0dd06a8801b9e23f6387cb">00116</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#2bf9abf09b0dd06a8801b9e23f6387cb">ImportEDSFile</a>(self, edspath):
-<a name="l00117"></a>00117 dir, file = os.path.split(edspath)
-<a name="l00118"></a>00118 eds = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder, file)
-<a name="l00119"></a>00119 <span class="keywordflow">if</span> os.path.isfile(eds):
-<a name="l00120"></a>00120 <span class="keywordflow">return</span> <span class="stringliteral">"EDS file already imported"</span>
-<a name="l00121"></a>00121 <span class="keywordflow">else</span>:
-<a name="l00122"></a>00122 shutil.copy(edspath, self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder)
-<a name="l00123"></a>00123 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>LoadEDS(file)
-<a name="l00124"></a>00124
-<a name="l00125"></a><a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">00125</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#88cdff50bbef6974b09880f5dd772a26">LoadEDS</a>(self, eds):
-<a name="l00126"></a>00126 edspath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#85d003455c6b3c98bec4e8602acd3fe0">EDSFolder</a>EDSFolder, eds)
-<a name="l00127"></a>00127 node = eds_utils.GenerateNode(edspath, self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.ScriptDirectory)
-<a name="l00128"></a>00128 <span class="keywordflow">if</span> isinstance(node, Node):
-<a name="l00129"></a>00129 self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes[eds] = node
-<a name="l00130"></a>00130 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00131"></a>00131 <span class="keywordflow">else</span>:
-<a name="l00132"></a>00132 <span class="keywordflow">return</span> node
-<a name="l00133"></a>00133
-<a name="l00134"></a><a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">00134</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">AddSlaveNode</a>(self, nodeName, nodeID, eds):
-<a name="l00135"></a>00135 <span class="keywordflow">if</span> eds <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes.keys():
-<a name="l00136"></a>00136 slave = {<span class="stringliteral">"Name"</span> : nodeName, <span class="stringliteral">"EDS"</span> : eds, <span class="stringliteral">"Node"</span> : self.<a class="code" href="classnodelist_1_1NodeList.html#eb7afd07a98f688686ccc351404978d3">EDSNodes</a>EDSNodes[eds]}
-<a name="l00137"></a>00137 self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeID] = slave
-<a name="l00138"></a>00138 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00139"></a>00139 <span class="keywordflow">else</span>:
-<a name="l00140"></a>00140 <span class="keywordflow">return</span> <span class="stringliteral">"\"%s\" EDS file is not available"</span>%eds
-<a name="l00141"></a>00141
-<a name="l00142"></a><a class="code" href="classnodelist_1_1NodeList.html#4a54d5c47f48af8060e1b7e0a8a52f6d">00142</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#4a54d5c47f48af8060e1b7e0a8a52f6d">RemoveSlaveNode</a>(self, index):
-<a name="l00143"></a>00143 <span class="keywordflow">if</span> index <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys():
-<a name="l00144"></a>00144 self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.pop(index)
-<a name="l00145"></a>00145 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00146"></a>00146 <span class="keywordflow">else</span>:
-<a name="l00147"></a>00147 <span class="keywordflow">return</span> <span class="stringliteral">"Node with \"0x%2.2X\" ID doesn't exist"</span>
-<a name="l00148"></a>00148
-<a name="l00149"></a><a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">00149</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#ff252235b084983f34a6f1455e1ee2a2">LoadMasterNode</a>(self):
-<a name="l00150"></a>00150 masterpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"master.od"</span>)
-<a name="l00151"></a>00151 <span class="keywordflow">if</span> os.path.isfile(masterpath):
-<a name="l00152"></a>00152 self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.OpenFileInCurrent(masterpath)
-<a name="l00153"></a>00153 <span class="keywordflow">else</span>:
-<a name="l00154"></a>00154 self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.CreateNewNode(<span class="stringliteral">"MasterNode"</span>, 0x00, <span class="stringliteral">"master"</span>, <span class="stringliteral">""</span>, <span class="stringliteral">"None"</span>, <span class="stringliteral">""</span>, <span class="stringliteral">"heartbeat"</span>, [<span class="stringliteral">"DS302"</span>])
-<a name="l00155"></a>00155 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00156"></a>00156
-<a name="l00157"></a><a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">00157</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d297a4f5ea828c7a56592ffa23ed9913">SaveMasterNode</a>(self):
-<a name="l00158"></a>00158 masterpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"master.od"</span>)
-<a name="l00159"></a>00159 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.SaveCurrentInFile(masterpath):
-<a name="l00160"></a>00160 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00161"></a>00161 <span class="keywordflow">else</span>:
-<a name="l00162"></a>00162 <span class="keywordflow">return</span> <span class="stringliteral">"Fail to save Master Node"</span>
-<a name="l00163"></a>00163
-<a name="l00164"></a><a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">00164</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d0b1264363626cc954199e3fa572620a">LoadSlaveNodes</a>(self):
-<a name="l00165"></a>00165 cpjpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"nodelist.cpj"</span>)
-<a name="l00166"></a>00166 <span class="keywordflow">if</span> os.path.isfile(cpjpath):
-<a name="l00167"></a>00167 <span class="keywordflow">try</span>:
-<a name="l00168"></a>00168 networks = eds_utils.ParseCPJFile(cpjpath)
-<a name="l00169"></a>00169 <span class="keywordflow">if</span> len(networks) > 0:
-<a name="l00170"></a>00170 self.<a class="code" href="classnodelist_1_1NodeList.html#267d8efe86849209ff37f59598efcceb">NetworkName</a>NetworkName = networks[0][<span class="stringliteral">"Name"</span>]
-<a name="l00171"></a>00171 <span class="keywordflow">for</span> nodeid, node <span class="keywordflow">in</span> networks[0][<span class="stringliteral">"Nodes"</span>].items():
-<a name="l00172"></a>00172 <span class="keywordflow">if</span> node[<span class="stringliteral">"Present"</span>] == 1:
-<a name="l00173"></a>00173 result = self.<a class="code" href="classnodelist_1_1NodeList.html#4eec8b1c1d88c4806f470f8afcc53e10">AddSlaveNode</a>AddSlaveNode(node[<span class="stringliteral">"Name"</span>], nodeid, node[<span class="stringliteral">"DCFName"</span>])
-<a name="l00174"></a>00174 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00175"></a>00175 <span class="keywordflow">return</span> result
-<a name="l00176"></a>00176 <span class="keywordflow">except</span> SyntaxError, message:
-<a name="l00177"></a>00177 <span class="keywordflow">return</span> <span class="stringliteral">"Unable to load CPJ file\n%s"</span>%message
-<a name="l00178"></a>00178 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00179"></a>00179
-<a name="l00180"></a><a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">00180</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#b68284c7742c05364af484bbc0b162e6">SaveNodeList</a>(self):
-<a name="l00181"></a>00181 cpjpath = os.path.join(self.<a class="code" href="classnodelist_1_1NodeList.html#b2f15765f2bd7a7bc5038102e491e87c">Root</a>Root, <span class="stringliteral">"nodelist.cpj"</span>)
-<a name="l00182"></a>00182 content = eds_utils.GenerateCPJContent(self)
-<a name="l00183"></a>00183 file = open(cpjpath, <span class="stringliteral">"w"</span>)
-<a name="l00184"></a>00184 file.write(content)
-<a name="l00185"></a>00185 file.close()
-<a name="l00186"></a>00186
-<a name="l00187"></a><a class="code" href="classnodelist_1_1NodeList.html#305f512d69651d134aaa585e4aed94b8">00187</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#305f512d69651d134aaa585e4aed94b8">GetSlaveNodeEntry</a>(self, nodeid, index, subindex = None):
-<a name="l00188"></a>00188 <span class="keywordflow">if</span> nodeid <span class="keywordflow">in</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys():
-<a name="l00189"></a>00189 self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeid][<span class="stringliteral">"Node"</span>].SetNodeID(nodeid)
-<a name="l00190"></a>00190 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeid][<span class="stringliteral">"Node"</span>].GetEntry(index, subindex)
-<a name="l00191"></a>00191 <span class="keywordflow">else</span>:
-<a name="l00192"></a>00192 <span class="keywordflow">return</span> <span class="stringliteral">"Node 0x%2.2X doesn't exist"</span>%nodeid
-<a name="l00193"></a>00193
-<a name="l00194"></a><a class="code" href="classnodelist_1_1NodeList.html#d3fd973b32423384bc36ddb0cb54c632">00194</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#d3fd973b32423384bc36ddb0cb54c632">GetMasterNodeEntry</a>(self, index, subindex = None):
-<a name="l00195"></a>00195 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetCurrentEntry(index, subindex)
-<a name="l00196"></a>00196
-<a name="l00197"></a><a class="code" href="classnodelist_1_1NodeList.html#cc92822b3c2879ac7df9d0b2f39d4647">00197</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#cc92822b3c2879ac7df9d0b2f39d4647">SetMasterNodeEntry</a>(self, index, subindex = None, value = None):
-<a name="l00198"></a>00198 self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.SetCurrentEntry(index, subindex, value)
-<a name="l00199"></a>00199
-<a name="l00200"></a><a class="code" href="classnodelist_1_1NodeList.html#f8812726aa6302532b6c13a2719b1258">00200</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#f8812726aa6302532b6c13a2719b1258">GetOrderNumber</a>(self, nodeid):
-<a name="l00201"></a>00201 nodeindexes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
-<a name="l00202"></a>00202 nodeindexes.sort()
-<a name="l00203"></a>00203 <span class="keywordflow">return</span> nodeindexes.index(nodeid) + 1
-<a name="l00204"></a>00204
-<a name="l00205"></a><a class="code" href="classnodelist_1_1NodeList.html#abd3493e147587b88b12e4a6ac7f54e0">00205</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#abd3493e147587b88b12e4a6ac7f54e0">GetNodeByOrder</a>(self, order):
-<a name="l00206"></a>00206 <span class="keywordflow">if</span> order > 0:
-<a name="l00207"></a>00207 nodeindexes = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes.keys()
-<a name="l00208"></a>00208 nodeindexes.sort()
-<a name="l00209"></a>00209 <span class="keywordflow">print</span> nodeindexes
-<a name="l00210"></a>00210 <span class="keywordflow">if</span> order <= len(nodeindexes):
-<a name="l00211"></a>00211 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[nodeindexes[order - 1]][<span class="stringliteral">"Node"</span>]
-<a name="l00212"></a>00212 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00213"></a>00213
-<a name="l00214"></a><a class="code" href="classnodelist_1_1NodeList.html#c44eb93f2e274ab9e3f47380d71d4aef">00214</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#c44eb93f2e274ab9e3f47380d71d4aef">IsCurrentEntry</a>(self, index):
-<a name="l00215"></a>00215 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
-<a name="l00216"></a>00216 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
-<a name="l00217"></a>00217 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.IsCurrentEntry(index)
-<a name="l00218"></a>00218 <span class="keywordflow">else</span>:
-<a name="l00219"></a>00219 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
-<a name="l00220"></a>00220 <span class="keywordflow">if</span> node:
-<a name="l00221"></a>00221 <span class="keywordflow">return</span> node.IsEntry(index)
-<a name="l00222"></a>00222 <span class="keywordflow">return</span> <span class="keyword">False</span>
-<a name="l00223"></a>00223
-<a name="l00224"></a><a class="code" href="classnodelist_1_1NodeList.html#04ede866c9b3431700c7ff4dd87fc67c">00224</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#04ede866c9b3431700c7ff4dd87fc67c">GetEntryInfos</a>(self, index):
-<a name="l00225"></a>00225 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
-<a name="l00226"></a>00226 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
-<a name="l00227"></a>00227 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetEntryInfos(index)
-<a name="l00228"></a>00228 <span class="keywordflow">else</span>:
-<a name="l00229"></a>00229 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
-<a name="l00230"></a>00230 <span class="keywordflow">if</span> node:
-<a name="l00231"></a>00231 <span class="keywordflow">return</span> node.GetEntryInfos(index)
-<a name="l00232"></a>00232 <span class="keywordflow">return</span> <span class="keywordtype">None</span>
-<a name="l00233"></a>00233
-<a name="l00234"></a><a class="code" href="classnodelist_1_1NodeList.html#e98e03e88809cf1dec3c4dc3c8921c99">00234</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#e98e03e88809cf1dec3c4dc3c8921c99">GetCurrentValidIndexes</a>(self, min, max):
-<a name="l00235"></a>00235 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
-<a name="l00236"></a>00236 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected == 0:
-<a name="l00237"></a>00237 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetCurrentValidIndexes(min, max)
-<a name="l00238"></a>00238 <span class="keywordflow">else</span>:
-<a name="l00239"></a>00239 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
-<a name="l00240"></a>00240 <span class="keywordflow">if</span> node:
-<a name="l00241"></a>00241 validindexes = []
-<a name="l00242"></a>00242 <span class="keywordflow">for</span> index <span class="keywordflow">in</span> node.GetIndexes():
-<a name="l00243"></a>00243 <span class="keywordflow">if</span> min <= index <= max:
-<a name="l00244"></a>00244 validindexes.append((node.GetEntryName(index), index))
-<a name="l00245"></a>00245 <span class="keywordflow">return</span> validindexes
-<a name="l00246"></a>00246 <span class="keywordflow">else</span>:
-<a name="l00247"></a>00247 <span class="keywordflow">print</span> <span class="stringliteral">"Can't find node"</span>
-<a name="l00248"></a>00248 <span class="keywordflow">return</span> []
-<a name="l00249"></a>00249
-<a name="l00250"></a><a class="code" href="classnodelist_1_1NodeList.html#005f913bbbfe322fde2aaef4a1521843">00250</a> <span class="keyword">def </span><a class="code" href="classnodelist_1_1NodeList.html#005f913bbbfe322fde2aaef4a1521843">GetCurrentEntryValues</a>(self, index):
-<a name="l00251"></a>00251 <span class="keywordflow">if</span> self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected != <span class="keywordtype">None</span>:
-<a name="l00252"></a>00252 node = self.<a class="code" href="classnodelist_1_1NodeList.html#88dcdfc5e77e070b9f372591c5b3143a">SlaveNodes</a>SlaveNodes[self.<a class="code" href="classnodelist_1_1NodeList.html#c908dab8139683805e6d3816d84a4b9b">CurrentSelected</a>CurrentSelected][<span class="stringliteral">"Node"</span>]
-<a name="l00253"></a>00253 <span class="keywordflow">if</span> node:
-<a name="l00254"></a>00254 <span class="keywordflow">return</span> self.<a class="code" href="classnodelist_1_1NodeList.html#629a8a12f02ae1f7d02d0ef7bb0afcbf">Manager</a>Manager.GetNodeEntryValues(node, index)
-<a name="l00255"></a>00255 <span class="keywordflow">else</span>:
-<a name="l00256"></a>00256 <span class="keywordflow">print</span> <span class="stringliteral">"Can't find node"</span>
-<a name="l00257"></a>00257 <span class="keywordflow">return</span> [], []
-<a name="l00258"></a>00258
-<a name="l00259"></a>00259 <span class="keywordflow">if</span> __name__ == <span class="stringliteral">"__main__"</span>:
-<a name="l00260"></a>00260 <span class="keyword">from</span> nodemanager <span class="keyword">import</span> *
-<a name="l00261"></a>00261 <span class="keyword">import</span> os, sys, shutil
-<a name="l00262"></a>00262
-<a name="l00263"></a>00263 manager = NodeManager(sys.path[0])
-<a name="l00264"></a>00264
-<a name="l00265"></a>00265 nodelist = NodeList(manager)
-<a name="l00266"></a>00266
-<a name="l00267"></a>00267 result = nodelist.LoadProject(<span class="stringliteral">"/home/laurent/test_nodelist"</span>)
-<a name="l00268"></a>00268 <span class="keywordflow">if</span> result != <span class="keywordtype">None</span>:
-<a name="l00269"></a>00269 <span class="keywordflow">print</span> result
-<a name="l00270"></a>00270 <span class="keywordflow">else</span>:
-<a name="l00271"></a>00271 <span class="keywordflow">print</span> <span class="stringliteral">"MasterNode :"</span>
-<a name="l00272"></a>00272 manager.CurrentNode.Print()
-<a name="l00273"></a>00273 <span class="keywordflow">print</span>
-<a name="l00274"></a>00274 <span class="keywordflow">for</span> nodeid, node <span class="keywordflow">in</span> nodelist.SlaveNodes.items():
-<a name="l00275"></a>00275 <span class="keywordflow">print</span> <span class="stringliteral">"SlaveNode name=%s id=0x%2.2X :"</span>%(node[<span class="stringliteral">"Name"</span>], nodeid)
-<a name="l00276"></a>00276 node[<span class="stringliteral">"Node"</span>].Print()
-<a name="l00277"></a>00277 <span class="keywordflow">print</span>
-<a name="l00278"></a>00278
-</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Jun 4 16:29:06 2007 for CanFestival by
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.1 </small></address>
-</body>
-</html>