WvStreams
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 
13 typedef wv::function<void(IWvStream*)> IWvListenerCallback;
14 typedef wv::function<IWvStream*(IWvStream*)> IWvListenerWrapper;
15 
16 class IWvListener : public IWvStream
17 {
18 public:
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 
44 DEFINE_IID(IWvListener, {0xe7c2433a, 0x6d5c, 0x4345, {0x83,
45  0xee, 0xc0, 0x0f, 0xa7, 0xe3, 0x08, 0xeb}});
46 
47 #endif // __IWVLISTENER_H
IWvListener::addwrap
virtual void addwrap(IWvListenerWrapper _wrapper)=0
Add a wrapper function for this stream: something that accept() will call to possibly wrap the stream...
IWvStream
Definition: iwvstream.h:24
IWvListener
Definition: iwvlistener.h:16
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
IWvListener::accept
virtual IWvStream * accept()=0
Accept a connection from this stream.
IObject
Definition: IObject.h:65
IWvListener::onaccept
virtual IWvListenerCallback onaccept(IWvListenerCallback _cb)=0
Set a user-defined function to be called when a new connection is available.
DEFINE_IID
#define DEFINE_IID(iface, u1, u2, u3, u4, u5, u6, u7, u8, u9, u10, u11)
Used to define the IID of an interface.
Definition: uuid.h:134