source: cpp/frams/canvas/nn_layout.h @ 137

Last change on this file since 137 was 137, checked in by sz, 6 years ago

added (c) headers

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#ifndef _NN_LAYOUT_H_
6#define _NN_LAYOUT_H_
7
8/// abstract neural network layout state
9class NNLayoutState
10{
11public:
12
13        // layout function calls these to inquire about neuron connections:
14        virtual int GetElements() = 0;          ///< @return number of elements (neurons)
15        virtual int GetInputs(int el) = 0;      ///< @return number of inputs in element 'el' (referred to as 'N' in subsequent descriptions)
16        virtual int GetLink(int el, int i) = 0; ///< @return index of element connected with i-th input of el-th element, or -1 if there is no connection
17
18        // could be useful to refine element placement, but not really used by any layout function:
19        virtual int *GetLinkXY(int el, int i) = 0;      ///< @return relative coordinates of i-th input (or output when i==number of inputs) in el-th element (ret[0],[1]=x,y). unlike other methods, this information depends on the specific neuron drawing code, that's why NNLayoutState is abstract and can be implemented in context of a network drawing component.
20
21        // layout function calls this to place neurons:
22        virtual void SetXYWH(int el, int x, int y, int w, int h) = 0;   // set element position and size
23
24        // layout function user can use this to retrieve the resulting element layout:
25        virtual int *GetXYWH(int el) = 0;               ///< @return current element (el=0..N-1) position and size ret[0],[1],[2],[3]=x,y,w,h
26};
27
28struct NNLayoutFunction
29{
30        const char *name;
31        void(*doLayout)(NNLayoutState*);
32};
33
34extern struct NNLayoutFunction nn_layout_functions[];
35
36#endif
Note: See TracBrowser for help on using the repository browser.