Boost logo

Boost-Commit :

From: phil_at_[hidden]
Date: 2008-08-19 05:11:18


Author: pbouchard
Date: 2008-08-19 05:11:17 EDT (Tue, 19 Aug 2008)
New Revision: 48211
URL: http://svn.boost.org/trac/boost/changeset/48211

Log:
Added comments.
Text files modified:
   sandbox/shifted_ptr/boost/shifted_allocator.hpp | 3 +++
   sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp | 6 +++---
   sandbox/shifted_ptr/libs/smart_ptr/example/t100.h | 27 ++++++++++++++++++++++++---
   3 files changed, 30 insertions(+), 6 deletions(-)

Modified: sandbox/shifted_ptr/boost/shifted_allocator.hpp
==============================================================================
--- sandbox/shifted_ptr/boost/shifted_allocator.hpp (original)
+++ sandbox/shifted_ptr/boost/shifted_allocator.hpp 2008-08-19 05:11:17 EDT (Tue, 19 Aug 2008)
@@ -38,6 +38,9 @@
 
 /**
     STL compliant allocator.
+
+ @note
+ Default object contructor is called inside allocate() to save temporaries.
 */
 
 template <typename T>

Modified: sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp
==============================================================================
--- sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp (original)
+++ sandbox/shifted_ptr/libs/smart_ptr/example/shifted_ptr_test2.cpp 2008-08-19 05:11:17 EDT (Tue, 19 Aug 2008)
@@ -65,8 +65,8 @@
     vector() { ++count; }
     ~vector() { --count; }
     vector(const vector& other) : elements(other.elements) { ++count; }
- //std::vector<shifted_ptr<vector> > elements;
- std::list<shifted_ptr<vector>, shifted_allocator< shifted_ptr<vector> > > elements; //! FIXME
+ std::vector<shifted_ptr<vector> > elements;
+ //std::list<shifted_ptr<vector>, shifted_allocator< shifted_ptr<vector> > > elements; //! works fine
 };
 
 struct create_type {
@@ -124,5 +124,5 @@
     }
     std::cout << count << std::endl;
 
- _exit(-1); // bypassing bug in pool destructor
+ //_exit(-1); // bypassing bug in pool destructor
 }

Modified: sandbox/shifted_ptr/libs/smart_ptr/example/t100.h
==============================================================================
--- sandbox/shifted_ptr/libs/smart_ptr/example/t100.h (original)
+++ sandbox/shifted_ptr/libs/smart_ptr/example/t100.h 2008-08-19 05:11:17 EDT (Tue, 19 Aug 2008)
@@ -42,14 +42,26 @@
     enum sense_t {sight, sound, touch, smell, taste};
 
     boost::regex exp_;
- std::vector< std::pair<double, pointer> > sub_;
+ //std::vector< std::pair<double, pointer> > sub_;
+ std::pair<double, pointer> sub_[3];
 
- neuron_base(std::string const & s) : exp_(s), sub_(exp_.mark_count()) {}
+ neuron_base(std::string const & s) : exp_(s)/*, sub_(exp_.mark_count())*/ {}
     virtual ~neuron_base() {};
 
     virtual double operator () (std::string const & input) {};
 };
 
+
+/**
+ Core brain kernel.
+
+ @note
+ The brain kernel will have a thread running in the background to sort out
+ all confused neurons that didn't take any decisions yet. This should be
+ linked with the imaginative section of the brain which guesses over and
+ over (trials & errors) when to many regex occurences are present.
+*/
+
 template <neuron_base::sense_t>
     class neuron : public neuron_base
     {
@@ -58,13 +70,22 @@
 
     public:
         typedef boost::shifted<neuron> pointee;
+
+ /**
+ The following should be one of these multimap indexed by:
+ - regular expression string
+ - weight
+ - emotional state weight (normal, angry, or scared)
+ */
+
         typedef std::map<std::string, pointer> map_sn_t;
         
         static map_sn_t search_;
     
         neuron(std::string const & s, pointee * p1 = 0, pointee * p2 = 0, pointee * p3 = 0) : neuron_base(s)
         {
- search_[s] = reinterpret_cast<pointee *>(this); /// FIXME
+ /// FIXME
+ //search_[s] = (pointee *) (typename pointee::roofof) static_cast<neuron *>(rootof<is_polymorphic<neuron>::value>::get(this));
         
             if (p1) sub_[0].second = p1;
             if (p2) sub_[1].second = p2;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk