WvStreams
Main Page
Modules
Classes
Files
File List
File Members
include
pwvstream.h
1
/* -*- Mode: C++ -*-
2
* Worldvisions Weaver Software:
3
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
*/
5
#ifndef __PWVSTREAM_H
6
#define __PWVSTREAM_H
7
8
#include "iwvstream.h"
9
#include "wvstream.h"
// FIXME: don't include this!
10
#include "wvstreamclone.h"
// FIXME: don't include this!
11
#include "wvmoniker.h"
12
#include "wvtr1.h"
13
36
class
PWvStream
:
public
wv::shared_ptr<WvStream>
37
{
38
static
WvStream
*clean_stream(
IWvStream
*s)
39
{
40
WvStream
*ss =
dynamic_cast<
WvStream
*
>
(s);
41
if
(ss)
42
return
ss;
43
else
44
return
new
WvStreamClone
(s);
45
}
46
47
static
WvStream
*make_stream(
WvStringParm
moniker,
IObject
*obj)
48
{
49
IWvStream
*s = IWvStream::create(moniker, obj);
50
if
(!s)
51
s = wvcreate<IWvStream>(
"null:"
);
52
assert(s != NULL);
53
return
clean_stream(s);
54
}
55
56
public
:
57
PWvStream
()
58
{
59
// Pointer points to NULL right now, but it could be reassigned
60
// later using operator=().
61
}
62
63
PWvStream
(
IWvStream
*s)
64
: wv::shared_ptr<WvStream>(clean_stream(s),
65
wv::bind(&
IWvStream::release
, _1))
66
{
67
}
68
69
PWvStream
(
WvStringParm
moniker,
IObject
*obj = 0)
70
: wv::shared_ptr<WvStream>(make_stream(moniker, obj),
71
wv::bind(&
IWvStream::release
, _1))
72
{
73
// Note: pointer is definitely not NULL here, because make_stream is
74
// careful.
75
}
76
77
WvStream
*addRef()
const
78
{
79
if
(
get
())
80
get
()->addRef();
81
return
get
();
82
}
83
};
84
85
#endif // __PWVSTREAM_H
Generated on Thu Oct 31 2013 15:14:21 for WvStreams by
1.8.4