OpenASIP  2.0
OperationIndex.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 OperationIndex.hh
26  *
27  * Declaration of OperationIndex 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_INDEX_HH
35 #define TTA_OPERATION_INDEX_HH
36 
37 #include <map>
38 #include <vector>
39 #include <string>
40 #include <set>
41 
42 #include "OperationSerializer.hh"
44 #include "Exception.hh"
45 
46 class OperationModule;
47 class ObjectState;
48 class Operation;
49 class TCEString;
51 
52 /**
53  * Class that holds information about search paths, modules and operations.
54  *
55  * An indexed table of all operations available organized by modules and
56  * indexed by names.
57  */
59 public:
60 
61  static const std::string PROPERTY_FILE_EXTENSION;
62 
64  virtual ~OperationIndex();
65 
66  void addPath(const std::string& path);
67  std::string path(int i) const;
68  int pathCount() const;
69 
70  OperationModule& module(int i);
71  int moduleCount() const;
72  OperationModule& module(int i, const std::string& path);
73  int moduleCount(const std::string& path) const;
74  void addModule(OperationModule* module, const std::string& path);
75  void removeModule(const std::string& path, const std::string& modName);
76  void refreshModule(const std::string& path, const std::string& modName);
77 
78  OperationModule& moduleOf(const std::string& name);
79  std::string operationName(int i, const OperationModule& om);
80  int operationCount(const OperationModule& om);
81 
83 
84 private:
85  /// Contains all operation modules indexed by full path names.
86  typedef std::map<std::string, std::vector<OperationModule*> >
88  /// Contains all object state trees of modules indexed by operation
89  ///definition module names.
90  typedef std::map<std::string, ObjectState*> DefinitionTable;
91 
92  /// Copying not allowed.
94  /// Assignment not allowed.
96 
98 
100  const std::string& path,
101  const std::string& operName);
102 
103  /// List of paths searched for the operation modules.
104  std::vector<std::string> paths_;
105  /// Contains all operation modules found in a search path organized by path
106  /// names.
108  /// Contains all operation definitions defined in available operation
109  /// modules indexed by module names.
111  /// Container holding all modules.
112  std::vector<OperationModule*> modules_;
113  /// Reads the operation property definitions.
116  std::vector<OperationBehaviorProxy*> proxies_;
117  std::set<const OperationModule*> brokenModules_;
118 };
119 
120 #include "OperationIndex.icc"
121 
122 #endif
OperationIndex::addPath
void addPath(const std::string &path)
Definition: OperationIndex.cc:82
OperationIndex::refreshModule
void refreshModule(const std::string &path, const std::string &modName)
Definition: OperationIndex.cc:272
Exception.hh
OperationIndex::opDefinitions_
DefinitionTable opDefinitions_
Contains all operation definitions defined in available operation modules indexed by module names.
Definition: OperationIndex.hh:110
OperationIndex::brokenModules_
std::set< const OperationModule * > brokenModules_
Definition: OperationIndex.hh:117
ObjectState
Definition: ObjectState.hh:59
OperationIndex::modules_
std::vector< OperationModule * > modules_
Container holding all modules.
Definition: OperationIndex.hh:112
OperationBehaviorLoader.hh
OperationIndex::DefinitionTable
std::map< std::string, ObjectState * > DefinitionTable
Contains all object state trees of modules indexed by operation definition module names.
Definition: OperationIndex.hh:90
OperationIndex::PROPERTY_FILE_EXTENSION
static const std::string PROPERTY_FILE_EXTENSION
Definition: OperationIndex.hh:61
OperationIndex::pathCount
int pathCount() const
OperationIndex::proxies_
std::vector< OperationBehaviorProxy * > proxies_
Definition: OperationIndex.hh:116
OperationIndex::addModule
void addModule(OperationModule *module, const std::string &path)
Definition: OperationIndex.cc:193
OperationBehaviorProxy
Definition: OperationBehaviorProxy.hh:58
OperationSerializer.hh
OperationSerializer
Definition: OperationSerializer.hh:49
OperationIndex::paths_
std::vector< std::string > paths_
List of paths searched for the operation modules.
Definition: OperationIndex.hh:104
OperationBehaviorLoader
Definition: OperationBehaviorLoader.hh:54
OperationIndex::readOperations
void readOperations(const OperationModule &module)
Definition: OperationIndex.cc:386
Operation
Definition: Operation.hh:59
OperationIndex::loader_
OperationBehaviorLoader loader_
Definition: OperationIndex.hh:115
OperationIndex::~OperationIndex
virtual ~OperationIndex()
Definition: OperationIndex.cc:67
OperationIndex::operator=
OperationIndex & operator=(const OperationIndex &)
Assignment not allowed.
OperationIndex::ModuleTable
std::map< std::string, std::vector< OperationModule * > > ModuleTable
Contains all operation modules indexed by full path names.
Definition: OperationIndex.hh:87
OperationIndex::modulesInPath_
ModuleTable modulesInPath_
Contains all operation modules found in a search path organized by path names.
Definition: OperationIndex.hh:107
OperationIndex::moduleCount
int moduleCount() const
OperationModule
Definition: OperationModule.hh:46
OperationIndex::effectiveOperation
Operation * effectiveOperation(const TCEString &name)
Definition: OperationIndex.cc:454
TCEString
Definition: TCEString.hh:53
OperationIndex::path
std::string path(int i) const
OperationIndex
Definition: OperationIndex.hh:58
OperationIndex.icc
OperationIndex::OperationIndex
OperationIndex()
Definition: OperationIndex.cc:58
OperationIndex::removeModule
void removeModule(const std::string &path, const std::string &modName)
Definition: OperationIndex.cc:212
OperationIndex::serializer_
OperationSerializer serializer_
Reads the operation property definitions.
Definition: OperationIndex.hh:114
OperationIndex::operationCount
int operationCount(const OperationModule &om)
Definition: OperationIndex.cc:363
OperationIndex::module
OperationModule & module(int i)
OperationIndex::moduleOf
OperationModule & moduleOf(const std::string &name)
Definition: OperationIndex.cc:315
OperationIndex::operationName
std::string operationName(int i, const OperationModule &om)
Definition: OperationIndex.cc:337