OpenASIP  2.0
ExplorerPluginParameter.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2012 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 /**
26  * @file ExplorerPluginParameter.hh
27  *
28  * Implementation of ExplorerPluginParameter class.
29  *
30  * @author Esa Määttä 2008 (esa.maatta-no.spam-tut.fi)
31  * @author Pekka Jääskeläinen 2012
32  * @note rating: red
33  */
34 
35 #include <string>
36 
38 
39 
40 /**
41  * The constructor.
42  */
45  const std::string& name,
47  bool compulsory,
48  const TCEString value,
49  const TCEString description) :
50  name_(name), type_(type), compulsory_(compulsory), value_(value),
51  description_(description) {
52 }
53 
54 
55 /**
56  * The destructor.
57  */
59 }
60 
61 
64  return value_;
65 }
66 
67 
68 /**
69  * Sets the value of the parameter.
70  *
71  * @param value The value to be set for the parameter as a string.
72  */
73 void
74 ExplorerPluginParameter::setValue(const std::string& value) {
75  value_ = value;
76 }
77 
78 
79 
80 /**
81  * Returns the parameter name.
82  *
83  * @return Name of the parameter as a string.
84  */
87  return name_;
88 }
89 
90 
91 /**
92  * Returns enum for parameter type.
93  *
94  * @return ExplorerPluginParameterType enumeration for parameter type.
95  */
98  return type_;
99 }
100 
101 
102 /**
103  * Returns string describing the parameter type.
104  *
105  * @return ExplorerPluginParameterType as a string.
106  */
107 TCEString
109  switch (type_) {
110  case UINT:
111  return "unsigned int";
112  break;
113  case INT:
114  return "int";
115  break;
116  case STRING:
117  return "string";
118  break;
119  case BOOL:
120  return "boolean";
121  break;
122  default:
123  return "";
124  }
125 }
126 
127 
128 
129 /**
130  * Returns boolean indicating if the parameter is always needed.
131  *
132  * @return True if parameter is compulsory, false otherwise.
133  */
134 bool
136  return compulsory_;
137 }
138 
139 
140 /**
141  * Returns boolean indicating if the parameter is always needed.
142  *
143  * @return True if parameter is compulsory, false otherwise.
144  */
145 bool
147  return value_.empty() ? false : true;;
148 }
ExplorerPluginParameterType
ExplorerPluginParameterType
Definition: ExplorerPluginParameter.hh:40
ExplorerPluginParameter::isSet
bool isSet() const
Definition: ExplorerPluginParameter.cc:146
UINT
@ UINT
Definition: ExplorerPluginParameter.hh:40
ExplorerPluginParameter.hh
ExplorerPluginParameter::typeAsString
TCEString typeAsString() const
Definition: ExplorerPluginParameter.cc:108
ExplorerPluginParameter::name_
TCEString name_
Parameter name.
Definition: ExplorerPluginParameter.hh:70
ExplorerPluginParameter::name
TCEString name() const
Definition: ExplorerPluginParameter.cc:86
ExplorerPluginParameter::~ExplorerPluginParameter
virtual ~ExplorerPluginParameter()
Definition: ExplorerPluginParameter.cc:58
BOOL
@ BOOL
Definition: ExplorerPluginParameter.hh:40
ExplorerPluginParameter::value
TCEString value() const
Definition: ExplorerPluginParameter.cc:63
STRING
@ STRING
Definition: ExplorerPluginParameter.hh:40
ExplorerPluginParameter::type_
ExplorerPluginParameterType type_
Parameter type.
Definition: ExplorerPluginParameter.hh:72
INT
@ INT
Definition: ExplorerPluginParameter.hh:40
ExplorerPluginParameter::type
ExplorerPluginParameterType type() const
Definition: ExplorerPluginParameter.cc:97
ExplorerPluginParameter::setValue
void setValue(const std::string &value)
Definition: ExplorerPluginParameter.cc:74
ExplorerPluginParameter::value_
TCEString value_
The value of the parameter as a string, empty if none set.
Definition: ExplorerPluginParameter.hh:76
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
ExplorerPluginParameter::isCompulsory
bool isCompulsory() const
Definition: ExplorerPluginParameter.cc:135
TCEString
Definition: TCEString.hh:53
ExplorerPluginParameter::compulsory_
bool compulsory_
Is parameter compulsory.
Definition: ExplorerPluginParameter.hh:74
ExplorerPluginParameter::ExplorerPluginParameter
ExplorerPluginParameter(const std::string &name, ExplorerPluginParameterType type, bool compulsory, const TCEString value, const TCEString description="")
Definition: ExplorerPluginParameter.cc:44