Class: AutoC::ContiguousRange Abstract

Inherits:
DirectAccessRange show all
Defined in:
lib/autoc/ranges.rb

Overview

This class is abstract.

Constant Summary

Constants inherited from Range

Range::INFO

Constants inherited from Composite

AutoC::Composite::DEFINITIONS, AutoC::Composite::PRIVATE

Constants included from Entity

Entity::ReferenceSet

Constants included from STD

STD::ASSERT_H, STD::BOOL, STD::CHAR, STD::COMPLEX, STD::COMPLEX_H, STD::DOUBLE, STD::DOUBLE_COMPLEX, STD::DOUBLE_T, STD::FLOAT, STD::FLOAT_COMPLEX, STD::FLOAT_T, STD::INT, STD::INTMAX_T, STD::INTPTR_T, STD::INTTYPES_H, STD::LONG, STD::LONG_DOUBLE, STD::LONG_DOUBLE_COMPLEX, STD::LONG_LONG, STD::MALLOC_H, STD::MATH_H, STD::PTRDIFF_T, STD::SHORT, STD::SIGNED_CHAR, STD::SIZE_T, STD::STDBOOL_H, STD::STDDEF_H, STD::STDLIB_H, STD::STRING_H, STD::UINTMAX_T, STD::UINTPTR_T, STD::UNSIGNED, STD::UNSIGNED_CHAR, STD::UNSIGNED_LONG, STD::UNSIGNED_LONG_LONG, STD::UNSIGNED_SHORT, STD::WCHAR_T

Instance Attribute Summary

Attributes inherited from Range

#iterable

Attributes inherited from Composite

#_master, #visibility

Attributes inherited from Type

#signature

Instance Method Summary collapse

Methods inherited from ForwardRange

#copyable?

Methods inherited from Range

#brief, #comparable?, #copyable?, #default_constructible?, #destructible?, #orderable?, #render_type_description, #to_value, #type_tag

Methods inherited from Composite

allocator, allocator=, #const_lvalue, #const_rvalue, decorator, decorator=, #defgroup, #hasher, hasher, hasher=, #identifier, #ingroup, #inspect, #internal?, #lvalue, #memory, new, #prefix, #private?, #public?, #respond_to_missing?, #rvalue, #to_value, #type_tag

Methods included from Entity

#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references

Methods inherited from Type

abstract, #comparable?, #constructible?, #copy, #copyable?, #custom_constructible?, #custom_create, #default_constructible?, #default_create, #destroy, #destructible?, #hashable?, #inspect, #orderable?, #to_s, #to_type

Constructor Details

#initialize(iterable, visibility: :public, parallel: nil) ⇒ ContiguousRange

Returns a new instance of ContiguousRange.



392
393
394
395
# File 'lib/autoc/ranges.rb', line 392

def initialize(iterable, visibility: :public, parallel: nil)
  super(iterable, visibility:)
  @parallel = parallel
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AutoC::Composite

Instance Method Details

#render_interface(stream) ⇒ Object



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/autoc/ranges.rb', line 397

def render_interface(stream)
  if public?
    case @parallel
    when nil
      stream << %{
        /**
          #{defgroup}

          #{brief}

          This is the range for contiguous data structures (vectors, strings etc.)

          It can be used the following way:

          @code{.c}
          for(#{signature} r = #{new}(&it); !#{empty}(&r); #{pop_front}(&r)) { ... }
          @endcode

          @see @ref Range

          @since 2.0
        */
      }
    when :openmp
      stream << %{
        /**
          #{defgroup}

          #{brief}

          This is the range for contiguous data structures (vectors, strings etc.)

          The @ref #{new} and @ref #{custom_create} range constructors create OpenMP-aware range objects
          which account for parallel iteration in the way

          @code{.c}
          #pragma omp parallel
          for(#{signature} r = #{new}(&it); !#{empty}(&r); #{pop_front}(&r)) { ... }
          @endcode

          @see @ref Range

          @since 2.0
        */
      }
    end
  end
  if public?
    stream << %{
      /**
        #{ingroup}
        @brief Opaque structure holding state of the contiguous container's range
        @since 2.0
      */
    }
  else
    stream << PRIVATE
  end
  stream << %{
    typedef struct {
      #{iterable.element.lvalue} front; /**< @private */
      #{iterable.element.lvalue} back; /**< @private */
    } #{signature};
  }
end