OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace commits / 0daf78a

Create an AtomSpace-specific install method
0daf78ac304887bb32f49a49f83e9f614528abac
by Linas Vepštas <linasvepstas@gmail.com> · 2026-01-21T01:23:37.000Z

Changed files (3) +16 -13

opencog/atomspace/AtomSpace.cc +10 -1
……@@ -137,13 +137,22 @@ AtomSpace::AtomSpace(const HandleSeq& bases) :
137137 init();
138138}
139139
140
141140AtomSpace::~AtomSpace()
142141{
143142 _nameserver.typeAddedSignal().disconnect(addedTypeConnection);
144143 clear_all_atoms();
145144}
146145
146void AtomSpace::do_install(void)
147{
148 // XXX FIXME. I think this is installing into the wrong AtomSpace.
149 // Maybe. I'm confused. But no unit test seems to fail as a result
150 // of this, so I dunno. Go figure.
151 setAtomSpace(this);
152 Frame::install();
153 setAtomSpace(nullptr);
154}
155
147156// ====================================================================
148157
149158// An extremely primitive permissions system.
opencog/atomspace/AtomSpace.h +4 -7
……@@ -50,6 +50,8 @@ typedef std::shared_ptr<AtomSpace> AtomSpacePtr;
5050class AtomSpace : public Frame
5151{
5252 friend class StorageNode; // Needs to call add() directly.
53 template< class... Args >
54 friend AtomSpacePtr createAtomSpace(Args&&...); // Needs to call install()
5355
5456 // Debug tools
5557 static const bool EMIT_DIAGNOSTICS = true;
……@@ -75,6 +77,7 @@ class AtomSpace : public Frame
7577 // we keep two distinct lists to avoid the CPU overhead of casting
7678 // between the two different pointer types (its significant).
7779 std::vector<AtomSpacePtr> _environ;
80 void do_install();
7881
7982 void init();
8083 void clear_all_atoms();
……@@ -536,13 +539,7 @@ AtomSpacePtr createAtomSpace( Args&&... args )
536539 // Unfortunately, Frame::install() cannot be called in the ctor
537540 // because shared_from_this() cannot be called in the ctor.
538541 // So we do this after the ctor has finished.
539
540 // XXX FIXME. I think this is installing into the wrong AtomSpace.
541 // But no unit test seems to fail as a result of this, so I dunno.
542 // But this can't be right, as written.
543 asp->setAtomSpace(asp.get());
544 asp->install();
545 asp->setAtomSpace(nullptr);
542 asp->do_install();
546543 return asp;
547544}
548545
opencog/atomspace/Frame.h +2 -5
……@@ -44,11 +44,8 @@ protected:
4444 HandleSeq _outgoing;
4545 std::string _name;
4646 void scrub_incoming_set();
47 virtual void remove();
48
49public:
50 // Must be public, so that createAtomSpace() can call this.
51 virtual void install();
47 virtual void remove() override;
48 virtual void install() override;
5249
5350public:
5451 /**