OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [tools/] [src/] [librtcltools/] [RtclSet.ipp] - Blame information for rev 25

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: RtclSet.ipp 488 2013-02-16 18:49:47Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller 
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
//
14
// Revision History:
15
// Date         Rev Version  Comment
16
// 2013-02-12   487   1.0    Initial version
17
// ---------------------------------------------------------------------------
18
 
19
/*!
20
  \file
21
  \version $Id: RtclSet.ipp 488 2013-02-16 18:49:47Z mueller $
22
  \brief   Implemenation (inline) of class RtclSet.
23
*/
24
 
25
/*!
26
  \class Retro::RtclSet
27
  \brief FIXME_docs
28
*/
29
 
30
#include 
31
#include 
32
 
33
// all method definitions in namespace Retro
34
namespace Retro {
35
 
36
//------------------------------------------+-----------------------------------
37
//! FIXME_docs
38
 
39
template 
40
inline RtclSet::RtclSet(const boost::function& set)
41
  : fSet(set)
42
{}
43
 
44
//------------------------------------------+-----------------------------------
45
//! FIXME_docs
46
 
47
template 
48
inline RtclSet::~RtclSet()
49
{}
50
 
51
//------------------------------------------+-----------------------------------
52
//! FIXME_docs
53
 
54
template <>
55
inline void RtclSet::operator()(RtclArgs& args) const
56
{
57
  int val;
58
  if(Tcl_GetBooleanFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
59
    throw Rexception("RtclSet<>::oper()", "conversion error");
60
 
61
  fSet((bool)val);
62
  return;
63
}
64
 
65
//------------------------------------------+-----------------------------------
66
//! FIXME_docs
67
 
68
template <>
69
inline void RtclSet::operator()(RtclArgs& args) const
70
{
71
  int val;
72
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
73
    throw Rexception("RtclSet<>::oper()", "conversion error");
74
  if (val < CHAR_MIN || val > CHAR_MAX)
75
    throw Rexception("RtclSet<>::oper()",
76
                     "out of range for type 'char'");
77
 
78
  fSet((char)val);
79
  return;
80
}
81
 
82
//------------------------------------------+-----------------------------------
83
//! FIXME_docs
84
 
85
template <>
86
inline void RtclSet::operator()(RtclArgs& args) const
87
{
88
  int val;
89
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
90
    throw Rexception("RtclSet<>::oper()", "conversion error");
91
  if (val < SCHAR_MIN || val > SCHAR_MAX)
92
    throw Rexception("RtclSet<>::oper()",
93
                     "out of range for type 'signed char'");
94
 
95
  fSet((signed char)val);
96
  return;
97
}
98
 
99
//------------------------------------------+-----------------------------------
100
//! FIXME_docs
101
 
102
template <>
103
inline void RtclSet::operator()(RtclArgs& args) const
104
{
105
  int val;
106
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
107
    throw Rexception("RtclSet<>::oper()", "conversion error");
108
  if ((unsigned int)val > UCHAR_MAX)
109
    throw Rexception("RtclSet<>::oper()",
110
                     "out of range for type 'unsigned char'");
111
 
112
  fSet((unsigned char)val);
113
  return;
114
}
115
 
116
//------------------------------------------+-----------------------------------
117
//! FIXME_docs
118
 
119
template <>
120
inline void RtclSet::operator()(RtclArgs& args) const
121
{
122
  int val;
123
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
124
    throw Rexception("RtclSet<>::oper()", "conversion error");
125
  if (val < SHRT_MIN || val > SHRT_MAX)
126
    throw Rexception("RtclSet<>::oper()",
127
                     "out of range for type 'short'");
128
 
129
  fSet((short)val);
130
  return;
131
}
132
 
133
//------------------------------------------+-----------------------------------
134
//! FIXME_docs
135
 
136
template <>
137
inline void RtclSet::operator()(RtclArgs& args) const
138
{
139
  int val;
140
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
141
    throw Rexception("RtclSet<>::oper()", "conversion error");
142
  if ((unsigned int)val > USHRT_MAX)
143
    throw Rexception("RtclSet<>::oper()",
144
                     "out of range for type 'unsigned short'");
145
 
146
  fSet((unsigned short)val);
147
  return;
148
}
149
 
150
//------------------------------------------+-----------------------------------
151
//! FIXME_docs
152
 
153
template <>
154
inline void RtclSet::operator()(RtclArgs& args) const
155
{
156
  int val;
157
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
158
    throw Rexception("RtclSet<>::oper()", "conversion error");
159
 
160
  fSet(val);
161
  return;
162
}
163
 
164
//------------------------------------------+-----------------------------------
165
//! FIXME_docs
166
 
167
template <>
168
inline void RtclSet::operator()(RtclArgs& args) const
169
{
170
  int val;
171
  if(Tcl_GetIntFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
172
    throw Rexception("RtclSet<>::oper()", "conversion error");
173
 
174
  fSet((unsigned int) val);
175
  return;
176
}
177
 
178
//------------------------------------------+-----------------------------------
179
//! FIXME_docs
180
 
181
template <>
182
inline void RtclSet::operator()(RtclArgs& args) const
183
{
184
  long val;
185
  if(Tcl_GetLongFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
186
    throw Rexception("RtclSet<>::oper()", "conversion error");
187
 
188
  fSet(val);
189
  return;
190
}
191
 
192
//------------------------------------------+-----------------------------------
193
//! FIXME_docs
194
 
195
template <>
196
inline void RtclSet::operator()(RtclArgs& args) const
197
{
198
  long val;
199
  if(Tcl_GetLongFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
200
    throw Rexception("RtclSet<>::oper()", "conversion error");
201
 
202
  fSet((unsigned long) val);
203
  return;
204
}
205
 
206
//------------------------------------------+-----------------------------------
207
//! FIXME_docs
208
 
209
template <>
210
inline void RtclSet::operator()(RtclArgs& args) const
211
{
212
  double val;
213
  if(Tcl_GetDoubleFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
214
    throw Rexception("RtclSet<>::oper()", "conversion error");
215
  if (val < -FLT_MAX || val > FLT_MAX)
216
    throw Rexception("RtclSet<>::oper()",
217
                     "out of range for type 'float'");
218
 
219
  fSet((float)val);
220
  return;
221
}
222
 
223
//------------------------------------------+-----------------------------------
224
//! FIXME_docs
225
 
226
template <>
227
inline void RtclSet::operator()(RtclArgs& args) const
228
{
229
  double val;
230
  if(Tcl_GetDoubleFromObj(args.Interp(), args.CurrentArg(), &val) != TCL_OK)
231
    throw Rexception("RtclSet<>::oper()", "conversion error");
232
 
233
  fSet(val);
234
  return;
235
}
236
 
237
//------------------------------------------+-----------------------------------
238
//! FIXME_docs
239
 
240
template <>
241
inline void RtclSet::operator()(RtclArgs& args) const
242
{
243
  char* val = Tcl_GetString(args.CurrentArg());
244
  fSet(std::string(val));
245
  return;
246
}
247
 
248
 
249
} // end namespace Retro
250
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.