linker.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Neural Network Framework. *
3  * Copyright (C) 2005-2011 Gianluca Massera <emmegian@yahoo.it> *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the Free Software *
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
18  ********************************************************************************/
19 
20 #ifndef LINKERS_H
21 #define LINKERS_H
22 
28 #include "nnfwconfig.h"
29 #include "cluster.h"
30 #include "updatable.h"
31 #include <exception>
32 
33 namespace farsa {
34 
38 class FARSA_NNFW_API Linker : public Updatable {
39 public:
41  Linker( Cluster* from, Cluster* to, QString name = "unnamed" );
43  Linker( ConfigurationParameters& params, QString prefix );
45  Cluster* from() const {
46  return fromc;
47  };
49  Cluster* to() const {
50  return toc;
51  };
56  void configureFromVector( QString vectorName ) {
57  getFromVector = fromc->getDelegateFor( vectorName );
58  fromVectorName = vectorName;
59  }
64  void configureToVector( QString vectorName ) {
65  getToVector = toc->getDelegateFor( vectorName );
66  toVectorName = vectorName;
67  }
71  virtual unsigned int size() const = 0;
75  virtual void randomize( double min, double max ) = 0;
84  virtual void save(ConfigurationParameters& params, QString prefix);
86  static void describe( QString type );
87 protected:
90  return (*getFromVector)(fromc);
91  };
94  return (*getToVector)(toc);
95  };
96 private:
98  Cluster* fromc;
100  Cluster::getStateVectorFuncPtr getFromVector;
102  QString fromVectorName;
104  Cluster* toc;
106  Cluster::getStateVectorFuncPtr getToVector;
108  QString toVectorName;
109 };
110 
111 }
112 
113 #endif