Class: AutoC::Association Abstract

Inherits:
Collection show all
Defined in:
lib/autoc/association.rb

Overview

This class is abstract.

Generator for C types for direct access using index of specific type (hash/tree maps, string, vector etc.)

Direct Known Subclasses

CString, HashMap, Vector

Constant Summary

Constants inherited from Composite

Composite::DEFINITIONS, 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 collapse

Attributes inherited from Collection

#element, #range

Attributes inherited from Composite

#_master, #visibility

Attributes inherited from Type

#signature

Instance Method Summary collapse

Methods inherited from Collection

new

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

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(type, element, index, **kws) ⇒ Association

Returns a new instance of Association.



20
21
22
23
# File 'lib/autoc/association.rb', line 20

def initialize(type, element, index, **kws)
  super(type, element, **kws)
  dependencies << (@index = index.to_type)
end

Dynamic Method Handling

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

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



18
19
20
# File 'lib/autoc/association.rb', line 18

def index
  @index
end

Instance Method Details

#comparable?Boolean

For associative container to be comparable both hashable element and index types are required

Returns:

  • (Boolean)


29
# File 'lib/autoc/association.rb', line 29

def comparable? = super && index.comparable?

#copyable?Boolean

For associative container to be copyable both hashable element and index types are required

Returns:

  • (Boolean)


26
# File 'lib/autoc/association.rb', line 26

def copyable? = super && index.copyable?

#destructible?Boolean

The associative destructible element and index types mandates creation of the container’s destructor

Returns:

  • (Boolean)


35
# File 'lib/autoc/association.rb', line 35

def destructible? = super || index.destructible?

#hashable?Boolean

For associative container to be hashable both hashable element and index types are required

Returns:

  • (Boolean)


38
# File 'lib/autoc/association.rb', line 38

def hashable? = super && index.hashable?

#orderable?Boolean

For associative container to be orderable both hashable element and index types are required

Returns:

  • (Boolean)


32
# File 'lib/autoc/association.rb', line 32

def orderable? = super && index.orderable?

#type_tagObject



40
# File 'lib/autoc/association.rb', line 40

def type_tag = "#{signature}<#{element},#{index}>"