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

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

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

revision 1.1 by ksterker, Mon Dec 1 22:42:21 2003 UTC revision 1.2 by ksterker, Mon Oct 25 06:50:09 2004 UTC
# Line 36  Line 36 
36  namespace python  namespace python
37  {  {
38      /**      /**
39       *       * A cache for python scripts that allows multiple objects to access the
40         * same python instance. This avoids multiple instanciation of python
41         * objects that could easily be shared.
42       */       */
43      class pool      class pool
44      {      {
# Line 52  namespace python Line 54  namespace python
54              static void cleanup ();              static void cleanup ();
55                            
56              /**              /**
57               *               * Return a python method from the given script and class. If the
58                 * class is not yet cached in the pool, it is instanciated.
59                 * @param file name of the python script.
60                 * @param classname name of the python class to access.
61                 * @param callback name of the method to retrieve from that class.
62                 * @return python method from cached object or \c NULL on error.
63               */               */
64              static python::method * connect (const std::string & file,              static python::method * connect (const std::string & file,
65                  const std::string & classname, const std::string & callback);                  const std::string & classname, const std::string & callback);
66                            
67              /**              /**
68               *               * Return a python object from the given script. If it is not
69                 * yet cached, the script will be loaded and the given class
70                 * will be instanciated.
71                 * @param file name of the python script.
72                 * @param classname name of the python class to access.
73                 * @return python object from cache or \c NULL on error.
74               */               */
75              static python::script * reconnect (const std::string & file,              static python::script * reconnect (const std::string & file,
76                  const std::string & classname);                  const std::string & classname);
77                                    
78          private:          private:
79              /**              /// All python scripts currently kept in cache
              *  
              */  
80              static std::map<const char*, python::script*> Pool;              static std::map<const char*, python::script*> Pool;
81      };      };
82  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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