--- Begin Message ---
------------------------------------------------------------
revno: 5624
committer: Anders Logg <logg@xxxxxxxxx>
branch nick: dolfin
timestamp: Wed 2011-02-02 00:29:40 +0100
message:
Fix bug in assignment operator for Hierarchical. Should fix C++ demo/test
errors on buildbot.
modified:
dolfin/common/Hierarchical.h
--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main
Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription
=== modified file 'dolfin/common/Hierarchical.h'
--- dolfin/common/Hierarchical.h 2011-01-31 17:42:02 +0000
+++ dolfin/common/Hierarchical.h 2011-02-01 23:29:40 +0000
@@ -2,14 +2,14 @@
// Licensed under the GNU LGPL Version 2.1.
//
// First added: 2011-01-30
-// Last changed: 2011-01-31
+// Last changed: 2011-02-02
#ifndef __HIERARCHICAL_H
#define __HIERARCHICAL_H
#include <boost/shared_ptr.hpp>
-#include <dolfin/log/log.h>
+#include <dolfin/log/dolfin_log.h>
#include "NoDeleter.h"
namespace dolfin
@@ -24,13 +24,18 @@
{
public:
+ Hierarchical()
+ {
+ _debug();
+ }
+
/// Check if the object has a parent.
///
/// *Returns*
/// bool
/// The return value is true iff the object has a parent.
bool has_parent() const
- { return _parent != 0; }
+ { return _parent; }
/// Check if the object has a child.
///
@@ -38,7 +43,7 @@
/// bool
/// The return value is true iff the object has a child.
bool has_child() const
- { return _child != 0; }
+ { return _child; }
/// Return parent in hierarchy. An error is thrown if the object
/// has no parent.
@@ -161,13 +166,22 @@
/// Assignment operator
const Hierarchical& operator= (const Hierarchical& hierarchical)
{
- // Clear parent/child data
- info("Calling assignment operator for class Hierarchical, clearing parent/child data.");
- _parent = boost::shared_ptr<T>();
- _child = boost::shared_ptr<T>();
+ // Do nothing, in particular don't assign child/parent
return *this;
}
+ /// Function useful for debugging the hierarchy
+ void _debug() const
+ {
+ info("Debugging hierarchical object.");
+ cout << " has_parent() = " << has_parent() << endl;
+ info(" _parent.get() = %x", _parent.get());
+ info(" _parent.count() = %d", _parent.use_count());
+ cout << " has_child() = " << has_parent() << endl;
+ info(" _child.get() = %x", _parent.get());
+ info(" _child.count() = %d", _parent.use_count());
+ }
+
private:
// Parent and child in hierarchy
--- End Message ---