///////////////////////////////////////////////////////////
// Copyright (c) 1997 TeleLOGIC AB. All rights reserved.
//
// This file is provided strictly on an as-is basis
///////////////////////////////////////////////////////////

#ifndef uml_h
#define uml_h

#ifdef STL_DUMMY_RELATIONAL_OPERATORS_NEEDED
// Some implementations of STL make extra (unnecessary) requirements of
// relational operators of container element types. This macro adds dummy
// implementations of such operators to a class.
#define DUMMY_RELATIONAL_OPERATORS(class) \
  inline bool operator == (const class&, const class &) { return true; } \
  inline bool operator != (const class&, const class &) { return true; } \
  inline bool operator < (const class&, const class &) { return true; } \
  inline bool operator > (const class&, const class &) { return true; }
#else
#define DUMMY_RELATIONAL_OPERATORS(class)
#endif

#include "stlmini.h"

enum AggregationKind { NO_AGGREGATION, AGGREGATE, COMPOSITE };
enum VisibilityKind { UNDEFINED, PUBLIC, PRIVATE, PROTECTED };

class ModelElement
{
public:
  string name;
};

class NameSpace : public ModelElement
{
public:
};

class Parameter : public ModelElement
{
public:
  // association to classifier
  string type;
};

DUMMY_RELATIONAL_OPERATORS(Parameter)

class Feature : public ModelElement
{
public:
  VisibilityKind visibility;
};

class StructuralFeature : public Feature
{
public:
  string type;
};

class Attribute : public StructuralFeature
{
public:
  string initialValue;
      
  // Not found in UML
  string note;
};

DUMMY_RELATIONAL_OPERATORS(Attribute)

class BehavioralFeature : public Feature
{
public:
  list<Parameter> parameterList;
};

class Operation : public BehavioralFeature
{
public:
  // Not found in UML
  string note;
  string returnType;
};

DUMMY_RELATIONAL_OPERATORS(Operation)

class Method : public BehavioralFeature
{
public:
};

class AssociationEnd : public ModelElement
{
public:
  // Name of class connected to
  string type;
  
  bool isSorted;
  bool isOrdered;

  AggregationKind aggregation;
  
  string multiplicity;      
  string roleName;
  string qualifier;
  string constraint;
};

class Generalization : public ModelElement
{
public:
  string discriminator;

  string supertype;
  string subtype;
};

DUMMY_RELATIONAL_OPERATORS(Generalization)

class GeneralizableElement : public NameSpace
{
public:
};

class Classifier : public GeneralizableElement
{
public:
  list<Operation> operationList;
  list<Attribute> attributeList;
};

class Class : public Classifier
{
public:
  bool isActive;
  string stereotype;
  string property;
};

DUMMY_RELATIONAL_OPERATORS(Class)

class Association : public GeneralizableElement
{
public:
  bool isAggregation;
  
  AssociationEnd fromEnd;
  AssociationEnd toEnd;
};

class AssociationClass : public Class, public Association
{
public:
  bool hasAssociationClass;      
};

#endif // uml_h
