// This file is a part of Framsticks SDK. http://www.framsticks.com/ // Copyright (C) 1999-2023 Maciej Komosinski and Szymon Ulatowski. // See LICENSE.txt for details. // Copyright (C) 1999,2000 Adam Rotaru-Varga (adam_rotaru@yahoo.com), GNU LGPL #ifndef _F4_GENERAL_H_ #define _F4_GENERAL_H_ #include #include #include #include #ifdef DMALLOC #include #endif /** * Performs single rotation angle decrementation on a given value. * @param v pointer to the decremented value */ void rolling_dec(double *v); /** * Performs single rotation angle incrementation on a given value. * @param v pointer to the incremented value */ void rolling_inc(double *v); class f4_Node; // later class f4_Cell; // later class f4_Cells; // later /** @name Types of f4_Cell's */ //@{ #define CELL_UNDIFF 40 ///' character, appears. After the * '>' character, the cell is duplicated as many times as it is defined after the * repetition marker. */ class repeat_stack { public: repeat_stack() { top = 0; } inline void clear() { top = 0; } /** * Pushes repeat_ptr object onto the stack. If the stack size is exceeded, then no * information is provided. * @param rn repetition node info */ inline void push(repeat_ptr rn) { if (top >= stackSize) return; ptr[top] = rn; top++; } inline void pop() { if (top > 0) top--; } /** * Gets the current top element. * @return pointer to the element on top of the repeat_stack object */ inline repeat_ptr* first() { return &(ptr[top - (top > 0)]); }; static const int stackSize = 4; ///' (end of cell development without differentiation), * - the stack of repetition marker '#' will exceed maximum allowed value of repetition, * - the stick modifiers, like rotation, will be applied on neuron cell, * - the differentiated cell will be differentiated again, * - the connection between neurons cannot be established, * - the neuron class is not valid. * * This function returns either because the development of this cell was completed, * or it was halted (yielding to other cells), or the error code was set in the f4_Cells object in the org attribute. */ void oneStep(); /** * Adds a connection between this neuron cell and a given neuron cell in nfrom. * @param nfrom input neuron cell * @param nweight weight of connection * @return 0 if connection is established, -1 otherwise */ int addConnection(f4_Cell *nfrom, double nweight); /** * Adjusts properties of stick objects. */ void adjustRecur(); int nr; ///=childcount) double rolling; ///