OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-generate commits / 105d0c8

Avoid naming collision with the base AtomSpace
105d0c8a5e8855f27313041b9b0fbb915fc52175
by Linas Vepstas <linasvepstas@gmail.com> · 2023-01-02T19:17:17.000Z

Changed files (12) +49 -49

opencog/generate/Aggregate.cc +2 -2
……@@ -327,8 +327,8 @@ HandlePair Aggregate::connect_section(const Handle& fm_sect,
327327 // logger().fine("Connect %s\nto %s",
328328 // fm_sect->to_string().c_str(), to_sect->to_string().c_str());
329329 logger().fine("Connect fm-offset=%lu:", offset);
330 Frame::print_section(fm_sect);
331 Frame::print_section(to_sect);
330 OdoFrame::print_section(fm_sect);
331 OdoFrame::print_section(to_sect);
332332
333333 const Handle& fm_point = fm_sect->getOutgoingAtom(0);
334334 const Handle& to_point = to_sect->getOutgoingAtom(0);
opencog/generate/Aggregate.h +3 -3
……@@ -25,7 +25,7 @@
2525#include <set>
2626
2727#include <opencog/atomspace/AtomSpace.h>
28#include <opencog/generate/Frame.h>
28#include <opencog/generate/Odometer.h>
2929#include <opencog/generate/GenerateCallback.h>
3030
3131namespace opencog
……@@ -44,10 +44,10 @@ private:
4444 GenerateCallback* _cb;
4545
4646 /// Current traversal state
47 Frame _frame;
47 OdoFrame _frame;
4848 Odometer _odo;
4949
50 std::stack<Frame> _frame_stack;
50 std::stack<OdoFrame> _frame_stack;
5151 std::stack<HandleSeq> _odo_sections;
5252 void push_frame();
5353 void pop_frame();
opencog/generate/BasicParameters.cc +2 -2
……@@ -41,12 +41,12 @@ static inline double uniform_double(void)
4141 return dist(rangen);
4242}
4343
44bool BasicParameters::connect_existing(const Frame& frm)
44bool BasicParameters::connect_existing(const OdoFrame& frm)
4545{
4646 return uniform_double() < close_fraction;
4747}
4848
49bool BasicParameters::step(const Frame& frm)
49bool BasicParameters::step(const OdoFrame& frm)
5050{
5151 return true;
5252}
opencog/generate/BasicParameters.h +2 -2
……@@ -42,8 +42,8 @@ public:
4242 BasicParameters();
4343 virtual ~BasicParameters();
4444
45 virtual bool connect_existing(const Frame&);
46 virtual bool step(const Frame&);
45 virtual bool connect_existing(const OdoFrame&);
46 virtual bool step(const OdoFrame&);
4747
4848 /// Fraction of the time that an attempt should be made to join
4949 /// together two existing open connectors, if that is possible.
opencog/generate/CollectStyle.cc +1 -1
……@@ -34,7 +34,7 @@ CollectStyle::~CollectStyle() {}
3434/// In this "style" of recording a result, we just tack it onto
3535/// a C++ container holding the solutions. Other "styles" are
3636/// possible; we could report them elsewehre, too...
37void CollectStyle::record_solution(const Frame& frm)
37void CollectStyle::record_solution(const OdoFrame& frm)
3838{
3939 size_t nsolns = _solutions.size();
4040 _solutions.insert(frm._linkage);
opencog/generate/CollectStyle.h +2 -2
……@@ -22,7 +22,7 @@
2222#ifndef _OPENCOG_COLLECT_STYLE_H
2323#define _OPENCOG_COLLECT_STYLE_H
2424
25#include <opencog/generate/Frame.h>
25#include <opencog/generate/Odometer.h>
2626
2727namespace opencog
2828{
……@@ -44,7 +44,7 @@ public:
4444 ~CollectStyle();
4545
4646 void clear(void) { _solutions.clear(); }
47 void record_solution(const Frame&);
47 void record_solution(const OdoFrame&);
4848
4949 size_t num_solutions(void) { return _solutions.size(); }
5050 std::set<HandleSet> get_solution_set(void) { return _solutions; }
opencog/generate/GenerateCallback.h +6 -6
……@@ -23,7 +23,7 @@
2323#define _OPENCOG_GENERATE_CALLBACK_H
2424
2525#include <opencog/atomspace/AtomSpace.h>
26#include <opencog/generate/Frame.h>
26#include <opencog/generate/Odometer.h>
2727
2828namespace opencog
2929{
……@@ -91,7 +91,7 @@ public:
9191 /// This should be implemented so that it behaves like a 'future'
9292 /// or a 'promise', so that, when called, it returns the next
9393 /// section from a (virtual) list of eligible sections.
94 virtual Handle select(const Frame&,
94 virtual Handle select(const OdoFrame&,
9595 const Handle& fm_sect, size_t offset,
9696 const Handle& to_con) = 0;
9797
……@@ -108,8 +108,8 @@ public:
108108 virtual size_t num_links(const Handle& fm_sect, const Handle& to_sect,
109109 const Handle& link_type) = 0;
110110
111 virtual void push_frame(const Frame&) {}
112 virtual void pop_frame(const Frame&) {}
111 virtual void push_frame(const OdoFrame&) {}
112 virtual void pop_frame(const OdoFrame&) {}
113113
114114 virtual void push_odometer(const Odometer&) {}
115115 virtual void pop_odometer(const Odometer&) {}
……@@ -120,11 +120,11 @@ public:
120120 /// Traversal will resume at an earlier level.
121121 ///
122122 /// The default below allows infinite recursion.
123 virtual bool step(const Frame&) { return true; }
123 virtual bool step(const OdoFrame&) { return true; }
124124
125125 /// Called when a solution is found. A solution is a linkage,
126126 /// with no open connectors.
127 virtual void solution(const Frame&) = 0;
127 virtual void solution(const OdoFrame&) = 0;
128128
129129 /// Return a SetLink with all of the solutions that were
130130 /// reported via the above callback. Perform any other AtomSpace
opencog/generate/RandomCallback.cc +7 -7
……@@ -119,7 +119,7 @@ HandleSet RandomCallback::next_root(void)
119119
120120/// Return a section containing `to_con`.
121121/// Pick a new section from the lexis.
122Handle RandomCallback::select_from_lexis(const Frame& frame,
122Handle RandomCallback::select_from_lexis(const OdoFrame& frame,
123123 const Handle& fm_sect, size_t offset,
124124 const Handle& to_con)
125125{
……@@ -169,7 +169,7 @@ Handle RandomCallback::select_from_lexis(const Frame& frame,
169169//
170170// This just sets up a list of candidates; the actual picking is done
171171// by `do_select_one()`.
172Handle RandomCallback::select_from_open(const Frame& frame,
172Handle RandomCallback::select_from_open(const OdoFrame& frame,
173173 const Handle& fm_sect, size_t offset,
174174 const Handle& to_con)
175175{
……@@ -258,7 +258,7 @@ Handle RandomCallback::select_from_open(const Frame& frame,
258258/// Return a section containing `to_con`.
259259/// First try to attach to an existing open section.
260260/// If that fails, then pick a new section from the lexis.
261Handle RandomCallback::select(const Frame& frame,
261Handle RandomCallback::select(const OdoFrame& frame,
262262 const Handle& fm_sect, size_t offset,
263263 const Handle& to_con)
264264{
……@@ -293,19 +293,19 @@ size_t RandomCallback::num_links(const Handle& fm_sect,
293293 return num_undirected_links(fm_sect, to_sect, link_type);
294294}
295295
296void RandomCallback::push_frame(const Frame& frm)
296void RandomCallback::push_frame(const OdoFrame& frm)
297297{
298298 _opensel_stack.push(_opensel);
299299 _opensel._opensect.clear();
300300 _opensel._opendi.clear();
301301}
302302
303void RandomCallback::pop_frame(const Frame& frm)
303void RandomCallback::pop_frame(const OdoFrame& frm)
304304{
305305 _opensel = _opensel_stack.top(); _opensel_stack.pop();
306306}
307307
308bool RandomCallback::step(const Frame& frm)
308bool RandomCallback::step(const OdoFrame& frm)
309309{
310310 _steps_taken ++;
311311 if (max_steps < _steps_taken) return false;
……@@ -316,7 +316,7 @@ bool RandomCallback::step(const Frame& frm)
316316 // return _parms->step(frm);
317317}
318318
319void RandomCallback::solution(const Frame& frm)
319void RandomCallback::solution(const OdoFrame& frm)
320320{
321321 record_solution(frm);
322322}
opencog/generate/RandomCallback.h +7 -7
……@@ -57,7 +57,7 @@ private:
5757
5858 // -------------------------------------------
5959 // Lexical selection
60 Handle select_from_lexis(const Frame&,
60 Handle select_from_lexis(const OdoFrame&,
6161 const Handle&, size_t,
6262 const Handle&);
6363
……@@ -67,7 +67,7 @@ private:
6767 std::map<Handle, std::discrete_distribution<size_t>> _distmap;
6868
6969 // -------------------------------------------
70 Handle select_from_open(const Frame&,
70 Handle select_from_open(const OdoFrame&,
7171 const Handle&, size_t,
7272 const Handle&);
7373 struct OpenSelections
……@@ -95,7 +95,7 @@ public:
9595 virtual HandleSeq joints(const Handle& con) {
9696 return _dict.joints(con);
9797 }
98 virtual Handle select(const Frame&,
98 virtual Handle select(const OdoFrame&,
9999 const Handle&, size_t,
100100 const Handle&);
101101
……@@ -103,11 +103,11 @@ public:
103103 const Handle&, const Handle&);
104104 virtual size_t num_links(const Handle&, const Handle&,
105105 const Handle&);
106 virtual void push_frame(const Frame&);
107 virtual void pop_frame(const Frame&);
106 virtual void push_frame(const OdoFrame&);
107 virtual void pop_frame(const OdoFrame&);
108108
109 virtual bool step(const Frame&);
110 virtual void solution(const Frame&);
109 virtual bool step(const OdoFrame&);
110 virtual void solution(const OdoFrame&);
111111 virtual Handle get_solutions(void);
112112};
113113
opencog/generate/RandomParameters.h +3 -3
……@@ -22,7 +22,7 @@
2222#ifndef _OPENCOG_RANDOM_PARAMETERS_H
2323#define _OPENCOG_RANDOM_PARAMETERS_H
2424
25#include <opencog/generate/Frame.h>
25#include <opencog/generate/Odometer.h>
2626
2727namespace opencog
2828{
……@@ -46,12 +46,12 @@ public:
4646 /// the lexis. Consistently returning true will maximally close off
4747 /// any open connectors without enlarging the network. Rturning false
4848 /// will always increase the size of the network.
49 virtual bool connect_existing(const Frame&) = 0;
49 virtual bool connect_existing(const OdoFrame&) = 0;
5050
5151 /// Return true to continue stepping the odometer. Called before
5252 /// taking an odometer step. Returning false will abort the
5353 /// current odometer.
54 virtual bool step(const Frame&) = 0;
54 virtual bool step(const OdoFrame&) = 0;
5555};
5656
5757
opencog/generate/SimpleCallback.cc +7 -7
……@@ -97,7 +97,7 @@ HandleSet SimpleCallback::next_root(void)
9797
9898/// Return a section containing `to_con`.
9999/// Pick a new section from the lexis.
100Handle SimpleCallback::select_from_lexis(const Frame& frame,
100Handle SimpleCallback::select_from_lexis(const OdoFrame& frame,
101101 const Handle& fm_sect, size_t offset,
102102 const Handle& to_con)
103103{
……@@ -158,7 +158,7 @@ Handle SimpleCallback::check_self(const HandleSeq& to_sects,
158158
159159/// Return a section containing `to_con`.
160160/// Try to attach to an existing open section.
161Handle SimpleCallback::select_from_open(const Frame& frame,
161Handle SimpleCallback::select_from_open(const OdoFrame& frame,
162162 const Handle& fm_sect, size_t offset,
163163 const Handle& to_con)
164164{
……@@ -204,7 +204,7 @@ Handle SimpleCallback::select_from_open(const Frame& frame,
204204/// Return a section containing `to_con`.
205205/// First try to attach to an existing open section.
206206/// If that fails, then pick a new section from the lexis.
207Handle SimpleCallback::select(const Frame& frame,
207Handle SimpleCallback::select(const OdoFrame& frame,
208208 const Handle& fm_sect, size_t offset,
209209 const Handle& to_con)
210210{
……@@ -240,14 +240,14 @@ size_t SimpleCallback::num_links(const Handle& fm_sect,
240240 return num_undirected_links(fm_sect, to_sect, link_type);
241241}
242242
243void SimpleCallback::push_frame(const Frame& frm)
243void SimpleCallback::push_frame(const OdoFrame& frm)
244244{
245245 _opensel_stack.push(_opensel);
246246 _opensel._opensect.clear();
247247 _opensel._openit.clear();
248248}
249249
250void SimpleCallback::pop_frame(const Frame& frm)
250void SimpleCallback::pop_frame(const OdoFrame& frm)
251251{
252252 _opensel = _opensel_stack.top(); _opensel_stack.pop();
253253}
……@@ -263,7 +263,7 @@ void SimpleCallback::pop_odometer(const Odometer& odo)
263263 _lexlit = _lexlit_stack.top(); _lexlit_stack.pop();
264264}
265265
266bool SimpleCallback::step(const Frame& frm)
266bool SimpleCallback::step(const OdoFrame& frm)
267267{
268268 _steps_taken ++;
269269 if (max_steps < _steps_taken) return false;
……@@ -273,7 +273,7 @@ bool SimpleCallback::step(const Frame& frm)
273273 return true;
274274}
275275
276void SimpleCallback::solution(const Frame& frm)
276void SimpleCallback::solution(const OdoFrame& frm)
277277{
278278 record_solution(frm);
279279}
opencog/generate/SimpleCallback.h +7 -7
……@@ -61,7 +61,7 @@ private:
6161
6262 // -------------------------------------------
6363 // Lexical selection
64 Handle select_from_lexis(const Frame&,
64 Handle select_from_lexis(const OdoFrame&,
6565 const Handle&, size_t,
6666 const Handle&);
6767
……@@ -74,7 +74,7 @@ private:
7474 std::stack<HandleUCounter> _lexlit_stack;
7575
7676 // -------------------------------------------
77 Handle select_from_open(const Frame&,
77 Handle select_from_open(const OdoFrame&,
7878 const Handle&, size_t,
7979 const Handle&);
8080 Handle check_self(const HandleSeq&, const Handle&,
……@@ -97,7 +97,7 @@ public:
9797 virtual ~SimpleCallback();
9898
9999 virtual void clear(AtomSpace*);
100 virtual bool step(const Frame&);
100 virtual bool step(const OdoFrame&);
101101 virtual HandleSeq joints(const Handle& con) {
102102 return _dict.joints(con);
103103 }
……@@ -105,7 +105,7 @@ public:
105105 virtual void root_set(const HandleSet&);
106106 virtual HandleSet next_root(void);
107107
108 virtual Handle select(const Frame&,
108 virtual Handle select(const OdoFrame&,
109109 const Handle&, size_t,
110110 const Handle&);
111111
……@@ -113,11 +113,11 @@ public:
113113 const Handle&, const Handle&);
114114 virtual size_t num_links(const Handle&, const Handle&,
115115 const Handle&);
116 virtual void push_frame(const Frame&);
117 virtual void pop_frame(const Frame&);
116 virtual void push_frame(const OdoFrame&);
117 virtual void pop_frame(const OdoFrame&);
118118 virtual void push_odometer(const Odometer&);
119119 virtual void pop_odometer(const Odometer&);
120 virtual void solution(const Frame&);
120 virtual void solution(const OdoFrame&);
121121 virtual Handle get_solutions(void);
122122};
123123