23 #include "neuroninterfaces.h"
25 #include "configurationhelper.h"
32 allNeededResourcesExist(false)
44 if ( sensorName !=
"unnamed" || !sensorName.startsWith(
"Sensor:") ) {
63 if (allNeededResourcesExist) {
69 QStringList nonExistingResources;
74 allNeededResourcesExist =
true;
79 allNeededResourcesExist =
false;
84 allNeededResourcesExist(false)
96 if ( motorName !=
"unnamed" || !motorName.startsWith(
"Motor:") ) {
115 if (allNeededResourcesExist) {
121 QStringList nonExistingResources;
126 allNeededResourcesExist =
true;
131 allNeededResourcesExist =
false;
136 currLayer(InputLayer),
148 this->evonet = evonet;
158 binfo.startIndex = startIndex;
159 binfo.endIndex = startIndex + size;
160 blocks[name] = binfo;
164 if ( !blocks.contains( blockName ) ) {
165 Logger::error( QString(
"EvonetIterator - the block %1 does not exist").arg(blockName) );
168 BlockInfo binfo = blocks[blockName];
169 currLayer = binfo.layer;
170 currStartIndex = binfo.startIndex;
171 currEndIndex = binfo.endIndex;
172 currIndex = currStartIndex;
177 checkCurrentStatus(
"nextNeuron" );
180 if ( currIndex >= currEndIndex ) {
187 checkCurrentStatus(
"setInput" );
189 evonet->setInput( currIndex, value );
193 checkCurrentStatus(
"getOutput" );
195 return evonet->getOutput( currIndex );
199 checkCurrentStatus(
"setGraphicProperties" );
203 if ( currLayer == OutputLayer ) {
204 offsetIndex = evonet->getNoInputs() + evonet->getNoHiddens();
206 sprintf( evonet->neuronl[ offsetIndex+currIndex ],
"%s", label.toAscii().data() );
207 evonet->neuronrange[ offsetIndex+currIndex ][0] = 0.0;
208 evonet->neuronrange[ offsetIndex+currIndex ][1] = 1.0;
210 evonet->neurondcolor[ offsetIndex+currIndex ] = color;
213 void EvonetIterator::checkCurrentStatus(
const QString& funcName )
const {
217 if ( currStartIndex < 0 ) {
218 throw EvonetIteratorInvalidStatusException( funcName.toAscii().data(),
"you should call setCurrentBlock first");
220 if ( currIndex >= currEndIndex ) {
221 throw EvonetIteratorInvalidStatusException( funcName.toAscii().data(),
"attempt to access beyond the size of the current block");