Method: BOAST::Variable#initialize
- Defined in:
- lib/BOAST/Language/Variable.rb
#initialize(name, type, properties = {}) ⇒ Variable
Creates a new BOAST::Variable
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/BOAST/Language/Variable.rb', line 265 def initialize(name, type, properties={}) @name = name.to_s @direction = properties[:direction] @direction = properties[:dir] unless @direction @constant = properties[:constant] @constant = properties[:const] unless @constant @dimension = properties[:dimension] @dimension = properties[:dim] unless @dimension @local = properties[:local] @local = properties[:shared] unless @local @texture = properties[:texture] @allocate = properties[:allocate] @restrict = properties[:restrict] @alignment = properties[:align] @deferred_shape = properties[:deferred_shape] @optional = properties[:optional] @reference = properties[:reference] @force_replace_constant = false @replace_constant = properties[:replace_constant] if @texture and lang == CL then @sampler = Variable::new("sampler_#{name}", CustomType,:type_name => "sampler_t" ,:replace_constant => false, :constant => "CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST") else @sampler = nil end @scalar_output = false if @dimension then @dimension = [@dimension].flatten else @scalar_output = true if @direction == :out or @direction == :inout end @type = type::new(properties) @properties = properties end |