OpenASIP 2.2
Loading...
Searching...
No Matches
UnconditionalGuardEncoding.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 UnconditionalGuardEncoding.cc
26 *
27 * Implementation of UnconditionalGuardEncoding class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34
36#include "GuardField.hh"
37#include "ObjectState.hh"
38
39using std::string;
40
41const std::string UnconditionalGuardEncoding::
42OSNAME_UNCONDITIONAL_GUARD_ENCODING = "uc_guard_encoding";
43
44/**
45 * The constructor.
46 *
47 * Registers the encoding to the given guard field automatically.
48 *
49 * @param inverted Indicates whether the encoding is for always-true or
50 * always-false guard expression.
51 * @param encoding The encoding for unconditional guard.
52 * @param parent The parent guard field.
53 * @exception ObjectAlreadyExists If the guard field has an encoding for the
54 * same unconditional guard expression
55 * already, or if the given encoding is
56 * already assigned.
57 */
59 bool inverted, unsigned int encoding, GuardField& parent)
60 : GuardEncoding(inverted, encoding) {
63}
64
65/**
66 * The constructor.
67 *
68 * Loads the state of the object from the given ObjectState instance.
69 *
70 * @param state The ObjectState instance.
71 * @param parent The parent guard field.
72 * @exception ObjectStateLoadingException If an error occurs while loading
73 * the state.
74 * @exception ObjectAlreadyExists If the guard field has an encoding for the
75 * same unconditional guard expression
76 * already, of if the encoding in the
77 * ObjectState instance is already assigned.
78 */
80 const ObjectState* state, GuardField& parent)
81 : GuardEncoding(state) {
83 const string procName =
84 "UnconditionalGuardEncoding::UnconditionalGuardEncoding";
85 throw ObjectStateLoadingException(__FILE__, __LINE__, procName);
86 }
87
90}
91
92/**
93 * The destructor.
94 */
100
101
102/**
103 * Saves the state of the object to an ObjectState instance.
104 *
105 * @return The newly created ObjectState instance.
106 */
GuardField * parent() const
virtual ObjectState * saveState() const
void setParent(GuardField *parent)
void addGuardEncoding(GPRGuardEncoding &encoding)
void removeUnconditionalGuardEncoding(UnconditionalGuardEncoding &encoding)
void setName(const std::string &name)
std::string name() const
UnconditionalGuardEncoding(bool inverted, unsigned int encoding, GuardField &parent)
virtual ObjectState * saveState() const
static const std::string OSNAME_UNCONDITIONAL_GUARD_ENCODING
ObjectState name for unconditional guard encoding.