tweak Stateful/StatefulDiffCommand changes so that SessionObject's actually get a...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Feb 2010 23:10:29 +0000 (23:10 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 11 Feb 2010 23:10:29 +0000 (23:10 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@6678 d708f5d6-7413-0410-9779-e7cbd77b26cf

19 files changed:
gtk2_ardour/editor_drag.cc
gtk2_ardour/editor_ops.cc
libs/ardour/ardour/pi_controller.h
libs/ardour/ardour/session_object.h
libs/ardour/audio_diskstream.cc
libs/ardour/crossfade.cc
libs/ardour/io.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_region.cc
libs/ardour/midi_source.cc
libs/ardour/mtc_slave.cc
libs/ardour/pi_controller.cc
libs/ardour/region.cc
libs/ardour/route.cc
libs/ardour/session_command.cc
libs/ardour/sndfilesource.cc
libs/pbd/pbd/stateful.h
libs/pbd/pbd/stateful_diff_command.h
libs/pbd/stateful_diff_command.cc

index ca5d16e63a43650cc1aeac52997a6ceaf34bf698..4dc7ea65fce8816a62b9a9f84ca60228093c7d16 100644 (file)
@@ -980,7 +980,7 @@ RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 
                        rv->region()->set_position (where, (void*) this);
 
-                       _editor->session()->add_command (new StatefulDiffCommand (rv->region().get()));
+                       _editor->session()->add_command (new StatefulDiffCommand (rv->region()));
                }
 
                if (changed_tracks && !_copy) {
index 6ed670509e31fcdf8c4ee9cb9bb3d101a85d6966..16773f269d03a8a4c5db70a389ca839c89eead99 100644 (file)
@@ -3180,7 +3180,7 @@ Editor::naturalize ()
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                (*i)->region()->clear_history ();
                (*i)->region()->move_to_natural_position (this);
-               _session->add_command (new StatefulDiffCommand ((*i)->region().get()));
+               _session->add_command (new StatefulDiffCommand ((*i)->region()));
        }
        commit_reversible_command ();
 }
@@ -4932,7 +4932,7 @@ Editor::toggle_gain_envelope_active ()
                if (arv) {
                        arv->region()->clear_history ();
                        arv->audio_region()->set_envelope_active (!arv->audio_region()->envelope_active());
-                       _session->add_command (new StatefulDiffCommand (arv->region().get()));
+                       _session->add_command (new StatefulDiffCommand (arv->region()));
                }
        }
 
@@ -4953,7 +4953,7 @@ Editor::toggle_region_lock ()
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                (*i)->region()->clear_history ();
                (*i)->region()->set_locked (!(*i)->region()->locked());
-               _session->add_command (new StatefulDiffCommand ((*i)->region().get()));
+               _session->add_command (new StatefulDiffCommand ((*i)->region()));
        }
 
        _session->commit_reversible_command ();
@@ -4995,7 +4995,7 @@ Editor::toggle_region_mute ()
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                (*i)->region()->clear_history ();
                (*i)->region()->set_muted (!(*i)->region()->muted());
-               _session->add_command (new StatefulDiffCommand ((*i)->region().get()));
+               _session->add_command (new StatefulDiffCommand ((*i)->region()));
        }
 
        _session->commit_reversible_command ();
@@ -5015,7 +5015,7 @@ Editor::toggle_region_opaque ()
        for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
                (*i)->region()->clear_history ();
                (*i)->region()->set_opaque (!(*i)->region()->opaque());
-               _session->add_command (new StatefulDiffCommand ((*i)->region().get()));
+               _session->add_command (new StatefulDiffCommand ((*i)->region()));
        }
 
        _session->commit_reversible_command ();
index c5b7c154ac5033ce34ec3518dd6cfbb6b0cdfc50..250c943de9a413c1126665832f458311917cab2a 100644 (file)
@@ -33,7 +33,7 @@ class PIController {
            out_of_bounds ();
     }
         
-    double get_ratio (int fill_level);
+    double get_ratio (int fill_level, int period_size);
     void out_of_bounds();
 
   public:
