CGRA-ME
UserFunction.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * The software programs comprising "CGRA-ME" and the documentation provided
3  * with them are copyright by its authors and the University of Toronto. Only
4  * non-commercial, not-for-profit use of this software is permitted without ex-
5  * plicit permission. This software is provided "as is" with no warranties or
6  * guarantees of support. See the LICENCE for more details. You should have re-
7  * ceived a copy of the full licence along with this software. If not, see
8  * <http://cgra-me.ece.utoronto.ca/license/>.
9  ******************************************************************************/
10 
11 #include <iostream>
12 #include <string>
13 #include <sstream>
14 #include <vector>
15 #include <map>
16 #include <CGRA/Module.h>
17 #include <CGRA/ModuleComposites.h>
18 #include <CGRA/CGRA.h>
19 #include "UserModules.h"
20 
21 //This is the function that will ensure that the correct instance of the class is created
22 template <typename T>
23 void addUserModule(std::string name, unsigned size, std::map<std::string, std::string> args, Module* m)
24 {
25  std::cout << "Adding new user created module...\n";
26  m->addSubModule(new T(name, size, args));
27 }
28 
29 
30 //The user must modify this struct in order for their changes to be seen
31 //Examine the readme for more details
33 {
34  std::vector<std::string> functionNames;
35  std::vector<void (*)(std::string, unsigned, std::map<std::string, std::string>, Module*)>functionVector;
37  : functionNames()
38  , functionVector()
39  {
40  //functionVector.push_back(addUserModule<YourClassHere>);
41  //functionNames.push_back("YourXMLIdentifierHere");
42  }
43 };
44 
ModuleComposites.h
Module.h
UserModules.h
Module
Definition: Module.h:163
userFunctions::functionNames
std::vector< std::string > functionNames
Definition: UserFunction.h:34
userFunctions
Definition: UserFunction.h:32
CGRA.h
Module::addSubModule
void addSubModule(Module *m)
Definition: Module.cpp:1124
userFunctions::functionVector
std::vector< void(*)(std::string, unsigned, std::map< std::string, std::string >, Module *)> functionVector
Definition: UserFunction.h:35
addUserModule
void addUserModule(std::string name, unsigned size, std::map< std::string, std::string > args, Module *m)
Definition: UserFunction.h:23
userFunctions::userFunctions
userFunctions()
Definition: UserFunction.h:36