Class: AutoC::Collection Abstract
- Defined in:
- lib/autoc/collection.rb
Overview
Generator for C types which contain zero or more elements of a particular type
Direct Known Subclasses
Constant Summary
Constants inherited from Composite
AutoC::Composite::DEFINITIONS, AutoC::Composite::PRIVATE
Constants included from Entity
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 collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Attributes inherited from Composite
Attributes inherited from Type
Class Method Summary collapse
Instance Method Summary collapse
-
#comparable? ⇒ Boolean
For container to be comparable a comparable element type is required.
-
#copyable? ⇒ Boolean
For container to be copyable a copyable element type is required.
-
#destructible? ⇒ Boolean
A destructible element type mandates creation of the container’s destructor.
-
#hashable? ⇒ Boolean
For container to be hashable a hashable element type is required.
-
#initialize(signature, element, **kws) ⇒ Collection
constructor
A new instance of Collection.
-
#orderable? ⇒ Boolean
For container to be orderable an orderable element type is required.
- #type_tag ⇒ Object
Methods inherited from Composite
allocator, allocator=, #const_lvalue, #const_rvalue, decorator, decorator=, #defgroup, hasher, #hasher, hasher=, #identifier, #ingroup, #inspect, #internal?, #lvalue, #memory, #prefix, #private?, #public?, #respond_to_missing?, #rvalue, #to_value
Methods included from Entity
#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references
Methods inherited from Type
abstract, #constructible?, #copy, #custom_constructible?, #custom_create, #default_constructible?, #default_create, #destroy, #inspect, #to_s, #to_type
Constructor Details
#initialize(signature, element, **kws) ⇒ Collection
Returns a new instance of Collection.
28 29 30 31 |
# File 'lib/autoc/collection.rb', line 28 def initialize(signature, element, **kws) super(signature, **kws) dependencies << (@element = element.to_type) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AutoC::Composite
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
18 19 20 |
# File 'lib/autoc/collection.rb', line 18 def element @element end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
20 21 22 |
# File 'lib/autoc/collection.rb', line 20 def range @range end |
Class Method Details
.new(*args, **kws) ⇒ Object
22 23 24 25 26 |
# File 'lib/autoc/collection.rb', line 22 def self.new(*args, **kws) obj = super obj.references << obj.range # Range has to be referenced after the iterable object gets fully configured obj end |
Instance Method Details
#comparable? ⇒ Boolean
For container to be comparable a comparable element type is required
37 |
# File 'lib/autoc/collection.rb', line 37 def comparable? = super && element.comparable? |
#copyable? ⇒ Boolean
For container to be copyable a copyable element type is required
34 |
# File 'lib/autoc/collection.rb', line 34 def copyable? = super && element.copyable? |
#destructible? ⇒ Boolean
A destructible element type mandates creation of the container’s destructor
43 |
# File 'lib/autoc/collection.rb', line 43 def destructible? = super || element.destructible? |
#hashable? ⇒ Boolean
For container to be hashable a hashable element type is required
46 |
# File 'lib/autoc/collection.rb', line 46 def hashable? = super && element.hashable? |
#orderable? ⇒ Boolean
For container to be orderable an orderable element type is required
40 |
# File 'lib/autoc/collection.rb', line 40 def orderable? = super && element.orderable? |
#type_tag ⇒ Object
48 |
# File 'lib/autoc/collection.rb', line 48 def type_tag = "#{signature}<#{element}>" |