@@ -60,7 +60,7 @@ class PIChaser {
     PIChaser();
     ~PIChaser();
 
-    double get_ratio( nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control );
+    double get_ratio( nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size );
     void reset();
     nframes64_t want_locate() { return want_locate_val; }
 
index cf9ccbb3a7172476b6347c540765f95032da3e85..069badcb6afa0fbde699449488b990bf2bb23367 100644 (file)
@@ -41,7 +41,7 @@ class SessionObject : public SessionHandleRef, public PBD::StatefulDestructible
   public:
        SessionObject (Session& session, const std::string& name)
                : SessionHandleRef (session)
-               , _name (X_("name"), PBD::Change (0), "")
+               , _name (X_("name"), PBD::Change (0), name)
        {
                add_state (_name);
        }
index ef209fad3a897228425e90b088c04cd52227c28d..9a93e4500003f04b9993ac49ece6bd0746a173c1 100644 (file)
@@ -1433,7 +1433,7 @@ AudioDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_ca
                if (s) {
                        srcs.push_back (s);
                        s->update_header (capture_info.front()->start, when, twhen);
-                       s->set_captured_for (_name.get());
+                       s->set_captured_for (_name.val());
                        s->mark_immutable ();
                        if (Config->get_auto_analyse_audio()) {
                                Analyser::queue_source_for_analysis (s, true);
@@ -1970,7 +1970,7 @@ AudioDiskstream::rename_write_sources ()
 
        for (chan = c->begin(), n = 0; chan != c->end(); ++chan, ++n) {
                if ((*chan)->write_source != 0) {
-                       (*chan)->write_source->set_source_name (_name.get(), destructive());
+                       (*chan)->write_source->set_source_name (_name.val(), destructive());
                        /* XXX what to do if one of them fails ? */
                }
        }
@@ -2178,7 +2178,7 @@ AudioDiskstream::use_pending_capture_data (XMLNode& node)
                                first_fs = fs;
                        }
 
-                       fs->set_captured_for (_name.get());
+                       fs->set_captured_for (_name.val());
                }
        }
 
index a79dae5f07584058b2942e1303335a7b672cbe74..0ca173570a2e5cfe4baeca0815c3e2ae8ec9cbe3 100644 (file)
@@ -314,7 +314,7 @@ Crossfade::read_at (Sample *buf, Sample *mixdown_buffer,
 
                start = _position;
                buf += offset;
-               to_write = min (_length.get(), cnt);
+               to_write = min (_length.val(), cnt);
 
        } else {
 
@@ -679,7 +679,7 @@ Crossfade::get_state ()
        node->add_property ("active", (_active ? "yes" : "no"));
        node->add_property ("follow-overlap", (_follow_overlap ? "yes" : "no"));
        node->add_property ("fixed", (_fixed ? "yes" : "no"));
-       snprintf (buf, sizeof(buf), "%" PRIu32, _length.get());
+       snprintf (buf, sizeof(buf), "%" PRIu32, _length.val());
        node->add_property ("length", buf);
        snprintf (buf, sizeof(buf), "%" PRIu32, (uint32_t) _anchor_point);
        node->add_property ("anchor-point", buf);
index 34f624f2d25cde13048cc2de9d2f74d4e40357b1..48bab25546dcf0d01785c27d4e26dbfe7bd829ad 100644 (file)
@@ -1098,7 +1098,7 @@ IO::set_name (const string& requested_name)
 
        for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
                string current_name = i->name();
-               current_name.replace (current_name.find (_name), _name.get().length(), name);
+               current_name.replace (current_name.find (_name), _name.val().length(), name);
                i->set_name (current_name);
        }
 
@@ -1267,7 +1267,7 @@ IO::build_legal_port_name (DataType type)
        char buf1[name_size+1];
        char buf2[name_size+1];
 
-       snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.get().c_str(), suffix.c_str());
+       snprintf (buf1, name_size+1, ("%.*s/%s"), limit, _name.val().c_str(), suffix.c_str());
 
        int port_number = find_port_hole (buf1);
        snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
@@ -1342,9 +1342,9 @@ IO::setup_bundle ()
        _bundle->remove_channels ();
 
        if (_direction == Input) {
-               snprintf(buf, sizeof (buf), _("%s in"), _name.get().c_str());
+               snprintf(buf, sizeof (buf), _("%s in"), _name.val().c_str());
        } else {
-               snprintf(buf, sizeof (buf), _("%s out"), _name.get().c_str());
+               snprintf(buf, sizeof (buf), _("%s out"), _name.val().c_str());
        }
         _bundle->set_name (buf);
        uint32_t const ni = _ports.num_ports();
