stlab.adobe.com Adobe Systems Incorporated

Property model description assembler/disassembler. More...

Typedefs

typedef vector< dictionary_t > sheet_assembly_t

Functions

void assemble_sheet (const string_t &sheet_name, const sheet_assembly_t &assembly, std::ostream &out)
sheet_assembly_t disassemble_sheet (std::istream &stream, const line_position_t &position)

Detailed Description

This code is useful for parsing a property model description to an intermediate format for later modification and/or formatting back out to a CEL-based property model.

The layout disassembler finds three basic property model components during a parse called meta cells. The first meta cell type is a cell, the second a relation, and the third an interface. Cells are further broken down to one of several cell types, one of constant, input, output, logic, or invariant.

The set of parsed property model cells are stored in a vector of dictionaries. Each dictionary contains within it a set of associated values that completely describe the property model cell parsed. They are:

keymapped typefound indescriptionnotes
meta_cell_type adobe::name_t all dictionaries except relation subdictionaries The meta type of the cell parsed Value is one of key_meta_type_cell, key_meta_type_relation or key_meta_type_interface.
cell_type adobe::name_t Cells whose meta_type_cell is meta_type_cell. The type of cell parsed Value is one of interface, constant, input, output, logic, invariant.
comment_brief adobe::string_t all The comment found after the cell parsed in C++ "//..." format
comment_detailed adobe::string_t all The comment found before the cell parsed in C "/*...*/" format
conditional adobe::array_t relation cells Parsed token expression Used only with relation cells, and contains the expression p in the relation expression when (p) relate { ... }
expression adobe::array_t interface, output, logic, and invariant cells; relation subdictionary expressions Parsed token expression Expressions are the specific expressions found after the use of <== in the CEL grammar
initializer adobe::array_t interface, input, and constant cells Parsed token expression Initializers are the specific expressions found after the use of : in the CEL grammar
linked bool interface cells Denotes the existence of the unlink token in the CEL description
name adobe::name_t all dictionaries Name of the cell
relation_set adobe::array_t relation cells Contain a vector of dictionaries sotred in an array_t. Each relation subdictionary completely describes one relation in the set. Each relation dictionary contains the following keys as previously described: name, expression, comment_brief and comment_detailed
Example
Source File:
sheet travel
{
interface:
    rate : 1; // "meters/sec" implied unit
    time : 1; // "seconds" implied unit
    dist : 1; // "meters" implied unit

logic:
    relate {
        rate <== round(dist / time);
        time <== round(dist / rate);
        dist <== rate * time;
    }

output:
    result <== {
        rate: rate,
        time: time,
        dist: dist
    };

invariant:
    rate_min <== rate >= 0;
    time_min <== time >= 0;
    dist_min <== dist >= 0;
}
    
Cell Set Result:
[ {
	cell_meta_type: @key_meta_type_interface,
	comment_brief: ' "meters/sec" implied unit',
	comment_detailed: '',
	expression: [ ],
	initializer: [ 1 ],
	linked: true,
	name: @rate
}, {
	cell_meta_type: @key_meta_type_interface,
	comment_brief: ' "seconds" implied unit',
	comment_detailed: '',
	expression: [ ],
	initializer: [ 1 ],
	linked: true,
	name: @time
}, {
	cell_meta_type: @key_meta_type_interface,
	comment_brief: ' "meters" implied unit',
	comment_detailed: '',
	expression: [ ],
	initializer: [ 1 ],
	linked: true,
	name: @dist
}, {
	cell_meta_type: @key_meta_type_relation,
	comment_brief: '',
	comment_detailed: '',
	conditional: [ ],
	relation_set: [ {
		comment_brief: '',
		comment_detailed: '',
		expression: [ @dist, @.variable, @time, @.variable, @.divide, 1, @.array, @round, @.function ],
		name: @rate
	}, {
		comment_brief: '',
		comment_detailed: '',
		expression: [ @dist, @.variable, @rate, @.variable, @.divide, 1, @.array, @round, @.function ],
		name: @time
	}, {
		comment_brief: '',
		comment_detailed: '',
		expression: [ @rate, @.variable, @time, @.variable, @.multiply ],
		name: @dist
	} ]
}, {
	cell_meta_type: @key_meta_type_cell,
	cell_type: @output,
	comment_brief: '',
	comment_detailed: '',
	expression: [ @rate, @rate, @.variable, @time, @time, @.variable, @dist, @dist, @.variable, 3, @.dictionary ],
	name: @result
}, {
	cell_meta_type: @key_meta_type_cell,
	cell_type: @invariant,
	comment_brief: '',
	comment_detailed: '',
	expression: [ @rate, @.variable, 0, @.greater_equal ],
	name: @rate_min
}, {
	cell_meta_type: @key_meta_type_cell,
	cell_type: @invariant,
	comment_brief: '',
	comment_detailed: '',
	expression: [ @time, @.variable, 0, @.greater_equal ],
	name: @time_min
}, {
	cell_meta_type: @key_meta_type_cell,
	cell_type: @invariant,
	comment_brief: '',
	comment_detailed: '',
	expression: [ @dist, @.variable, 0, @.greater_equal ],
	name: @dist_min
} ]
    
See also:
  • adobe::format_expression

Typedef Documentation

typedef vector<dictionary_t> sheet_assembly_t

The result type of adobe::disassemble_sheet. It is a vector of dictionaries, each representing a property model cell parsed in the sheet.

Definition at line 267 of file property_model_formatter.hpp.


Function Documentation

void adobe::assemble_sheet ( const string_t &  sheet_name,
const sheet_assembly_t &  assembly,
std::ostream &  out 
)

Assembles fundamental property model components into a CEL-syntax property model definition.

Parameters:
sheet_namethe name to give to the final property model.
assemblythe fundamental property model components to be used in the property model creation
outthe stream to which the final result is to be output
sheet_assembly_t adobe::disassemble_sheet ( std::istream &  stream,
const line_position_t &  position 
)

Breaks down a property model definition to its fundamental components.

Parameters:
streamthe property model definition stream
positionan adobe::line_position_t describing the stream
Returns:
an adobe::sheet_assembly_t fully describing the property model cells

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google