WvStreams
include/iwvlistener.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * An interface for "listeners", streams that spawn other streams from
6 * (presumably) incoming connections.
7 */
8#ifndef __IWVLISTENER_H
9#define __IWVLISTENER_H
10
11#include "iwvstream.h"
12
13typedef wv::function<void(IWvStream*)> IWvListenerCallback;
14typedef wv::function<IWvStream*(IWvStream*)> IWvListenerWrapper;
15
16class IWvListener : public IWvStream
17{
18public:
19 static IWvListener *create(WvString moniker, IObject *obj = NULL);
20
25 virtual IWvStream *accept() = 0;
26
32 virtual IWvListenerCallback onaccept(IWvListenerCallback _cb) = 0;
33
41 virtual void addwrap(IWvListenerWrapper _wrapper) = 0;
42};
43
44DEFINE_IID(IWvListener, {0xe7c2433a, 0x6d5c, 0x4345, {0x83,
45 0xee, 0xc0, 0x0f, 0xa7, 0xe3, 0x08, 0xeb}});
46
47#endif // __IWVLISTENER_H
The basic interface which is included by all other XPLC interfaces and objects.
virtual IWvStream * accept()=0
Accept a connection from this stream.
virtual IWvListenerCallback onaccept(IWvListenerCallback _cb)=0
Set a user-defined function to be called when a new connection is available.
virtual void addwrap(IWvListenerWrapper _wrapper)=0
Add a wrapper function for this stream: something that accept() will call to possibly wrap the stream...
WvString is an implementation of a simple and efficient printable-string class.
#define DEFINE_IID(iface, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11)
Used to define the IID of an interface.