source: anotherchoice/tags/jsp-1.4.4-full-UTF8/windev/devicemanager/kernellog.h@ 26

Last change on this file since 26 was 26, checked in by ykominami, 12 years ago

initial

File size: 6.0 KB
Line 
1/*
2 * TOPPERS/JSP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Just Standard Profile Kernel
5 *
6 * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 *
9 * 上記著作権者
10は,以下の (1)〜(4) の条件か,Free Software Foundation
11 * によってå…
12¬è¡¨ã•ã‚Œã¦ã„ã‚‹ GNU General Public License の Version 2 に記
13 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア
14 * を改変したものを含む.以下同じ)を使用・複製・改変・再é…
15å¸ƒï¼ˆä»¥ä¸‹ï¼Œ
16 * 利用と呼ぶ)することを無償で許諾する.
17 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
18 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
19 * スコード中に含まれていること.
20 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
21 * 用できる形で再é…
22å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
23å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
24 * 者
25マニュアルなど)に,上記の著作権表示,この利用条件および下記
26 * の無保証規定を掲載すること.
27 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
28 * 用できない形で再é…
29å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
30 * と.
31 * (a) 再é…
32å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
33マニュアルなど)に,上記の著
34 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
35 * (b) 再é…
36å¸ƒã®å½¢æ…
37‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
38 * 報告すること.
39 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
40 * 害からも,上記著作権者
41およびTOPPERSプロジェクトをå…
42è²¬ã™ã‚‹ã“と.
43 *
44 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
45お
46 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も
47 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直
48 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない.
49 *
50 * @(#) $Id: kernellog.h,v 1.2 2003/12/20 09:19:59 takayuki Exp $
51 */
52
53// KernelLog.h : CKernelLog の宣言
54
55#ifndef __KERNELLOG_H_
56#define __KERNELLOG_H_
57
58#include "resource.h" // メイン シンボル
59#include "devicemanagerCP.h"
60
61/////////////////////////////////////////////////////////////////////////////
62// CKernelLog
63class ATL_NO_VTABLE CKernelLog :
64 public CComObjectRootEx<CComSingleThreadModel>,
65 public CComCoClass<CKernelLog, &CLSID_KernelLog>,
66 public IConnectionPointContainerImpl<CKernelLog>,
67 public IKernelLog,
68 public CProxy_IKernelLogEvents< CKernelLog >
69{
70public:
71 CKernelLog();
72 ~CKernelLog();
73
74DECLARE_REGISTRY_RESOURCEID(IDR_KERNELLOG)
75
76DECLARE_PROTECT_FINAL_CONSTRUCT()
77
78BEGIN_COM_MAP(CKernelLog)
79 COM_INTERFACE_ENTRY(IKernelLog)
80 COM_INTERFACE_ENTRY(IConnectionPointContainer)
81 COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
82END_COM_MAP()
83BEGIN_CONNECTION_POINT_MAP(CKernelLog)
84CONNECTION_POINT_ENTRY(IID__IKernelLogEvents)
85END_CONNECTION_POINT_MAP()
86
87
88// IKernelLog
89public:
90};
91
92#endif //__KERNELLOG_H_
93
94
95
96#if 0
97
98template <class T>
99class CProxy_IKernelLogEvents : public IConnectionPointImpl<T, &IID__IKernelLogEvents, CComDynamicUnkArray>
100{
101public:
102 bool onKernelStart_Performed;
103
104 CProxy_IKernelLogEvents(void) : onKernelStart_Performed(false) {};
105
106 //Warning this class may be recreated by the wizard.
107public:
108 HRESULT Fire_OnKernelStart()
109 {
110 HRESULT ret;
111 T* pT = static_cast<T*>(this);
112 int nConnectionIndex;
113 int nConnections = m_vec.GetSize();
114
115 for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
116 {
117 pT->Lock();
118 CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
119 pT->Unlock();
120 _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
121 if (p_IKernelLogEvents != NULL)
122 ret = p_IKernelLogEvents->OnKernelStart();
123 }
124 onKernelStart_Performed = true;
125 return ret;
126 }
127
128 HRESULT Fire_OnKernelExit()
129 {
130 HRESULT ret;
131 T* pT = static_cast<T*>(this);
132 int nConnectionIndex;
133 int nConnections = m_vec.GetSize();
134
135 for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
136 {
137 pT->Lock();
138 CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
139 pT->Unlock();
140 _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
141 if (p_IKernelLogEvents != NULL)
142 ret = p_IKernelLogEvents->OnKernelExit();
143 }
144 onKernelStart_Performed = false;
145 return ret;
146 }
147
148 HRESULT Fire_OnLogEvent(LONG sz, unsigned char * data)
149 {
150 HRESULT ret;
151 T* pT = static_cast<T*>(this);
152 int nConnectionIndex;
153 int nConnections = m_vec.GetSize();
154
155 for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
156 {
157 pT->Lock();
158 CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
159 pT->Unlock();
160 _IKernelLogEvents* p_IKernelLogEvents = reinterpret_cast<_IKernelLogEvents*>(sp.p);
161 if (p_IKernelLogEvents != NULL)
162 {
163 if(!onKernelStart_Performed)
164 p_IKernelLogEvents->OnKernelStart();
165 ret = p_IKernelLogEvents->OnLogEvent(sz, data);
166 }
167 }
168 onKernelStart_Performed = true;
169 return ret;
170 }
171};
172#endif
Note: See TracBrowser for help on using the repository browser.