home *** CD-ROM | disk | FTP | other *** search
- /*
- * NameMixin abstract class
- *
- * NameMixin class. provides objects of inheriting classes with
- * a name in the global object NameSpace.
- *
- * Copyright © John Wainwright 1989
- *
- * SuperClasses :
- *
- * Instance Vars :
- *
- * Class Vars :
- *
- * Methods :
- *
- * Class Methods :
- *
- */
-
- #include "oic.h"
- #include "generics.h"
- #include "names.h"
-
- class NameMixin; /* the NameMixin class */
-
- object namedObjects; /* the global object namespace */
-
- struct NameMixin_i /* NameMixin instance structure */
- {
- object theName; /* object name */
- };
- typedef struct NameMixin_i NameMixin_i;
-
- /* -------------------- NameMixin Instance methods ---------------- */
-
- method object
- _name(self, n, string)
- object self;
- register NameMixin_i *n;
- register char **string;
- {
- n->theName = declare(Name, *string);
- bind(namedObjects, n->theName, self);
- }
-
- method object
- _nameOf(self, n)
- object self;
- register NameMixin_i *n;
- {
- return n->theName;
- }
-
- /* ------------------- Init the NameMixin class -------------------- */
-
- InitNameMixinClass()
- {
- NameMixin = NewClass(0, 0, "NameMixin", END);
- AddMethods(NameMixin,
- nameGeneric, _name,
- nameOfGeneric, _nameOf,
- END);
-
- namedObjects = New(NameSpace, 256, 0);
- }
-
-