Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

OMF::Primitive Class Reference

#include <Primitive.hpp>

Inheritance diagram for OMF::Primitive:

OMF::Object OMF::Boolean OMF::Enumeration OMF::Integer OMF::String OMF::UnlimitedNatural UML::Geometry UML::LocationReference UML::Name UML::UnlimitedInteger List of all members.

Detailed Description

The primitive class is a base class for all primitive types. While primitive types are formally defined in a different package, we implement them here for the sake of simplicity in organization. A Primitive, in this context, is basically a wrapper of a standard string. It provides basic access to the string version of the value. Derived classes provide type specific interfaces such as integer or boolean access. This class is abstract and cannot be instantiated.


Public Member Functions

virtual  ~Primitive ()
const Primitive operator= (const Primitive &value)
const Primitive operator= (const std::string &value)
  operator const std::string & () const
  operator const char * () const
bool  empty () const
void  clear ()
const std::string &  str () const
virtual unsigned  hashCode () const
virtual const std::string &  typeCode () const =0
ModelObject metaObject ()

Protected Member Functions

  Primitive (const std::string &mc)
  Primitive (const std::string &mc, const Primitive &value)
  Primitive (const std::string &mc, const std::string &value)

Protected Attributes

bool  _empty
  True indicates a non-value.
std::string  _value
  The string value of the primitive.

Constructor & Destructor Documentation

OMF::Primitive::Primitive const std::string &  mc  )  [protected]
 

OMF::Primitive::Primitive const std::string &  mc,
const Primitive value
[protected]
 

OMF::Primitive::Primitive const std::string &  mc,
const std::string &  value
[protected]
 

virtual OMF::Primitive::~Primitive  )  [virtual]
 


Member Function Documentation

void OMF::Primitive::clear  ) 
 

bool OMF::Primitive::empty  )  const
 

virtual unsigned OMF::Primitive::hashCode  )  const [virtual]
 

The default identity method for primitive types computes an integral hash on the string representation of the object. Derived primitives may overload this method to provide more accurate or efficient hashing capabilities.

Note that this method will return the same hash for primitives of different types containing the same value. However, since we don't usually deal with arrays of mixed primitives, this shouldn't really be an issue.

Implements OMF::Object.

Reimplemented in OMF::Integer, and OMF::UnlimitedNatural.

ModelObject* OMF::Object::metaObject  )  [inherited]
 

Return the meta-object of this instance. The meta-object is an instance of the metaclass of this object. For example, the metaclass of UML::Attribute is Model::Class. The metaobject for an instance of UML::Attribute is an instance of Model::Class.

This method may force a load of an entire metamodel in order to return the correct object.

OMF::Primitive::operator const char *  )  const
 

OMF::Primitive::operator const std::string &  )  const
 

const Primitive& OMF::Primitive::operator= const std::string &  value  ) 
 

Reimplemented in OMF::Boolean, OMF::Enumeration, OMF::Integer, OMF::String, OMF::UnlimitedNatural, Model::AggregationKind, Model::DirectionKind, Model::EvaluationKind, Model::ScopeKind, Model::VisibilityKind, UML::AggregationKind, UML::CallConcurrencyKind, UML::ChangeableKind, UML::Geometry, UML::LocationReference, UML::Name, UML::OrderingKind, UML::ParameterDirectionKind, UML::PseudostateKind, UML::ScopeKind, UML::UnlimitedInteger, and UML::VisibilityKind.

const Primitive& OMF::Primitive::operator= const Primitive value  ) 
 

const std::string& OMF::Primitive::str  )  const
 

Explicitly cast this object to a string.

virtual const std::string& OMF::Object::typeCode  )  const [pure virtual, inherited]
 

The typeCode method returns a textual description of an object's type. This can vary between classifications of objects. For primitives and collections, the names are essentially static. For model objects, enumerations and collections the name of the object is the scoped name of the instantiating class. Note that the names of primitives are not typed.

Implemented in OMF::Boolean, OMF::Integer, OMF::List, OMF::ModelObject, OMF::Set, OMF::String, OMF::UnlimitedNatural, Model::AggregationKind, Model::DirectionKind, Model::EvaluationKind, Model::ScopeKind, Model::VisibilityKind, UML::AggregationKind, UML::CallConcurrencyKind, UML::ChangeableKind, UML::Geometry, UML::LocationReference, UML::Name, UML::OrderingKind, UML::ParameterDirectionKind, UML::PseudostateKind, UML::ScopeKind, UML::UnlimitedInteger, and UML::VisibilityKind.


Member Data Documentation

bool OMF::Primitive::_empty [protected]
 

True indicates a non-value.

std::string OMF::Primitive::_value [protected]
 

The string value of the primitive.


The documentation for this class was generated from the following file:
Generated on Fri Sep 10 13:07:38 2004 for OpenModelingFramework by 1.3.8