OpenASIP  2.0
OperationBehaviorLoader.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file OperationBehaviorLoader.hh
26  *
27  * Declaration of OperationBehaviorLoader class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: yellow
31  * @note reviewed 19 August 2004 by pj, jn, ao, ac
32  */
33 
34 #ifndef TTA_OPERATION_BEHAVIOR_LOADER_HH
35 #define TTA_OPERATION_BEHAVIOR_LOADER_HH
36 
37 #include <string>
38 #include <map>
39 
40 #include "PluginTools.hh"
41 
42 class OperationIndex;
43 class OperationBehavior;
44 class Operation;
45 
46 /**
47  * The purpose of this class is to import operation behavior models
48  * from dynamic modules.
49  *
50  * PluginTools is used to import the operation behavior modules.
51  * OperationIndex is used to obtain modules in which certain operation
52  * belongs to.
53  */
55 public:
56  explicit OperationBehaviorLoader(OperationIndex& index);
57  virtual ~OperationBehaviorLoader();
58 
60 
61  void freeBehavior();
62 
63 private:
64  /// Contains operation behavior models indexed by operation names.
65  typedef std::map<std::string, OperationBehavior*> BehaviorMap;
66  /// Contains all deletion function of operation behavior models.
67  typedef std::map<OperationBehavior*, void (*)(OperationBehavior*)>
69 
70  /// Copying not allowed.
72  /// Assignment not allowed.
74 
75  /// The name of the creation function in dynamic module.
76  static const std::string CREATE_FUNC;
77  /// The name of the deletion function in dynamic module.
78  static const std::string DELETE_FUNC;
79 
80  /// Indexed table of all modules and operations accessible for this loader.
82  /// PluginTools for loading dynamic modules.
84  /// Container of all loaded operation behavior models.
86  /// Container of all destruction functions of behavioral models.
88 };
89 
90 #endif
OperationBehaviorLoader::importBehavior
OperationBehavior & importBehavior(const Operation &parent)
Definition: OperationBehaviorLoader.cc:91
OperationBehaviorLoader::tools_
PluginTools tools_
PluginTools for loading dynamic modules.
Definition: OperationBehaviorLoader.hh:83
PluginTools
Definition: PluginTools.hh:53
OperationBehaviorLoader::behaviors_
BehaviorMap behaviors_
Container of all loaded operation behavior models.
Definition: OperationBehaviorLoader.hh:85
OperationBehaviorLoader::~OperationBehaviorLoader
virtual ~OperationBehaviorLoader()
Definition: OperationBehaviorLoader.cc:70
OperationBehaviorLoader::BehaviorMap
std::map< std::string, OperationBehavior * > BehaviorMap
Contains operation behavior models indexed by operation names.
Definition: OperationBehaviorLoader.hh:65
OperationBehaviorLoader::index_
OperationIndex & index_
Indexed table of all modules and operations accessible for this loader.
Definition: OperationBehaviorLoader.hh:81
OperationBehaviorLoader
Definition: OperationBehaviorLoader.hh:54
PluginTools.hh
Operation
Definition: Operation.hh:59
OperationBehavior
Definition: OperationBehavior.hh:53
OperationBehaviorLoader::OperationBehaviorLoader
OperationBehaviorLoader(OperationIndex &index)
Definition: OperationBehaviorLoader.cc:61
OperationBehaviorLoader::DestructionMap
std::map< OperationBehavior *, void(*)(OperationBehavior *)> DestructionMap
Contains all deletion function of operation behavior models.
Definition: OperationBehaviorLoader.hh:68
OperationBehaviorLoader::freeBehavior
void freeBehavior()
Definition: OperationBehaviorLoader.cc:136
OperationIndex
Definition: OperationIndex.hh:58
OperationBehaviorLoader::CREATE_FUNC
static const std::string CREATE_FUNC
The name of the creation function in dynamic module.
Definition: OperationBehaviorLoader.hh:76
OperationBehaviorLoader::operator=
OperationBehaviorLoader & operator=(const OperationBehaviorLoader &)
Assignment not allowed.
OperationBehaviorLoader::DELETE_FUNC
static const std::string DELETE_FUNC
The name of the deletion function in dynamic module.
Definition: OperationBehaviorLoader.hh:78
OperationBehaviorLoader::destructors_
DestructionMap destructors_
Container of all destruction functions of behavioral models.
Definition: OperationBehaviorLoader.hh:87