index 790891a72d1e5cef2afba778e0be13d9e5241352..11fec341b2e9dd1b5af5ecf434750f01a9fcf926 100644 (file)
@@ -1388,7 +1388,7 @@ int
 MidiDiskstream::rename_write_sources ()
 {
        if (_write_source != 0) {
-               _write_source->set_source_name (_name.get(), destructive());
+               _write_source->set_source_name (_name.val(), destructive());
                /* XXX what to do if this fails ? */
        }
        return 0;
index fb7a7e082fbd025a69107ed52bfbae23beb182a0..bccc32c9cbb904a6dc91844b59272920efee3fe7 100644 (file)
@@ -51,7 +51,7 @@ using namespace PBD;
 MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length)
        : Region (src, start, length, PBD::basename_nosuffix(src->name()), DataType::MIDI, 0,  Region::Flag(Region::DefaultFlags|Region::External))
 {
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
@@ -59,7 +59,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
 MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
        : Region (src, start, length, name, DataType::MIDI, layer, flags)
 {
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
@@ -67,7 +67,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, nframes_t start, nfra
 MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t length, const string& name, layer_t layer, Flag flags)
        : Region (srcs, start, length, name, DataType::MIDI, layer, flags)
 {
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
@@ -76,14 +76,14 @@ MidiRegion::MidiRegion (const SourceList& srcs, nframes_t start, nframes_t lengt
 MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other, nframes_t offset, nframes_t length, const string& name, layer_t layer, Flag flags)
        : Region (other, offset, length, name, layer, flags)
 {
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
 MidiRegion::MidiRegion (boost::shared_ptr<const MidiRegion> other)
        : Region (other)
 {
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
 }
 
@@ -95,7 +95,7 @@ MidiRegion::MidiRegion (boost::shared_ptr<MidiSource> src, const XMLNode& node)
        }
 
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        assert(_type == DataType::MIDI);
 }
 
@@ -107,7 +107,7 @@ MidiRegion::MidiRegion (const SourceList& srcs, const XMLNode& node)
        }
 
        midi_source(0)->Switched.connect_same_thread (*this, boost::bind (&MidiRegion::switch_source, this, _1));
-       assert(_name.get().find("/") == string::npos);
+       assert(_name.val().find("/") == string::npos);
        assert(_type == DataType::MIDI);
 }
 
