|
Boost-Commit : |
From: doomster_at_[hidden]
Date: 2008-04-30 12:13:54
Author: eckhardt
Date: 2008-04-30 12:13:53 EDT (Wed, 30 Apr 2008)
New Revision: 44935
URL: http://svn.boost.org/trac/boost/changeset/44935
Log:
- Add include file to compile the signals library in-place.
- Add example for the in-place compiled signals library.
Added:
sandbox/compile-in-place/Boost_1_35_0/boost/signals/compile_in_place.cpp (contents, props changed)
sandbox/compile-in-place/test-signals.cpp (contents, props changed)
Added: sandbox/compile-in-place/Boost_1_35_0/boost/signals/compile_in_place.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/Boost_1_35_0/boost/signals/compile_in_place.cpp 2008-04-30 12:13:53 EDT (Wed, 30 Apr 2008)
@@ -0,0 +1,23 @@
+/* compile in-place support for Boost.System
+
+Copyright 2008 Ulrich Eckhardt
+
+Distributed under the Boost Software License, Version 1.0. (See accompanying
+file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+*/
+// $Id$
+
+// This file must not be included more than once. Note that this 'once' is
+// not per translation unit but per binary! Never include this in a header!
+#ifdef BOOST_SIGNALS_COMPILE_IN_PLACE_CPP_INCLUDED
+# error "this file should only be included once per binary"
+#endif
+
+#define BOOST_SIGNALS_COMPILE_IN_PLACE_CPP_INCLUDED
+
+
+#include <boost/../libs/signals/src/connection.cpp>
+#include <boost/../libs/signals/src/named_slot_map.cpp>
+#include <boost/../libs/signals/src/signal_base.cpp>
+#include <boost/../libs/signals/src/slot.cpp>
+#include <boost/../libs/signals/src/trackable.cpp>
Added: sandbox/compile-in-place/test-signals.cpp
==============================================================================
--- (empty file)
+++ sandbox/compile-in-place/test-signals.cpp 2008-04-30 12:13:53 EDT (Wed, 30 Apr 2008)
@@ -0,0 +1,37 @@
+/* example to demonstrate compile-in-place for the signals lib
+
+Compile with
+ $CXX -I path/to/boost_X_YY_Z test-signals.cpp
+
+Notes:
+
+$Id$
+*/
+
+#include <iostream>
+#include <ostream>
+#include <boost/signal.hpp>
+#include <boost/signals/compile_in_place.cpp>
+
+struct HelloWorld
+{
+ void operator()() const
+ {
+ std::cout << "Hello, World!" << std::endl;
+ }
+};
+
+
+int main()
+{
+ // Signal with no arguments and a void return value
+ boost::signal<void ()> sig;
+
+ // Connect a HelloWorld slot
+ HelloWorld hello;
+ sig.connect(hello);
+
+ // Call all of the slots
+ sig();
+}
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk