title: How do you convert a C++ object to a PyObject?
body: <p>I have a two c++ objects </p>
  
  <pre><code>    int queueIndex
      Timer timer_obj
  </code></pre>
  
  <p>and here is the definition of the timer class</p>
  
  <pre><code>class Timer
  {
  
  private:
      struct timeval tStart; /**&lt; @brief Stores the system time when the timer is started */
      struct timeval tFinish; /**&lt; @brief Stores the system time when the timer is stopped */
  
  protected:
      float getElapsedTime(struct timeval, struct timeval);
  
  public:
      Timer();
      string currentTime();
      float currentElapsedTime();
      void restart();
      float stop();
      int high_pres_usleep_untill(unsigned long long int);
      string getStringStartTimer();
      void setStartTimerFromString(string);
      void sleep(long int);
      unsigned long long int get_clock();
  </code></pre>
  
  <p>I need to convert these two objects into PyObj*.I was using boost::python for this purpose.I now wish to do it without boost or swig.
  I successfully converted Index but im clueless with the timer_obj</p>
  
  <pre><code>    PyObject* pyo=PyInt_FromLong(queueIndex)
  </code></pre>
  
  <p>I would be thankful if someone could help me with this.I just need an example you dont need to give me the complete code.Also the functions defined in the class are a bit complicated so I did not give them here.Is it possible to convert the timer_obj and then assign a new reference or do i have to obtain new reference for all the structs and functions in the class and create a new class with these references?</p>