c++ 中的uml图
PHP中文网
PHP中文网 2017-04-17 13:32:00
[C++讨论组]
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中文网

认证高级PHP讲师

全部回复(2)
PHP中文网

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

天蓬老师

感觉是 uni-directional association:

+-----------------------+                   +-----------------------+
| threadpool<http_conn> |                   |       http_conn       |
+-----------------------+       m_workqueue +-----------------------+
|                       |------------------>|                       |
|                       |              0..* |                       |
|                       |                   |                       |
+-----------------------+                   +-----------------------+
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号