OpenASIP 2.2
Loading...
Searching...
No Matches
OperationBehaviorProxy.hh
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2011 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 OperationBehaviorProxy.hh
26 *
27 * Declaration of OperationBehaviorProxy class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @author Pekka Jääskeläinen 2005,2011 (pjaaskel-no.spam-cs.tut.fi)
31 *
32 * @note rating: yellow
33 * @note reviewed 19 August 2004 by pj, jn, ao, ac
34 */
35
36#ifndef TTA_OPERATION_BEHAVIOR_PROXY_HH
37#define TTA_OPERATION_BEHAVIOR_PROXY_HH
38
39#include <vector>
40#include <set>
41
42#include "OperationBehavior.hh"
44
45class Operation;
46class SimValue;
49
50/**
51 * This class is used to create a behavior model of an operation.
52 *
53 * A first time operation calls simulateTrigger()
54 * proxy creates the appropriate operation behavior model for the operation.
55 * Proxy replaces itself in the operation with the newly created behavior
56 * model. That new model then executes all simulation functions.
57 */
59public:
61 Operation& targetOperation,
63 bool alwaysReloadBehavior=false);
64
66
67 virtual bool simulateTrigger(
68 SimValue** io,
69 OperationContext& context) const;
70
71 virtual bool canBeSimulated() const;
72
73 virtual void createState(OperationContext& context) const;
74 virtual void deleteState(OperationContext& context) const;
75
76 virtual void setAlwaysReloadBehavior(bool f) { alwaysReloadBehavior_ = f; }
77 void uninitializeBehavior() const;
78
79private:
80 /// Copying not allowed.
82 /// Assignment not allowed.
84
85 void initializeBehavior() const;
86
87 /// Operation that owns this proxy;
89 /// Used to load behavior model for operation.
91 /// Flag indicating whether proxy is initialized or not.
92 mutable bool initialized_;
93 /// Clean up list for created OperationDAGBehaviors
94 mutable std::set<OperationDAGBehavior*> cleanUs_;
95 /// If this is true, the behavior is always (re)loaded from the
96 /// dynamic library or the DAG instead of loading it once and
97 /// reusing in the future calls.
99 /// Helpers variable to catch infinite recursive function call due to
100 /// missing or undefined operation behavior.
102};
103
104#endif
virtual void deleteState(OperationContext &context) const
std::set< OperationDAGBehavior * > cleanUs_
Clean up list for created OperationDAGBehaviors.
bool alreadyCreatingState_
Helpers variable to catch infinite recursive function call due to missing or undefined operation beha...
bool initialized_
Flag indicating whether proxy is initialized or not.
Operation * target_
Operation that owns this proxy;.
OperationBehaviorProxy & operator=(const OperationBehaviorProxy &)
Assignment not allowed.
virtual bool canBeSimulated() const
OperationBehaviorLoader * loader_
Used to load behavior model for operation.
virtual bool simulateTrigger(SimValue **io, OperationContext &context) const
virtual void setAlwaysReloadBehavior(bool f)
bool alwaysReloadBehavior_
If this is true, the behavior is always (re)loaded from the dynamic library or the DAG instead of loa...
virtual void createState(OperationContext &context) const
OperationBehaviorProxy(const OperationBehaviorProxy &)
Copying not allowed.