• R/O
  • SSH
  • HTTPS

particle-filter: 提交


Commit MetaInfo

修订版7 (tree)
时间2010-04-18 19:38:09
作者tullio

Log Message

stil memory deallocation error...

更改概述

差异

--- test/Makefile.in (revision 6)
+++ test/Makefile.in (revision 7)
@@ -3,7 +3,7 @@
33 SRCS=test_particle.cc test_particles.cc test_filter.cc
44 OBJS=$(SRCS:.cc=.o)
55 TARGETS=$(SRCS:.cc=)
6-CFLAGS=-I/usr/local/include/cutter -I. -I../src
6+CFLAGS=-I/usr/local/include/cutter -I. -I../src -g
77 LDFLAGS=@LDFLAGS@ -L. -L../src -lparticle -lcppcutter
88 all: $(TARGETS)
99
--- test/test_filter.cc (revision 6)
+++ test/test_filter.cc (revision 7)
@@ -4,11 +4,12 @@
44 #include <filter.h>
55 using namespace std;
66
7-static Particles func()
7+static Particles func(Particles &p)
88 {
9- Particles a;
9+// Particles a(5,3);
10+// Particles a;
1011 cout<<"state function"<<endl;
11- return(a);
12+ return(p);
1213 }
1314
1415 namespace test_filter
@@ -29,6 +30,7 @@
2930 a.createInitialParticles();
3031 a.dump_predict_particles();
3132 a.set_state_func(&func);
32- a.get_next_state();
33+ Particles b;
34+ a.get_next_state(b);
3335 }
3436 }
--- src/Makefile.in (revision 6)
+++ src/Makefile.in (revision 7)
@@ -5,7 +5,7 @@
55 HEADS=$(SRCS:.cc=.h)
66 TARGETS=libparticle.so
77 AR=@AR@
8-CFLAGS=-I.
8+CFLAGS=-I. -g
99 all: $(TARGETS)
1010
1111 libparticle.so: $(OBJS)
--- src/filter.cc (revision 6)
+++ src/filter.cc (revision 7)
@@ -9,7 +9,7 @@
99 }
1010 Filter::~Filter()
1111 {
12- if(x) delete x;
12+// if(x) delete x;
1313 }
1414
1515 bool Filter::setNumber(int n)
@@ -31,14 +31,14 @@
3131 x->dump_particles();
3232 return(0);
3333 }
34-bool Filter::set_state_func(Particles (*func)())
34+bool Filter::set_state_func(Particles (*func)(Particles &p))
3535 {
3636 state_func = func;
3737 return(true);
3838 }
39-Particles Filter::get_next_state()
39+Particles Filter::get_next_state(Particles &p)
4040 {
4141 cout<<"go..."<<endl;
42- (*state_func)();
42+ (*state_func)(p);
4343 cout<<"ok..."<<endl;
4444 }
--- src/filter.h (revision 6)
+++ src/filter.h (revision 7)
@@ -11,7 +11,7 @@
1111 Particles *x;
1212 vector<int> y;
1313 int number, dimension;
14- Particles (*state_func)();
14+ Particles (*state_func)(Particles &p);
1515 public:
1616 Filter();
1717 ~Filter();
@@ -19,8 +19,8 @@
1919 bool setDimension(int d);
2020 bool createInitialParticles();
2121 int dump_predict_particles();
22- bool set_state_func(Particles (*func)());
23- Particles get_next_state();
22+ bool set_state_func(Particles (*func)(Particles &p));
23+ Particles get_next_state(Particles &p);
2424 };
2525
2626 #endif
--- src/Makefile (revision 6)
+++ src/Makefile (revision 7)
@@ -5,7 +5,7 @@
55 HEADS=$(SRCS:.cc=.h)
66 TARGETS=libparticle.so
77 AR=ar
8-CFLAGS=-I.
8+CFLAGS=-I. -g
99 all: $(TARGETS)
1010
1111 libparticle.so: $(OBJS)
Show on old repository browser