Article View: comp.std.c++
Article #3927Additions to the STL : Callback/Observer pair
From: Robert B McInnis
Date: Fri, 05 Apr 1996 03:42
Date: Fri, 05 Apr 1996 03:42
51 lines
3126 bytes
3126 bytes
I would like to propose a Callback/Observer construct for the Standard Template Library. This could be a base class pair with the Observer being primarily templates. This would allow for a consistent Callback/Observer pattern to be used across applications. This would also familiarize people with the pattern and promote different design decisions when designing an app. The Callback class should be a simple list of Observers that the owner, or possibly anyone, depending on access, would be able to invoke or disable. An Observer should be dynamic enough so that if the receiver instance, that is attached directly to the Observer instance, were to be deleted, then the Observer object would know to just disable its node on its associated Callback list. This would lead to the concept of Observible destruction of objects. What about observible construction on a class. This would allow my class to know when an instance of itself has been created, then fire off an initialize VIRTUAL, since this really can't be done in the constructor without EVERY descendent having to know about the initialize method. This would eventually allow for observible files on a file system. Imagine that! Biff would be a trivial app (even on DOS) without a polling mechanism. Or maybe just for version control, to know when certain files have updated on a LARGE network based development effort. Just a thought. If anyone is actually listening, it'd be nice to know what's thought of this. Need an example of a callback/observer pair? Just eMail me. Thanks for the time, Rob --------------------------- Robert McInnis 9th Bit Software (eMail) rmcinnis@gate.net (web ) http://www.gate.net/~rmcinnis --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ] --- [ comp.std.c++ is moderated. To submit articles: try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ] [ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ] [ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Technical Details
Message-ID:
<4k0mcd$1iog@news.gate.net>Path:
arc1-ca.pugleaf.net!in2.uu.net!bounce-backShow Full Headers
Complete Article Headers
From: rmcinnis@gate.net (Robert B McInnis) Message-ID: <4k0mcd$1iog@news.gate.net> X-Original-Date: 4 Apr 1996 14:29:33 GMT Path: arc1-ca.pugleaf.net!in2.uu.net!bounce-back Date: 05 Apr 96 03:42:28 GMT Approved: fjh@cs.mu.oz.au Return-Path: <daemon@meeker.UCAR.EDU> Newsgroups: comp.std.c++ Subject: Additions to the STL : Callback/Observer pair Organization: 9th Bit Software X-Newsreader: News Xpress Version 1.0 Beta #4 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUBMWSWtOEDnX0m9pzZAQHCHwF/Q3F3vXFgd9BxEHGs9GZEsX4voTOoC0TL mhL80apD8XFIgwESHbNMYgewmmZZCIh5 =p6aE