cuex/compound.h: Compound Expressions
[cuex: Expressions]

Data Structures

struct  cuex_intf_compound

Defines

#define CUEX_COMPOUNDFLAG_PREFER_NCOMM   1
#define CUEX_COMPOUNDFLAG_PREFER_COMM   2
#define CUEX_COMPOUNDFLAG_NCOMM_IDEMPOTENT   4
#define CUEX_COMPOUNDFLAG_COMM_IDEMPOTENT   8
#define CUEX_COMPOUNDFLAG_NCOMM_FILTERABLE_IMAGE   16
#define CUEX_COMPOUNDFLAG_COMM_FILTERABLE_IMAGE   32
#define CUEX_COMPOUNDFLAG_NCOMM_EXPANSIVE_IMAGE   64
#define CUEX_COMPOUNDFLAG_COMM_EXPANSIVE_IMAGE   128

Typedefs

typedef struct cuex_intf_compoundcuex_intf_compound_t

Functions

cuex_intf_compound_t cuex_type_compound (cuoo_type_t type)
void cuex_intf_compound_finish (cuex_intf_compound_t impl)
size_t cuex_compound_size (cuex_intf_compound_t impl, cuex_t C)
cu_ptr_source_t cuex_compound_pref_iter_source (cuex_intf_compound_t impl, cuex_t C)
cu_ptr_source_t cuex_compound_comm_iter_source (cuex_intf_compound_t impl, cuex_t C)
cu_ptr_junctor_t cuex_compound_pref_image_junctor (cuex_intf_compound_t impl, cuex_t C)
cu_ptr_junctor_t cuex_compound_comm_image_junctor (cuex_intf_compound_t impl, cuex_t C)
cu_ptr_source_t cuex_ncomm_source (cuex_t e)
cu_ptr_source_t cuex_comm_source (cuex_t e)
cu_ptr_source_t cuex_pref_source (cuex_t e)

Detailed Description

Compound expressions, or compounds for short, are containers of expressions (dynamic objects and operations). Compounds are also themselves expressions. One thing you can do an compounds without knowing more about their structure is to iterate over their subexpressions. Further, compounds may support creation of their image under a function or iterable construction.

The following terminology will reflect that compounds are geared towards representing associative binary operations, though it is just as useful for containers. We distinguish between non-commutative and commutative views. A compound may bind one or both views. For example, a map may be an commutative compound of key-value pairs, or a non-commutative compound of just the values where the keys are treated inertly. Conversely, a vector may have a commutative iterator where the values are index-value pairs.


Define Documentation

#define CUEX_COMPOUNDFLAG_COMM_EXPANSIVE_IMAGE   128

Set iff cuex_intf_compound::comm_image_junctor allows adding extra elements by calling cu_ptr_junction_put more than once after a call to cu_ptr_junction_get.

#define CUEX_COMPOUNDFLAG_COMM_FILTERABLE_IMAGE   32

Set iff cuex_intf_compound::comm_image_junctor allows dropping elements by omitting some calls to cu_ptr_junction_put.

#define CUEX_COMPOUNDFLAG_COMM_IDEMPOTENT   8

Set iff equal elements reduces to a single occurrence for the commutative interface.

#define CUEX_COMPOUNDFLAG_NCOMM_EXPANSIVE_IMAGE   64

Set iff cuex_intf_compound::ncomm_image_junctor allows adding extra elements by calling cu_ptr_junction_put more than once after a call to cu_ptr_junction_get.

#define CUEX_COMPOUNDFLAG_NCOMM_FILTERABLE_IMAGE   16

Set iff cuex_intf_compound::ncomm_image_junctor allows dropping elements by omitting some calls to cu_ptr_junction_put.

#define CUEX_COMPOUNDFLAG_NCOMM_IDEMPOTENT   4

Set iff successive elements which are equal reduces to a single occurrence for the non-commutative interface.

#define CUEX_COMPOUNDFLAG_PREFER_COMM   2

Set if the commutative interface is preferable when an algorithm supports both. This flag must be set if the non-commutative interface is unbound.

#define CUEX_COMPOUNDFLAG_PREFER_NCOMM   1

Set if the non-commutative interface is preferable when an algorithm supports both. This flag must be set if the commutative interface is unbound.


Function Documentation

cu_ptr_source_t cuex_comm_source ( cuex_t  e  ) 

Returns an unordered sequence over immediate subexpressions of e. For operations, a sequence of cuex_o2_metapair are returned, where the first operand is an cudyn_int of the position, and the second is the original operand. For compounds, the (possibly synthesised) commutative view is returned. Returns the empty iterator for atomic expressions.

cu_ptr_junctor_t cuex_compound_comm_image_junctor ( cuex_intf_compound_t  impl,
cuex_t  C 
)

Returns a junctor for constructing an image of C using the commutative view.

cu_ptr_source_t cuex_compound_comm_iter_source ( cuex_intf_compound_t  impl,
cuex_t  C 
)

Returns a source for iterating through C using the commutative view.

cu_ptr_junctor_t cuex_compound_pref_image_junctor ( cuex_intf_compound_t  impl,
cuex_t  C 
)

Returns a junctor for constructing an image of C using either non-commutative or commutative view as preferred by the compound.

cu_ptr_source_t cuex_compound_pref_iter_source ( cuex_intf_compound_t  impl,
cuex_t  C 
)

Returns a source for iterating through C using either non-commutative or commutative view as preferred by the compound.

size_t cuex_compound_size ( cuex_intf_compound_t  impl,
cuex_t  C 
)

Returns the number of elements in C.

void cuex_intf_compound_finish ( cuex_intf_compound_t  impl  ) 

Verifies that impl has been correctly initialised, and may synthesise some missing fields as indicated in cuex_intf_compound.

cu_ptr_source_t cuex_ncomm_source ( cuex_t  e  ) 

Returns an ordered sequence over immediate subexpressions of e. For operations, yields the opreands in order (as returned by cuex_opn_at). For compounds, returns the non-commutative source of the compound, or NULL if the compound only has a commutative view. Returns the empty interator for atomic expressions.

cu_ptr_source_t cuex_pref_source ( cuex_t  e  ) 

Returns a sequence over e, using the preferred iteration source. For operations, the operands are returned in order, as with cuex_ncomm_source. For compounds, cuex_compound_pref_iter_source is used. Returns the empty iterator for atomic expressions.

cuex_intf_compound_t cuex_type_compound ( cuoo_type_t  type  ) 

Returns the compound implementation of type, or NULL if not implemented for this type.

Generated 2009-11-23 for culibs-0.25 using Doxygen. Maintained by Petter Urkedal.