search

Home  >  Q&A  >  body text

c++ 中的uml图

template <typename T> class threadpool;
class http_conn;
threadpool <http_conn> *poll; 

请问类http_conn和类threadpool是什么关系,在uml中如何表示?threadpool的定义如下:

template< typename T >
class threadpool
{
public:
    threadpool( int thread_number = 8, int max_requests = 10000 );
    ~threadpool();
    bool append( T* request );

private:
    static void* worker( void* arg );
    void run();

private:
    int m_thread_number;
    int m_max_requests;
    pthread_t* m_threads;
    std::list< T* > m_workqueue;
    locker m_queuelocker;
    sem m_queuestat;
    bool m_stop;
};
PHP中文网PHP中文网2804 days ago475

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 13:34:00

    It is recommended that you post a complete class declaration. At present, http_conn may be a member of the threadpool<http_conn> class.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 13:34:00

    It feels like uni-directional association:

    +-----------------------+                   +-----------------------+
    | threadpool<http_conn> |                   |       http_conn       |
    +-----------------------+       m_workqueue +-----------------------+
    |                       |------------------>|                       |
    |                       |              0..* |                       |
    |                       |                   |                       |
    +-----------------------+                   +-----------------------+

    reply
    0
  • Cancelreply