23 #include "neuroninterfaces.h"
25 #include "configurationhelper.h"
32 allNeededResourcesExist(false)
45 if ( sensorName !=
"unnamed" || !sensorName.startsWith(
"Sensor:") ) {
66 if (allNeededResourcesExist) {
72 QStringList nonExistingResources;
77 allNeededResourcesExist =
true;
82 allNeededResourcesExist =
false;
87 return resourcePrefix + resourceName;
92 allNeededResourcesExist(false)
105 if ( motorName !=
"unnamed" || !motorName.startsWith(
"Motor:") ) {
126 if (allNeededResourcesExist) {
132 QStringList nonExistingResources;
137 allNeededResourcesExist =
true;
142 allNeededResourcesExist =
false;
147 return resourcePrefix + resourceName;
152 currLayer(InputLayer),
164 this->evonet = evonet;
178 binfo.startIndex = startIndex;
179 binfo.endIndex = startIndex + size;
180 blocks[name] = binfo;
184 if ( !blocks.contains( blockName ) ) {
185 Logger::error( QString(
"EvonetIterator - the block %1 does not exist").arg(blockName) );
188 BlockInfo binfo = blocks[blockName];
189 currLayer = binfo.layer;
190 currStartIndex = binfo.startIndex;
191 currEndIndex = binfo.endIndex;
192 currIndex = currStartIndex;
197 checkCurrentStatus(
"nextNeuron" );
200 if ( currIndex >= currEndIndex ) {
207 checkCurrentStatus(
"setInput" );
209 evonet->setInput( currIndex, value );
213 checkCurrentStatus(
"getOutput" );
215 return evonet->getOutput( currIndex );
219 checkCurrentStatus(
"setGraphicProperties" );
223 if ( currLayer == OutputLayer ) {
224 offsetIndex = evonet->getNoInputs() + evonet->getNoHiddens();
226 sprintf( evonet->neuronl[ offsetIndex+currIndex ],
"%s", label.toAscii().data() );
227 evonet->neuronrange[ offsetIndex+currIndex ][0] = minValue;
228 evonet->neuronrange[ offsetIndex+currIndex ][1] = maxValue;
230 evonet->neurondcolor[ offsetIndex+currIndex ] = color;
233 void EvonetIterator::checkCurrentStatus(
const QString& funcName )
const {
237 if ( currStartIndex < 0 ) {
238 throw EvonetIteratorInvalidStatusException( funcName.toAscii().data(),
"you should call setCurrentBlock first");
240 if ( currIndex >= currEndIndex ) {
241 throw EvonetIteratorInvalidStatusException( funcName.toAscii().data(),
"attempt to access beyond the size of the current block");