diff options
Diffstat (limited to 'sca-cpp/trunk/modules/scdl/scdl.hpp')
-rw-r--r-- | sca-cpp/trunk/modules/scdl/scdl.hpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/sca-cpp/trunk/modules/scdl/scdl.hpp b/sca-cpp/trunk/modules/scdl/scdl.hpp index 4d84610fb0..9d4bf38b50 100644 --- a/sca-cpp/trunk/modules/scdl/scdl.hpp +++ b/sca-cpp/trunk/modules/scdl/scdl.hpp @@ -53,6 +53,16 @@ const value name(const value& l) { } /** + * Convert a list of elements to a name -> element assoc list. + */ +const list<value> nameToElementAssoc(const list<value>& l) { + if (isNil(l)) + return l; + const value e(car(l)); + return cons<value>(mklist<value>(name(e), e), nameToElementAssoc(cdr(l))); +} + +/** * Returns the scdl declaration with the given name. */ struct filterName { @@ -107,17 +117,20 @@ const list<value> references(const value& l) { } /** - * Returns a list of properties in a component. + * Returns the target of a reference. */ -const list<value> properties(const value& l) { - return elementChildren("property", l); +const value target(const value& l) { + return attributeValue("target", l); } /** - * Returns the target of a reference. + * Convert a list of references to a reference name -> target assoc list. */ -const value target(const value& l) { - return attributeValue("target", l); +const list<value> referenceToTargetAssoc(const list<value>& r) { + if (isNil(r)) + return r; + const value ref(car(r)); + return cons<value>(mklist<value>(scdl::name(ref), scdl::target(ref)), referenceToTargetAssoc(cdr(r))); } /** @@ -132,6 +145,13 @@ const list<value> bindings(const value& l) { } /** + * Returns a list of properties in a component. + */ +const list<value> properties(const value& l) { + return elementChildren("property", l); +} + +/** * Returns the type of an implementation. */ const value implementationType(const value& l) { |