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;
};
阅读 3.6k
2 个回答

建议你最好贴完整的类声明,目前来看http_conn可能是threadpool<http_conn>类的一个成员。

感觉是 uni-directional association:

+-----------------------+                   +-----------------------+
| threadpool<http_conn> |                   |       http_conn       |
+-----------------------+       m_workqueue +-----------------------+
|                       |------------------>|                       |
|                       |              0..* |                       |
|                       |                   |                       |
+-----------------------+                   +-----------------------+
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题