23 #ifndef NEURONINTERFACES_H
24 #define NEURONINTERFACES_H
27 #include "resourcesuser.h"
28 #include "parametersettable.h"
29 #include "baseexception.h"
30 #include "mathutils.h"
39 #pragma warning(disable:4996)
69 virtual bool setCurrentBlock( QString blockName ) = 0;
75 virtual bool nextNeuron() = 0;
77 virtual void setInput(
double value ) = 0;
79 virtual double getInput() = 0;
81 virtual double getOutput() = 0;
88 virtual void setGraphicProperties( QString label,
double minValue,
double maxValue, QColor color ) = 0;
141 static void describe( QString type );
156 double applyNoise(
double v,
double minValue,
double maxValue)
const;
171 NoiseTypes noiseType;
192 double noiseParameter;
222 static void describe( QString type );
228 void setName( QString name );
230 virtual void update() = 0;
236 virtual int size() = 0;
241 void checkAllNeededResourcesExist();
245 void resetNeededResourcesCheck();
250 QString actualResourceNameForMultirobot(QString resourceName)
const;
253 bool allNeededResourcesExist;
258 QString resourcePrefix;
287 static void describe( QString type );
293 void setName( QString name );
295 virtual void update() = 0;
301 virtual int size() = 0;
306 void checkAllNeededResourcesExist();
310 void resetNeededResourcesCheck();
315 QString actualResourceNameForMultirobot(QString resourceName)
const;
318 bool allNeededResourcesExist;
323 QString resourcePrefix;
342 void setEvonet(
Evonet* evonet );
346 typedef enum { InputLayer, HiddenLayer, OutputLayer } layer_t;
354 void defineBlock( QString name, layer_t layer,
int startIndex,
int size );
365 bool setCurrentBlock( QString blockName );
373 void setInput(
double value );
384 void setGraphicProperties( QString label,
double minValue,
double maxValue, QColor color );
391 void checkCurrentStatus(
const QString& funcName = QString() )
const;
400 QMap<QString, BlockInfo> blocks;
434 strncpy(m_function,
function, 256);
435 m_function[255] =
'\0';
436 strncpy(m_reason, reason, 256);
437 m_reason[255] =
'\0';
438 sprintf(m_errorMessage,
"Invalid status for EvonetItarator in function \"%s\", reason: %s", m_function, m_reason);
439 m_errorMessage[1023] =
'\0';
450 strncpy(m_function, other.m_function, 256);
451 m_function[255] =
'\0';
452 strncpy(m_reason, other.m_reason, 256);
453 m_reason[255] =
'\0';
454 strncpy(m_errorMessage, other.m_errorMessage, 1024);
455 m_errorMessage[1023] =
'\0';
465 if (&other ==
this) {
469 BaseException::operator=(other);
470 strncpy(m_function, other.m_function, 256);
471 m_function[255] =
'\0';
472 strncpy(m_reason, other.m_reason, 256);
473 m_reason[255] =
'\0';
474 strncpy(m_errorMessage, other.m_errorMessage, 1024);
475 m_errorMessage[1023] =
'\0';
492 virtual const char *
what()
const throw()
494 return m_errorMessage;
502 const char *
function()
const throw()
528 char m_function[256];
538 char m_errorMessage[1024];
544 #if defined(_MSC_VER)
This class iterate over the neurons of a Evonet neural network.
virtual ~NeuronsIterator()
Destructor.
layer_t
enum the possible layers on which the blocks can be defined
EvonetIteratorInvalidStatusException & operator=(const EvonetIteratorInvalidStatusException &other)
Copy operator.
The base abstract class for iterating over neurons of a neural network.
The base abstract class for devices (sensors and motors) with noise.
This file contains the common type defitions used on the whole framework.
The base abstract class for the Sensor hierarchy.
virtual ~EvonetIteratorInvalidStatusException()
Destructor.
const char * reason() const
Returns the string explaining why the object is not in a valid status.
EvonetIteratorInvalidStatusException(const char *function, const char *reason)
Constructor.
Evonet is the neural network taken from the EvoRobot.
virtual const char * what() const
Returns a C string describing the exception.
The exception thrown when EvonetIterator is not in a valid status.
The base abstract class for the Motor hierarchy.
EvonetIteratorInvalidStatusException(const EvonetIteratorInvalidStatusException &other)
Copy constructor.