index ce58d4f585a5319ab5402ce27a17f70f23ba8ef2..2b0efd78e165d7a02f40433722a72e241e3c813c 100644 (file)
@@ -230,7 +230,7 @@ MidiSource::session_saved()
 
        if (_model && _model->edited()) {
                string newname;
-               const string basename = PBD::basename_nosuffix(_name.get());
+               const string basename = PBD::basename_nosuffix(_name.val());
                string::size_type last_dash = basename.find_last_of("-");
                if (last_dash == string::npos || last_dash == basename.find_first_of("-")) {
                        newname = basename + "-1";
index 64f67ba7468d3e58f944ccf86ec370fc50f4c35d..7c990bd6547356b064693b0c80b4dd2dbcca77c1 100644 (file)
@@ -429,7 +429,7 @@ MTC_Slave::speed_and_position (double& speed, nframes64_t& pos)
                static double average_speed = 0;
                
                nframes64_t ref_now = session.engine().frame_time_at_cycle_start();
-               average_speed = pic->get_ratio (last.timestamp, last.position, ref_now, slave_pos, in_control );
+               average_speed = pic->get_ratio (last.timestamp, last.position, ref_now, slave_pos, in_control, session.engine().frames_per_cycle());
   
                pic_want_locate = pic->want_locate();
                
index baee5a972a31414f54ffb2ca78a0bd34ebcf993c..bdf9c27cee3a539d02fdf7a1cf6f33ce24d7f9d5 100644 (file)
@@ -56,10 +56,10 @@ PIController::~PIController ()
 }
 
 double
-PIController::get_ratio (int fill_level)
+PIController::get_ratio (int fill_level, int period_size)
 {
        double offset = fill_level;
-       double this_catch_factor = catch_factor;
+       double this_catch_factor = catch_factor * 4096.0/(double)period_size;
 
        
        // Save offset.
@@ -151,7 +151,7 @@ PIChaser::~PIChaser() {
 }
 
 double
-PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control ) {
+PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nframes64_t slavetime_measured, nframes64_t slavetime, bool in_control, int period_size ) {
 
        feed_estimator( chasetime_measured, chasetime );
        std::cerr << (double)chasetime_measured/48000.0 << " " << chasetime << " " << slavetime << " ";
@@ -159,7 +159,7 @@ PIChaser::get_ratio(nframes64_t chasetime_measured, nframes64_t chasetime, nfram
        double fine;  
        nframes64_t massaged_chasetime = chasetime + (nframes64_t)( (double)(slavetime_measured - chasetime_measured) * crude );
 
-       fine = pic->get_ratio( slavetime - massaged_chasetime );
+       fine = pic->get_ratio( slavetime - massaged_chasetime, period_size );
        if (in_control) {
            if (fabs(fine-crude) > crude*speed_threshold) {
                std::cout << "reset to " << crude << " fine = " << fine << "\n";
index 03d90bcf095b76723f3402ce8df4b0664b7c37e2..06437811e70cc56e5198162dd51bd4b6324d2ddf 100644 (file)
@@ -1197,12 +1197,12 @@ Region::set_live_state (const XMLNode& node, int /*version*/, Change& what_chang
        /* fix problems with old sessions corrupted by impossible
           values for _stretch or _shift
        */
-       if (_stretch == 0.0) {
-               _stretch = 1.0;
+       if (_stretch == 0.0f) {
+               _stretch = 1.0f;
        }
        
-       if (_shift == 0.0) {
-               _shift = 1.0;
+       if (_shift == 0.0f) {
+               _shift = 1.0f;
        }
 
        /* note: derived classes set flags */
index 02005fc269e4ab67aa572108af0e10cfc3302ba1..0cf62f4cae4b25d7b47ca17cd659c6f8b0e7db4d 100644 (file)
@@ -78,6 +78,7 @@ Route::Route (Session& sess, string name, Flag flg, DataType default_type)
        , _default_type (default_type)
 
 {
+       cerr << "New route with n=" << name << " has name = " << _name.val() << endl;
        init ();
 
        /* add standard processors other than amp (added by ::init()) */
index 82ecc60b836b76b238c09d62d4145f143bc1d9ab..6c2621fdb98b742bc847b01aa0a4338618489ed3 100644 (file)
@@ -144,7 +144,7 @@ Session::stateful_diff_command_factory (XMLNode* n)
        if ((obj_T == typeid (AudioRegion).name() || obj_T == typeid (MidiRegion).name())) {
                boost::shared_ptr<Region> r = RegionFactory::region_by_id (id);
                if (r) {
-                       return new StatefulDiffCommand (r.get(), *n);
+                       return new StatefulDiffCommand (r, *n);
                }
        }
 
index 8f454d31ce973313929cd8f2d5f7f9c761e2684b..de8ce330e1a72d396c9a7ce26565640117dce9c1 100644 (file)
@@ -306,7 +306,7 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const
                if (sf_seek (sf, (sf_count_t) start, SEEK_SET|SFM_READ) != (sf_count_t) start) {
                        char errbuf[256];
                        sf_error_str (0, errbuf, sizeof (errbuf) - 1);
-                       error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.get().substr (1), errbuf) << endmsg;
+                       error << string_compose(_("SndFileSource: could not seek to frame %1 within %2 (%3)"), start, _name.val().substr (1), errbuf) << endmsg;
                        return 0;
                }
 
@@ -316,7 +316,7 @@ SndFileSource::read_unlocked (Sample *dst, sframes_t start, nframes_t cnt) const
                        if (ret != file_cnt) {
                                char errbuf[256];
                                sf_error_str (0, errbuf, sizeof (errbuf) - 1);
-                               cerr << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5)"), start, file_cnt, _name.get().substr (1), errbuf, _length) << endl;
+                               cerr << string_compose(_("SndFileSource: @ %1 could not read %2 within %3 (%4) (len = %5)"), start, file_cnt, _name.val().substr (1), errbuf, _length) << endl;
                        }
                        return ret;
                }
index 5d3c98439c6c6095e6a2bd72a4a895a099eb0980..02224bb5e1ac327c39f2ee0462962778c8ae5ae5 100644 (file)
@@ -99,20 +99,20 @@ public:
                set (_current + v);
                return _current;
        }
-
-       bool operator== (std::string const & o) const {
-               return o == to_string (_current);
+       
+       bool operator== (const T& other) const {
+               return _current == other;
        }
 
-       bool operator!= (std::string const & o) const {
-               return o != to_string (_current);
+       bool operator!= (const T& other) const {
+               return _current != other;
        }
 
        operator T const & () const {
                return _current;
        }
 
-       T const & get () const {
+       T const & val () const {
                return _current;
        }
 
@@ -165,7 +165,7 @@ protected:
 template<class T>      
 std::ostream& operator<< (std::ostream& os, StateTemplate<T> const & s)
 {
-       os << s.get();
+       os << s.val();
        return os;
 }
 
@@ -190,6 +190,7 @@ public:
 private:       
        std::string to_string (T const & v) const {
                std::stringstream s;
+               s.precision (12); // in case its floating point
                s << v;
                return s.str ();
        }
@@ -197,6 +198,7 @@ private:
        T from_string (std::string const & s) const {
                std::stringstream t (s);
                T v;
+               t.precision (12); // in case its floating point
                t >> v;
                return v;
        }
index 41c0c70f69d332550386759a1db83779a2dd3947..43efed445d988208d450052ea3d824ba7ad2dbc0 100644 (file)
 
 */
 
+#ifndef __pbd_stateful_diff_command_h__
+#define __pbd_stateful_diff_command_h__
+
+#include <boost/shared_ptr.hpp>
+#include <boost/weak_ptr.hpp>
 #include "pbd/command.h"
 
 namespace PBD
@@ -30,8 +35,8 @@ class Stateful;
 class StatefulDiffCommand : public Command
 {
 public:
-       StatefulDiffCommand (Stateful *);
-       StatefulDiffCommand (Stateful *, XMLNode const &);
+       StatefulDiffCommand (boost::shared_ptr<Stateful>);
+       StatefulDiffCommand (boost::shared_ptr<Stateful>, XMLNode const &);
        ~StatefulDiffCommand ();
 
        void operator() ();
@@ -40,9 +45,11 @@ public:
        XMLNode& get_state ();
 
 private:
-       Stateful* _object; ///< the object in question
+       boost::weak_ptr<Stateful> _object; ///< the object in question
        XMLNode* _before; ///< XML node containing the previous values of XML properties which changed
        XMLNode* _after; ///< XML node containing the new values of XML properties which changed
 };
 
 };
+
+#endif /* __pbd_stateful_diff_command_h__ */
index 1332cae4ff9720736f5611eed5bdcad209a60aba..bf092a659425e33c28ad5f928ca290145bd1c950 100644 (file)
@@ -28,7 +28,7 @@ using namespace PBD;
  *  @param s Stateful object.
  */
 
-StatefulDiffCommand::StatefulDiffCommand (Stateful* s)
+StatefulDiffCommand::StatefulDiffCommand (boost::shared_ptr<Stateful> s)
        : _object (s)
 {
        pair<XMLNode *, XMLNode*> const p = s->diff ();
@@ -36,7 +36,7 @@ StatefulDiffCommand::StatefulDiffCommand (Stateful* s)
        _after = p.second;
 }
 
-StatefulDiffCommand::StatefulDiffCommand (Stateful* s, XMLNode const & n)
+StatefulDiffCommand::StatefulDiffCommand (boost::shared_ptr<Stateful> s, XMLNode const & n)
        : _object (s)
 {
        _before = new XMLNode (*n.children().front());
@@ -53,22 +53,37 @@ StatefulDiffCommand::~StatefulDiffCommand ()
 void
 StatefulDiffCommand::operator() ()
 {
-       _object->set_state (*_after, Stateful::current_state_version);
+       boost::shared_ptr<Stateful> s (_object.lock());
+
+       if (s) {
+               s->set_state (*_after, Stateful::current_state_version);
+       }
 }
 
 void
 StatefulDiffCommand::undo ()
 {
-       _object->set_state (*_before, Stateful::current_state_version);
+       boost::shared_ptr<Stateful> s (_object.lock());
+
+       if (s) {
+               s->set_state (*_before, Stateful::current_state_version);
+       }
 }
 
 XMLNode&
 StatefulDiffCommand::get_state ()
 {
+       boost::shared_ptr<Stateful> s (_object.lock());
+
+       if (!s) {
+               /* XXX should we throw? */
+               return * new XMLNode("");
+       }
+
        XMLNode* node = new XMLNode (X_("StatefulDiffCommand"));
 
-       node->add_property ("obj-id", _object->id().to_s());
-       node->add_property ("type-name", typeid(*_object).name());
+       node->add_property ("obj-id", s->id().to_s());
+       node->add_property ("type-name", typeid(*s.get()).name());
        node->add_child_copy (*_before);
        node->add_child_copy (*_after);