WvStreams
Main Page
Modules
Classes
Files
File List
File Members
include
wvmoniker.h
1
/* -*- Mode: C++ -*-
2
* Worldvisions Weaver Software:
3
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
*
5
* Support for monikers, which are strings that you can pass to a magic
6
* factory to get objects supporting a particular interface, without actually
7
* knowing anything about the constructor for those objects.
8
*/
9
#ifndef __WVMONIKER_H
10
#define __WVMONIKER_H
11
12
#include "wvstring.h"
13
#include "wvxplc.h"
14
15
class
WvMonikerRegistry
;
16
17
typedef
void
*WvMonikerCreateFunc(
WvStringParm
parms,
IObject
*obj);
18
31
class
WvMonikerBase
32
{
33
protected
:
34
WvMonikerBase
(
const
UUID
&iid,
WvStringParm
_id,
35
WvMonikerCreateFunc *func,
const
bool
override
=
false
);
36
~
WvMonikerBase
();
37
38
public
:
39
WvString
id;
40
WvMonikerRegistry
*reg;
41
};
42
43
60
template
<
class
T>
61
class
WvMoniker
:
public
WvMonikerBase
62
{
63
public
:
64
typedef
T *CreateFunc(
WvStringParm
parms,
IObject
*obj);
65
66
WvMoniker
(
WvStringParm
_id, CreateFunc *_func,
const
bool
override
=
false
)
67
:
WvMonikerBase
(
XPLC_IID<T>::get
(), _id, (WvMonikerCreateFunc *)_func,
68
override
)
69
{
70
// this looks pointless, but it ensures that T* can be safely,
71
// automatically downcast to IObject*. That means T is really derived
72
// from IObject, which is very important. The 'for' avoids a
73
// warning.
74
for
(
IObject
*silly = (T *)NULL; silly; )
75
;
76
};
77
};
78
79
89
void
*wvcreate(
const
UUID
&iid,
WvStringParm
s,
IObject
*obj);
90
91
103
template
<
class
T>
104
inline
T *wvcreate(
WvStringParm
s,
IObject
*obj = 0)
105
{
106
return
(T *)(wvcreate(
XPLC_IID<T>::get
(), s, obj));
107
}
108
109
110
#endif // __WVMONIKER_H
Generated on Thu Mar 14 2013 19:25:35 for WvStreams by
1.8.1.2