Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

wvmonikerregistry.h

Go to the documentation of this file.
00001 /* -*- Mode: C++ -*-
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
00004  * 
00005  * Support for moniker registries.  See wvmoniker.h.
00006  */
00007 #ifndef __WVMONIKERREGISTRY_H
00008 #define __WVMONIKERREGISTRY_H
00009 
00010 #include "wvmoniker.h"
00011 #include "wvhashtable.h"
00012 
00013 /**
00014  * A dictionary for holding moniker-prefix to factory-function mappings.
00015  * 
00016  * This is used by WvMoniker and wvcreate().  See those for details.
00017  */
00018 class WvMonikerRegistry : public IObject
00019 {
00020     struct Registration
00021     {
00022         WvString id;
00023         WvMonikerCreateFunc *func;
00024         
00025         Registration(WvStringParm _id, WvMonikerCreateFunc *_func) 
00026             : id(_id)
00027             { func = _func; }
00028     };
00029     
00030     DeclareWvDict(Registration, WvString, id);
00031 
00032     unsigned refcount;
00033     
00034 public:
00035     XUUID reg_iid;
00036     RegistrationDict dict;
00037     
00038     WvMonikerRegistry(const XUUID &iid);
00039     virtual ~WvMonikerRegistry();
00040     
00041     virtual void add(WvStringParm id, WvMonikerCreateFunc *func);
00042     virtual void del(WvStringParm id);
00043     
00044     virtual IObject *create(WvStringParm _s,
00045                             IObject *obj = NULL, void *userdata = NULL);
00046     
00047     // find a registry for objects of the given interface UUID
00048     static WvMonikerRegistry *find_reg(const XUUID &iid);
00049     
00050     // IObject stuff
00051     virtual IObject *getInterface(const XUUID &uuid);
00052     
00053     // we can't use GenericComponent, since we have to unregister ourselves
00054     // on the second-last release().
00055     virtual unsigned int addRef();
00056     virtual unsigned int release();
00057 };
00058 
00059 
00060 #endif // __WVMONIKERREGISTRY_H

Generated on Sat Feb 21 21:05:30 2004 for WvStreams by doxygen 1.3.5