CPN
Computational Process Networks
NodeLoader.h
Go to the documentation of this file.
1 //=============================================================================
2 // Computational Process Networks class library
3 // Copyright (C) 1997-2006 Gregory E. Allen and The University of Texas
4 //
5 // This library is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This library 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 GNU
13 // Library General Public License for more details.
14 //
15 // The GNU Public License is available in the file LICENSE, or you
16 // can write to the Free Software Foundation, Inc., 59 Temple Place -
17 // Suite 330, Boston, MA 02111-1307, USA, or you can find it on the
18 // World Wide Web at http://www.fsf.org.
19 //=============================================================================
23 #ifndef NODELOADER_H
24 #define NODELOADER_H
25 #pragma once
26 #include <cpn/common.h>
27 #include <string>
28 #include <map>
29 #include <vector>
30 
31 #define CPN_DEFAULT_INIT_SYMBOL cpninit
32 #define CPN_DEFAULT_INIT_SYMBOL_STR "cpninit"
33 struct lt__handle;
34 namespace CPN {
39  typedef shared_ptr<NodeFactory> (*CPNInitPrototype)(void);
40 
46  public:
47  NodeLoader();
48  ~NodeLoader();
53  void LoadSharedLib(const std::string &libname);
54  void LoadSharedLib(const std::vector<std::string> &list);
60  void LoadNodeList(const std::string &filename);
61  void LoadNodeList(const std::vector<std::string> &list);
62 
68  void SearchDirectory(const std::string &dirname);
69  void SearchDirectory(const std::vector<std::string> &dirnames);
70 
76  NodeFactory *GetFactory(const std::string &nodename);
77 
82  void RegisterFactory(shared_ptr<NodeFactory> factory);
83 
84  private:
85  void InternalLoadLib(const std::string &lib);
86  void InternalLoad(const std::string &sym);
87 
88  typedef std::map<std::string, lt__handle*> LibMap;
90  typedef std::map<std::string, shared_ptr<NodeFactory> > FactoryMap;
92  typedef std::map<std::string, std::string> NodeLibMap;
94 
95  };
96 }
97 #endif
std::map< std::string, shared_ptr< NodeFactory > > FactoryMap
Definition: NodeLoader.h:90
std::map< std::string, std::string > NodeLibMap
Definition: NodeLoader.h:92
std::map< std::string, lt__handle * > LibMap
Definition: NodeLoader.h:88
FactoryMap factorymap
Definition: NodeLoader.h:91
#define CPN_LOCAL
Definition: common.h:37
NodeLibMap nodelibmap
Definition: NodeLoader.h:93
The node factory provides a method for the kernel to create arbitrary user defined Nodes...
Definition: NodeFactory.h:37