[Uml-devel] uml

Andrew Sutton ansutton at kent.edu
Thu Oct 17 09:55:04 UTC 2002


fuck it. here's core and data types. its *sort of* an implementation of the 
core package defined in the uml standard. there's 30 someodd classes 
involved. this inclues your basic modelling elements for static structure - 
classes, features and relationships. i think its also the biggest package of 
the remaining 7 packages defined by the uml standard.

anyway, the reason its only sort of an implementation is because it probably 
takes alot longer than 5 hours to implement the UML core - just a guess. 
Anyway, since the only thing in the entire standards are attributes and 
relationships, i've encapsulated the definition of those into very, very 
simple template classes. the attributes stuff is actually good to go. i don't 
think it needs alot more work. the relationship stuff is pretty weak. instead 
of trying to have each relationship manage its connection to its partner, 
i've just made both sides anonymous and made the act of connecting and 
disconnecting two elements atomic. there's some stuff in place that could be 
used to make relationships alot smarter, but i haven't extended it.

another reason this isn't a real implementation? there's absolutely no memory 
management. i've been so focsued on powering thru the class implementations, 
i kind of forgot about deleting objects that aren't used any more. the 
problem only applies to relationships - attributes are required to be 
pass-by-value. it might be fixed by using a simple reference counting wrapper 
for pointers.

finally, the 3rd reason this isn't a real implementation - its not connected 
to anything, and as such hasn't really been tested except for compilability. 
and that's only partially tested because the compiler won't generate code for 
template methods that aren't used (most of them) so i don't know if its even 
that usable. it should be.

anyway: brief notes on UTL (UML template library).
all the attribute and relation classes are based on multiplicity and ordering. 
i've refined the specifications in the UML standard into 3 possibilities. 
atts/rels of 0..1 multiplicity, unordered atts/rels of 0..n multiplicity and 
ordered attributes of 0..n multiplicity. Depending on the multiplicity of the 
attribute or relationship, you get a different interface.

0..1:			get(), set(), unset()
0..n unordered	get(), set(), add(), modify(), remove()
0..n ordered	get(), set(), add(), addBefore(), modify(), remove()

note: ordered doesn't mean sorted, just that ordering matters (FIFO style).

so declaring an object is pretty simple:
class UMLModelElement
{
public:
	utl::single_attribute<UMLName> name;
};

tough.

on the relationship side, we offer two template global template functions: 
connect<>() and disconnect<>(). They create endpoint<> structures and pass 
them to the relationships by calling connect() and disconnect() on the target 
relationships. An endpoint contains an element and a relationship object. 
This is the framework for better relationship management, but i haven't done 
anything with it.

before anybody sends me anything negative about this work: i know! i wrote it. 
its not that good. and no. i don't expect it to make it into the next 
release. this is just food for thought. it *could theoretically* be the 
foundation for a rewrite of the internal object model of UML, but its just 
not ready yet.

oh. by the way, its decently documented and you can generate the documentation 
using doxygen.

have fun.

andy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libuml.tar.gz
Type: application/x-tgz
Size: 24896 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/umbrello-devel/attachments/20021017/5beb97cd/attachment.bin>


More information about the umbrello-devel mailing list