/[adonthell]/adonthell/src/python/pool.cc
ViewVC logotype

Diff of /adonthell/src/python/pool.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by ksterker, Thu May 13 06:44:01 2004 UTC revision 1.4 by ksterker, Fri Jun 3 17:29:13 2005 UTC
# Line 32  Line 32 
32  using python::method;  using python::method;
33  using python::pool;  using python::pool;
34    
35  std::map<const char*, python::script*> pool::Pool;  std::map<std::string, python::script*> pool::Pool;
36    
37  void pool::init ()  void pool::init ()
38  {  {
# Line 40  void pool::init () Line 40  void pool::init ()
40    
41  void pool::cleanup ()  void pool::cleanup ()
42  {  {
43      std::map<const char*, python::script*>::iterator i;      std::map<std::string, python::script*>::iterator i;
44    
45      for (i = Pool.begin (); i != Pool.end (); i++)      for (i = Pool.begin (); i != Pool.end (); i++)
46          delete (*i).second;          delete (*i).second;
47            
48            Pool.clear ();
49  }  }
50    
51  method *pool::connect (const std::string & file, const std::string & classname, const std::string & callback)  method *pool::connect (const std::string & file, const std::string & classname, const std::string & callback)
# Line 56  method *pool::connect (const std::string Line 58  method *pool::connect (const std::string
58    
59  python::script *pool::reconnect (const std::string & file, const std::string & classname)  python::script *pool::reconnect (const std::string & file, const std::string & classname)
60  {  {
61      std::map<const char*, python::script*>::iterator i;      std::map<std::string, python::script*>::const_iterator i;
62      std::string name = file + classname;      std::string name = file + classname;
63            
64      // script not in pool yet      // script not in pool yet
65      if ((i = Pool.find (name.c_str ())) == Pool.end ())      if ((i = Pool.find (name)) == Pool.end ())
66      {      {
67          python::script *scrpt = new python::script ();          python::script *scrpt = new python::script ();
68                    
# Line 75  python::script *pool::reconnect (const s Line 77  python::script *pool::reconnect (const s
77          }          }
78                    
79          // add script to pool          // add script to pool
80          Pool[name.c_str ()] = scrpt;          Pool[name] = scrpt;
81          return scrpt;          return scrpt;
82      }      }
83      // script already in pool      // script already in pool

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26