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

Last change on this file since 349 was 286, checked in by Maciej Komosinski, 10 years ago

Updated headers

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
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.