OpenASIP  2.0
OperationState.cc
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 OperationState.cc
26  *
27  * Non-inline definitions of OperationState class.
28  *
29  * @author Pekka Jääskeläinen 2004 (pekka.jaaskelainen-no.spam-tut.fi)
30  * @note rating: red
31  * @note reviewed 7 September 2004 by pj, jn, jm, ao
32  */
33 
34 #include "Application.hh"
35 #include "OperationState.hh"
36 #include "OperationContext.hh"
37 
39 
40 /**
41  * Constructor.
42  */
44 }
45 
46 /**
47  * Destructor.
48  */
50 }
51 
52 /**
53  * Returns true if operation state is in "available" state.
54  *
55  * If operation state is available, it means that new operations can be
56  * started. If it's not avaiable, no further operations should be invoked.
57  *
58  * @param context The operation context of which availability to check.
59  * @return True if operation state is in available state. By default, operation
60  * state is available.
61  */
62 bool
64  return true;
65 }
66 
67 /**
68  * This method should be invoced in every clock cycle.
69  *
70  * If this method is not invoced on every clock cycle, some pending results
71  * may get lost.
72  *
73  * @param context The operation context which should be used for calculating
74  * the pending results.
75  */
76 void
78 }
79 
80 ///////////////////////////////////////////////////////////////////////////////
81 // NullOperationState
82 ///////////////////////////////////////////////////////////////////////////////
83 
84 
85 const std::string NULL_ERROR_MESSAGE =
86  "Tried to access NULL OperationState object.";
87 /**
88  * Returns the name of the state instance, in this case an empty string.
89  *
90  * @return Empty string.
91  */
92 const char*
94  return "";
95 }
96 
97 /**
98  * Prints an error message and aborts the program.
99  *
100  * @return Never returns.
101  */
102 bool
105  return false;
106 }
107 
108 /**
109  * Prints an error message and aborts the program.
110  *
111  * @return Never returns.
112  */
113 void
116 }
NullOperationState::name
virtual const char * name()
Definition: OperationState.cc:93
NullOperationState::instance_
static NullOperationState * instance_
Definition: OperationState.hh:72
OperationState::isAvailable
virtual bool isAvailable(const OperationContext &context) const
Definition: OperationState.cc:63
OperationContext
Definition: OperationContext.hh:56
NullOperationState::advanceClock
virtual void advanceClock(OperationContext &context)
Definition: OperationState.cc:114
OperationState::advanceClock
virtual void advanceClock(OperationContext &context)
Definition: OperationState.cc:77
OperationState.hh
abortWithError
#define abortWithError(message)
Definition: Application.hh:72
Application.hh
NullOperationState
Definition: OperationState.hh:63
OperationState::OperationState
OperationState()
Definition: OperationState.cc:43
NullOperationState::isAvailable
virtual bool isAvailable(const OperationContext &context) const
Definition: OperationState.cc:103
NULL_ERROR_MESSAGE
const std::string NULL_ERROR_MESSAGE
Definition: OperationState.cc:85
OperationState::~OperationState
virtual ~OperationState()
Definition: OperationState.cc:49
OperationContext.hh