TNB Library
TnbTraceLogger.h
[詳解]
1#pragma once
107#include "TnbDump.h"
108#include "TnbInifileAccessor.h"
109#include "TnbFile.h"
110#include "TnbAsyncWriter.h"
111#include "TnbSingleton.h"
112#include "TnbStrEx.h"
113
114
115
116//TNB Library
117namespace TNB
118{
119
120
121
122#ifndef _TnbLOG_DISABLE
123
124
125#ifndef _TnbLOG_MULTIFILE
126 #pragma message("message : TLOG系は有効になっています(SingleFileType)。")
127#else
128 #pragma message("message : TLOG系は有効になっています(MultiFileType)。")
129#endif
130
131
132
133#ifndef _TnbDOXYGEN //Document作成用シンボル
134
135
136
137#ifndef _TnbTraceLogger_Types
138 #define _TnbTraceLogger_Types "trace"
139#endif
140
141#ifndef _TnbTraceLogger_LogSize
142 #define _TnbTraceLogger_LogSize 64
143#endif
144
145#ifndef _TnbTraceLogger_FileCount
146 #define _TnbTraceLogger_FileCount 5
147#endif
148
149#ifndef _TnbTraceLogger_Time
150 #define _TnbTraceLogger_Time "normal"
151#endif
152
153#ifndef _TnbTraceLogger_Thread
154 #define _TnbTraceLogger_Thread "on"
155#endif
156
157#ifndef _TnbTraceLogger_Dump
158 #define _TnbTraceLogger_Dump 1
159#endif
160
161#ifndef _TnbTraceLogger_LogFileName
162 #define _TnbTraceLogger_LogFileName ms_MakeLogfilePath
163#endif
164
165// 旧表記
166#ifdef _TnbTraceLogger_FileMaxSize
167 #undef _TnbTraceLogger_LogSize
168 #define _TnbTraceLogger_LogSize _TnbTraceLogger_FileMaxSize
169#endif
170
171#ifdef _TnbLOG_OUTPUT_FUNC
172 #undef _TnbTraceLogger_Types
173 #define _TnbTraceLogger_Types "trace func"
174#endif
175
176
192class CTraceLogger
193{
194public:
195
197 enum EType
198 {
199 Type_Absolute = _BIT(0),
200 Type_Error = _BIT(1),
201 Type_Trace = _BIT(2),
202 Type_Polling = _BIT(3),
203 Type_Function = _BIT(4),
204 };
205
207 enum EThread
208 {
209 Thread_Off = 0,
210 Thread_On,
211 };
212
214 enum ETime
215 {
216 Time_Off = 0,
217 Time_Normal,
218 Time_Full,
219 Time_Tick,
220 };
221
236 class CFuncer
237 {
238 public:
244 CFuncer(LPCTSTR lpszFunctionName, ...)
245 {
246 CStr s;
247 va_list args;
248 va_start(args, lpszFunctionName);
249 s.FormatV(lpszFunctionName, args);
250 m_functionName = s.FindCut('(');
251 if ( s.Find('(') == INVALID_INDEX )
252 {
253 s += _T("()");
254 }
255 CTraceLogger::Write(CTraceLogger::Type_Function, CStr::Fmt(_T(">In[%s]"), s));
256 }
263 void Param(LPCTSTR lpszFormatText, ...)
264 {
265 #ifndef _WIN32_WCE
266 ASSERT0(! m_functionName.IsEmpty(),
267 CAscii(m_functionName), "リザルト表示後にパラメータを表示しようとしています。");
268 #endif
269 CStr s;
270 va_list args; va_start(args, lpszFormatText);
271 s.FormatV(lpszFormatText, args);
272 CTraceLogger::Write(CTraceLogger::Type_Function, _T(">InParam ") + s);
273 }
280 void Result(LPCTSTR lpszFormatText, ...)
281 {
282 #ifndef _WIN32_WCE
283 ASSERT0(! m_functionName.IsEmpty(),
284 CAscii(m_functionName), "リザルトを二回以上表示しようとしています。");
285 #endif
286 CStr s;
287 va_list args; va_start(args, lpszFormatText);
288 s.FormatV(lpszFormatText, args);
289 m_resultText.Format(_T(">Out[%s()] %s"), m_functionName, s);
290 m_functionName.Empty();
291 }
293 ~CFuncer(void)
294 {
295 if ( ! m_resultText.IsEmpty() )
296 {
297 CTraceLogger::Write(CTraceLogger::Type_Function, m_resultText);
298 }
299 else if ( ! m_functionName.IsEmpty() )
300 {
301 CStr s;
302 s.Format(_T(">Out[%s()]"), m_functionName);
303 CTraceLogger::Write(CTraceLogger::Type_Function, s);
304 }
305 m_functionName.Empty();
306 }
308 LPCTSTR GetFunctionName(void) const
309 {
310 return m_functionName;
311 }
312
313 private:
314 CStr m_functionName;
315 CStr m_resultText;
316 };
317
318
319 //-----------------
320
321
323 virtual ~CTraceLogger(void)
324 {
325 m_Stop();
326 }
327
333 static void EnableOutput(bool isEnable)
334 {
335 CTraceLogger* P = GetInstance();
336 P->m_PauseMode(! isEnable);
337 if ( ! isEnable )
338 {
339 P->m_Stop();
340 }
341 }
342
351 static bool Write(EType type, LPCTSTR lpszFormatText, va_list va)
352 {
353 CTraceLogger* P = GetInstance();
354 if ( ! P->m_CanLogout(type) ){ return true; }
355 CStr s;
356 s.FormatV(lpszFormatText, va);
357 return P->m_PostTraceInfo(type, CAscii(s), NULL);
358 }
359
368 static bool Write(EType type, LPCTSTR lpszFormatText, ...)
369 {
370 va_list args; va_start(args, lpszFormatText);
371 return Write(type, lpszFormatText, args);
372 }
373
381 static bool Write(EType type, const CByteVector &vb)
382 {
383 bool boRc = true;
384 CTraceLogger* P = GetInstance();
385 if ( ! P->m_CanLogout(type) ){ return true; }
386 if ( P->m_outputDumpLevel > 0 )
387 {
388 boRc = P->m_PostTraceInfo(type, NULL, &vb);
389 }
390 return boRc;
391 }
392
400 static bool Write(EType type, size_t size, LPCVOID P)
401 {
402 bool r;
403 if ( ! ::IsBadReadPtr(P, size) )
404 {
405 CByteVector b;
406 b.SetElements(size, static_cast<const BYTE*>(P));
407 r = Write(type, b);
408 }
409 else
410 {
411 r = Write(type, _T("アクセスできない領域をDumpしようしました。"));
412 }
413 return r;
414 }
415
416private:
417
419 SINGLETON_CONSTRUCTOR(CTraceLogger)
420 {
421 m_outputTypes = 0;
422 m_maxLogSize = 0;
423 m_maxMultiFileCount = 0;
424 m_outputThread = Thread_On;
425 m_outputTime = Time_Normal;
426 m_outputDumpLevel = 1;
427 m_offset = 0;
428 m_isInitLastTick = false;
429 m_isPause = false;
430 }
431
438 static CStr ms_MakeLogfilePath(INDEX index = 0)
439 {
440 CStr str;
441 DWORD dwRc = ::GetModuleFileName(NULL, str.GetBuffer(MAX_PATH), MAX_PATH);
442 str.ReleaseBuffer();
443 ASSERTLIB(dwRc != 0);
444 //
445 CStr strWork;
446 strWork = str.Left(str.ReverseFind('.'));
447 #ifdef _DEBUG
448 strWork += _T(".");
449 strWork += TNB::GetComputerName();
450 #endif
451 if ( index == 0 )
452 {
453 strWork += _T(".t.log");
454 }
455 else
456 {
457 strWork += CStr::Fmt(_T(".t%d.log"), index);
458 }
459 return strWork;
460 }
461
467 bool m_CanLogout(EType type)
468 {
469 EXCLUSIVE(&m_sync);
470 if ( m_isPause )
471 {
472 return false;
473 }
474 if ( ! m_file.IsAlive() )
475 {
476 if ( ! m_Start() )
477 {
478 return false;
479 }
480 }
481 return (m_outputTypes & type) != 0;
482 }
483
485 void m_Stop()
486 {
487 if ( m_file.IsAlive() )
488 {
489 m_PostTraceInfo(Type_Absolute, "----------<<終了>>----------", NULL);
490 }
491 m_file.Stop();
492 m_fw.Close();
493 }
494
500 bool m_Start(void)
501 {
502 m_Stop();
503 CInifileAccessor ini(TNB::GetProcessPath() + _T("\\TnbLogger.ini"));
504 CInifileAccessor::CSection sec = ini[_T("Trace")];
505 m_outputTypes = Type_Trace | Type_Error | Type_Absolute;
506 {
507 CStr s = sec.QueryString(_T("Types"));
508 if ( s.IsEmpty() )
509 {
510 s = _T(_TnbTraceLogger_Types);
511 }
512 if ( s.Find(_T("err")) >= 0 ){
513 m_outputTypes = Type_Error | Type_Absolute;
514 }
515 if ( s.Find(_T("trace")) >= 0 ){
516 m_outputTypes |= Type_Trace;
517 }
518 if ( s.Find(_T("poll")) >= 0 ){
519 m_outputTypes |= Type_Polling;
520 }
521 if ( s.Find(_T("func")) >= 0 ){
522 m_outputTypes |= Type_Function;
523 }
524 if ( s.Find(_T("off")) >= 0 ){
525 m_outputTypes = 0;
526 }
527 }
528 if ( m_outputTypes == 0 )
529 {
530 return true;
531 }
532 m_maxLogSize = sec.QueryDword(_T("LogSize"), _TnbTraceLogger_LogSize);
533 if ( m_maxLogSize < 1 )
534 {
535 m_maxLogSize = 1;
536 }
537 m_maxMultiFileCount = sec.QueryDword(_T("FileCount"), _TnbTraceLogger_FileCount);
538 if ( m_maxMultiFileCount < 2 )
539 {
540 m_maxMultiFileCount = 2;
541 }
542 m_maxLogSize *= 1024;
543 m_outputTime = Time_Normal;
544 {
545 CStr s = sec.QueryString(_T("Time"));
546 if ( s.IsEmpty() )
547 {
548 s = _T(_TnbTraceLogger_Time);
549 }
550 if ( s.Find(_T("off")) >= 0 ){
551 m_outputTime = Time_Off;
552 }
553 else if ( s.Find(_T("normal")) >= 0 ){
554 m_outputTime = Time_Normal;
555 }
556 else if ( s.Find(_T("full")) >= 0 ){
557 m_outputTime = Time_Full;
558 }
559 else if ( s.Find(_T("tick")) >= 0 ){
560 m_outputTime = Time_Tick;
561 }
562 }
563 m_outputThread = Thread_On;
564 {
565 CStr s = sec.QueryString(_T("Thread"));
566 if ( s.IsEmpty() )
567 {
568 s = _T(_TnbTraceLogger_Thread);
569 }
570 if ( s.Find(_T("off")) >= 0 ){
571 m_outputThread = Thread_Off;
572 }
573 else if ( s.Find(_T("on")) >= 0 ){
574 m_outputThread = Thread_On;
575 }
576 }
577 m_outputDumpLevel = sec.QueryDword(_T("Dump"), _TnbTraceLogger_Dump);
578 //
579 if ( ! m_fw.Open(_TnbTraceLogger_LogFileName(0), true, true) )
580 {
581 return false;
582 }
583 m_offset = static_cast<INDEX>(m_fw.GetSize());
584 #ifndef _TnbLOG_MULTIFILE
585 if ( m_offset == 0 )
586 {
587 //新規じゃん
588 m_offset = HEADSIZE + 2;
589 if ( ! m_WritePos(m_fw, m_offset) )
590 {
591 return false;
592 }
593 }
594 else
595 {
596 CByteVector vb;
597 try
598 {
599 m_fw.Seek(0);
600 vb = m_fw.ReadExactly(HEADSIZE);
601 }
602 catch(CTnbException& e)
603 {
604 e.OnCatch();
605 return false;
606 }
607 catch(...)
608 {
609 ASSERTLIB(false);
610 return false;
611 }
612 vb.Add(0);
613 m_offset = atoi(reinterpret_cast<const char*>(vb.ReferBuffer()));
614 m_fw.Seek(m_offset);
615 }
616 #endif
617 if ( ! m_file.SetWriter(&m_fw) )
618 {
619 return false;
620 }
621 if ( ! m_file.Start() )
622 {
623 return false;
624 }
625 m_file.SetPriority(THREAD_PRIORITY_LOWEST/*2つ下*/);
626 m_PostTraceInfo(Type_Absolute, "----------<<起動>>----------", NULL);
627 return true;
628 }
629
637 bool m_WritePos(IWriter& _fw, INDEX dwPos)
638 {
639 if ( ! _fw.CanWrite() )
640 {
641 return false;
642 }
643 DWORD dw = ToDword(dwPos);
644 char acFmt[HEADSIZE * 2];
645 char acBuf[HEADSIZE * 2];
646 sprintf(acFmt, "%%0%dd\r\n", HEADSIZE);
647 sprintf(acBuf, acFmt, dw);
648 _fw.Seek(0);
649 try
650 {
651 _fw.Write(HEADSIZE + 2, acBuf);
652 }
653 catch(CTnbException& e)
654 {
655 e.OnCatch();
656 return false;
657 }
658 catch(...)
659 {
660 ASSERTLIB(false);
661 return false;
662 }
663 return true;
664 }
665
673 bool m_WriteLine(IWriter& _fw, LPCSTR lpszLine)
674 {
675 ASSERT( &_fw == &m_fw );
676 if ( ! m_fw.CanWrite() )
677 {
678 return false;
679 }
680 //
681 #ifdef _DEBUG
682 ::OutputDebugString(CStr(lpszLine).Sandwich(_T("TLOG:["), _T("]\n")));
683 #endif
684 #ifndef _TnbLOG_MULTIFILE
685 LPCSTR lpszRc = "\r\n@@\r\n";
686 m_fw.Seek(m_offset);
687 #else
688 LPCSTR lpszRc = "\r\n";
689 #endif
690 size_t dwTextSize = STRLIB::GetLen(lpszLine);
691 try
692 {
693 m_fw.Write(dwTextSize, lpszLine);
694 m_fw.Write(STRLIB::GetLen(lpszRc), lpszRc);
695 }
696 catch(CTnbException& e)
697 {
698 e.OnCatch();
699 return false;
700 }
701 catch(...)
702 {
703 ASSERTLIB(false);
704 return false;
705 }
706 m_offset += dwTextSize + 2;
707 #ifndef _TnbLOG_MULTIFILE
708 if ( m_offset > m_maxLogSize )
709 {
710 m_offset = HEADSIZE + 2;
711 m_fw.SetEnd();
712 }
713 return m_WritePos(m_fw, m_offset);
714 #else
715 if ( m_offset > m_maxLogSize )
716 {
717 // リネームするぞ
718 EXCLUSIVE(&m_sync);
719 m_fw.Close();
720 ::DeleteFile(_TnbTraceLogger_LogFileName(m_maxMultiFileCount)); //ない場合もある
721 loop_dn( i, m_maxMultiFileCount)
722 {
723 CStr s1 = _TnbTraceLogger_LogFileName(i + 1);
724 CStr s2 = _TnbTraceLogger_LogFileName(i);
725 ::MoveFile(s2, s1);
726 }
727 if ( ! m_fw.New(_TnbTraceLogger_LogFileName(0), true) )
728 {
729 return false;
730 }
731 m_offset = 0;
732 }
733 return true;
734 #endif
735 }
736
740 class CParamWriteCmd : public CAsyncWriter::ICommand
741 {
742 CTraceLogger* m_pLogger;
743 public:
744 EType type;
745 bool hasText;
746 CAscii strText;
747 CByteVector vbBinary;
748 SYSTEMTIME tSysTime;
749 DWORD dwTick;
750 DWORD dwThreadId;
751
753 CParamWriteCmd(CTraceLogger* P)
754 {
755 m_pLogger = P;
756 }
757
763 virtual bool Exec(IWriter& fw)
764 {
765 if ( ! m_pLogger->m_isInitLastTick )
766 {
767 m_pLogger->m_isInitLastTick = true;
768 m_pLogger->m_lastTick = dwTick;
769 }
770 DWORD dwTickDiff = dwTick - m_pLogger->m_lastTick;
771 CAscii strThread;
772 if ( m_pLogger->m_outputThread != Thread_Off )
773 {
774 strThread.Format("[%08X] ", dwThreadId);
775 }
776 CAscii strLine;
777 switch ( m_pLogger->m_outputTime )
778 {
779 case Time_Off: //出力しない
780 break;
781 case Time_Normal: //YY/MM/DD-HH:MM:SS.SSS
782 default:
783 #ifndef _WIN32_WCE
784 strLine.Format("%02d/%02d/%02d-%02d:%02d:%02d.%03d",
785 tSysTime.wYear%100,
786 tSysTime.wMonth,
787 tSysTime.wDay,
788 tSysTime.wHour,
789 tSysTime.wMinute,
790 tSysTime.wSecond,
791 tSysTime.wMilliseconds
792 );
793 #else
794 strLine.Format("%02d/%02d-%02d:%02d:%02d",
795 tSysTime.wMonth,
796 tSysTime.wDay,
797 tSysTime.wHour,
798 tSysTime.wMinute,
799 tSysTime.wSecond
800 );
801 #endif
802 break;
803 case Time_Full: //YY/MM/DD-HH:MM:SS.SSS(TTTTTTTT)
804 strLine.Format("%02d/%02d/%02d-%02d:%02d:%02d.%03d(%8d)",
805 tSysTime.wYear%100,
806 tSysTime.wMonth,
807 tSysTime.wDay,
808 tSysTime.wHour,
809 tSysTime.wMinute,
810 tSysTime.wSecond,
811 tSysTime.wMilliseconds,
812 dwTickDiff
813 );
814 break;
815 case Time_Tick: //TTTTTTTT
816 strLine.Format("(%8d)", dwTickDiff);
817 break;
818 }
819 m_pLogger->m_lastTick = dwTick;
820 //
821 if ( type == Type_Error )
822 {
823 strLine += "*Err* ";
824 }
825 else
826 {
827 strLine += " ";
828 }
829 //
830 if ( hasText )
831 {
832 strLine += strText;
833 m_pLogger->m_WriteLine(fw, strThread + strLine);
834 }
835 else if ( (m_pLogger->m_outputDumpLevel) > 0 )
836 {
837 CAscii s;
838 s.Format(" Bin(size=%d)", vbBinary.GetSize());
839 strLine += s;
840 m_pLogger->m_WriteLine(fw, strThread + strLine);
841 //
842 size_t l = vbBinary.GetSize();
843 if ( (m_pLogger->m_outputDumpLevel) == 1 && l > 16 )
844 {
845 l = 16;
846 }
847 CStrVector vs = DumpData(l, vbBinary.ReferBuffer());
848 loop ( i, vs.GetSize() )
849 {
850 m_pLogger->m_WriteLine(fw, CAscii(vs[i]));
851 }
852 }
853 return true;
854 }
855 };
856
866 bool m_PostTraceInfo(EType type, LPCSTR lpszText, const CByteVector* pvb)
867 {
868 if ( m_isPause ) { return true; }
869 //
870 CParamWriteCmd* P = new CParamWriteCmd(this);
871 P->dwTick = ::GetTickCount();
872 P->dwThreadId = ::GetCurrentThreadId();
873 P->type = type;
874 if ( lpszText != NULL )
875 {
876 P->hasText = true;
877 P->strText = lpszText;
878 }
879 else if ( pvb != NULL )
880 {
881 P->hasText = false;
882 P->vbBinary = *pvb;
883 }
884 else
885 {
886 delete P; //メモリ開放。
887 return false;
888 }
889 ::GetLocalTime(&(P->tSysTime));
890 return m_file.Command(P);
891 }
892
894 void m_PauseMode(bool isPause)
895 {
896 m_isPause = isPause;
897 }
898
899 enum { HEADSIZE = 12 }; //ヘッダの桁数
900 bool m_isPause;
901 DWORD m_outputTypes;
902 DWORD m_maxLogSize;
903 DWORD m_maxMultiFileCount;
904 EThread m_outputThread;
905 ETime m_outputTime;
906 int m_outputDumpLevel;
907 bool m_isInitLastTick;
908 DWORD m_lastTick;
909 CFileWriter m_fw;
910 CAsyncWriter m_file;
911 INDEX m_offset;
912 CSyncSection m_sync;
913 friend class CTraceLogger::CParamWriteCmd;
914};
915
916
917#define TFUNC CTraceLogger::CFuncer _TnbFunc_
918#define TFUNC_PARAM _TnbFunc_.Param
919#define TFUNC_RESULT _TnbFunc_.Result
920
921
922
923#endif // _TnbDOXYGEN
924
925
926
927#ifdef _TnbDOXYGEN
928
929
930
959void TFUNC(LPCTSTR lpszFormatText, ...);
960
970void TFUNC_PARAM(LPCTSTR lpszFormatText, ...);
971
982void TFUNC_RESULT(LPCTSTR lpszFormatText, ...);
983
984
985
986#endif //_TnbDOXYGEN
987
988
989
998inline void TLOG_AB(LPCTSTR lpszFormatText, ...)
999{
1000 va_list args; va_start(args, lpszFormatText);
1001 CTraceLogger::Write(CTraceLogger::Type_Absolute, lpszFormatText, args);
1002}
1003
1012inline void TLOG_ERR(LPCTSTR lpszFormatText, ...)
1013{
1014 va_list args; va_start(args, lpszFormatText);
1015 CTraceLogger::Write(CTraceLogger::Type_Error, lpszFormatText, args);
1016}
1017
1026inline void TLOG_ERRDUMP(size_t size, LPCVOID P)
1027{
1028 CTraceLogger::Write(CTraceLogger::Type_Error, size, P);
1029}
1030
1038inline void TLOG_ERRDUMPV(const CByteVector& vb)
1039{
1040 CTraceLogger::Write(CTraceLogger::Type_Error, vb);
1041}
1042
1051inline void TLOG(LPCTSTR lpszFormatText, ...)
1052{
1053 va_list args; va_start(args, lpszFormatText);
1054 CTraceLogger::Write(CTraceLogger::Type_Trace, lpszFormatText, args);
1055}
1056
1065inline void TLOG_DUMP(size_t size, LPCVOID P)
1066{
1067 CTraceLogger::Write(CTraceLogger::Type_Trace, size, P);
1068}
1069
1077inline void TLOG_DUMPV(const CByteVector& vb)
1078{
1079 CTraceLogger::Write(CTraceLogger::Type_Trace, vb);
1080}
1081
1090inline void TLOG_POL(LPCTSTR lpszFormatText, ...)
1091{
1092 va_list args; va_start(args, lpszFormatText);
1093 CTraceLogger::Write(CTraceLogger::Type_Polling, lpszFormatText, args);
1094}
1095
1104inline DWORD TLASTERROR(LPCTSTR lpszFunctionName)
1105{
1106 DWORD e = ::GetLastError();
1107 if ( e != ERROR_SUCCESS )
1108 {
1109 CSimpleStr s;
1111 LPCTSTR lpszErr = s;
1112 TLOG( _T("API[%s()]失敗 ErrorCode = 0x%08x(%s)"), lpszFunctionName, e, lpszErr);
1113 }
1114 ::SetLastError(e);
1115 return e;
1116}
1117
1118#ifdef _DEBUG
1119#ifdef _GetLastError
1120#undef _GetLastError
1121#define _GetLastError(XX) TLASTERROR(_T(XX))
1122#endif
1123#endif
1124
1133#ifdef _DEBUG
1134 #define TLINE() CTraceLogger::Write(CTraceLogger::Type_Absolute, _T("** %s(%d):"), _T(__FILE__), __LINE__)
1135#else
1136 #define TLINE()
1137#endif
1138
1139
1140
1141#else //_TnbLOG_DISABLE
1142
1143 // TLOG無効用宣言
1144 #define TFUNC __noop
1145 #define TFUNC_PARAM __noop
1146 #define TFUNC_RESULT __noop
1147 #define TLOG_POL __noop
1148 #define TLOG __noop
1149 #define TLOG_DUMP __noop
1150 #define TLOG_DUMPV __noop
1151 #define TLOG_ERR __noop
1152 #define TLOG_ERRDUMP __noop
1153 #define TLOG_ERRDUMPV __noop
1154 #define TLOG_AB __noop
1155 #define TLASTERROR __noop
1156 #define TLINE()
1157
1158#endif //_TnbLOG_DISABLE
1159
1160
1161
1162#ifndef _TnbDOXYGEN //Document作成用シンボル
1163
1164// 旧バージョンに対応
1165#define TFUNC_(XX) TFUNC XX
1166#define TFUNC_PARAM_(XX) TFUNC_PARAM XX
1167#define TFUNC_RESULT_(XX) TFUNC_RESULT XX
1168#define TLOG_AB_(XX) TLOG_AB XX
1169#define TLOG_ERR_(XX) TLOG_ERR XX
1170#define TLOG_(XX) TLOG XX
1171#define TLOG_POL_(XX) TPOL XX
1172
1173#endif
1174
1175
1176
1177}; // TNB
1178
非同期書込み処理関係のヘッダ
#define loop_dn(VAR, CNT)
loop構文.
Definition: TnbDef.h:355
#define _BIT(X)
BIT演算
Definition: TnbDef.h:307
#define loop(VAR, CNT)
loop構文.
Definition: TnbDef.h:343
開発用に、メモリの状態を文字列にする関数があります。
ファイル関係のヘッダ
iniファイルアクセス関係のヘッダ
シングルトン関係のヘッダ
文字列処理関係のヘッダ
非同期書き込みクラス
ファイル書き込みクラス
Definition: TnbFile.h:475
iniファイルアクセスクラス
簡易文字列管理クラス.
Definition: TnbDef.h:772
INT_PTR ReverseFind(TYP t) const
[確認] 検索(後ろから)
Definition: TnbStr.h:575
void FormatV(const TYP *lpszFormat, va_list V)
[代入] 書式付き文字列代入.
Definition: TnbStr.h:349
bool IsEmpty(void) const
[確認] 空チェック
Definition: TnbStr.h:528
CStrT Left(size_t iSize) const
[作成] 範囲取得.
Definition: TnbStr.h:801
void ReleaseBuffer(void)
[操作] 割り当てたバッファを開放.
Definition: TnbStr.h:954
static CStrT Fmt(const TCHAR *lpszFormat,...)
[作成] 書式付き文字列作成
Definition: TnbStr.h:1206
INT_PTR Find(TYP t, INDEX iFromIndex=0) const
[確認] 検索.
Definition: TnbStr.h:540
CStrT FindCut(TYP c, CStrT *_pstrRest=NULL) const
[作成] 切り分け
Definition: TnbStr.h:1122
void Format(const TYP *lpszFormat,...)
[代入] 書式付き文字列代入.
Definition: TnbStr.h:359
TYP * GetBuffer(size_t iLength=0)
[操作] 書き込みバッファ要求.
Definition: TnbStr.h:914
Section排他管理クラス
Definition: TnbSync.h:125
例外ベースクラス
Definition: TnbException.h:36
void OnCatch(void) const
[表示] 内容表示
Definition: TnbException.h:69
virtual size_t GetSize(void) const
[取得] サイズ取得
Definition: TnbVector.h:368
virtual const TYP * ReferBuffer(void) const
[取得] データアドレス取得
Definition: TnbVector.h:664
virtual INDEX Add(const TYP &t)
[追加] 要素一つ追加.
Definition: TnbVector.h:383
virtual size_t SetElements(size_t size, const TYP *P=NULL)
[設定] 複数要素設定.
Definition: TnbVector.h:526
セクション情報アクセスクラス
Definition: TnbAccessor.h:294
CStr QueryString(LPCTSTR lpszKey, LPCTSTR lpszDefault=NULL) const
[取得] 文字列情報取得
Definition: TnbAccessor.h:506
DWORD QueryDword(LPCTSTR lpszKey, DWORD dwDefault=0) const
[取得] 数値情報取得
Definition: TnbAccessor.h:587
#define SINGLETON_CONSTRUCTOR(CLS)
シングルトン作成マクロ
Definition: TnbSingleton.h:60
CStrVector DumpData(size_t size, const void *pData, bool canAllDump=true, size_t width=16, bool isUnicode=false)
[作成] バイナリダンプ用文字配列作成.
Definition: TnbDump.h:35
void TLOG(LPCTSTR lpszFormatText,...)
トレース出力ログ.
void TLOG_DUMP(size_t size, LPCVOID P)
トレース出力ダンプログ.
void TLOG_AB(LPCTSTR lpszFormatText,...)
絶対出力ログ.
void TFUNC(LPCTSTR lpszFormatText,...)
関数ログ.
void TLOG_POL(LPCTSTR lpszFormatText,...)
ポーリング出力ログ.
void TLOG_ERRDUMP(size_t size, LPCVOID P)
エラー出力ダンプログ.
void TLOG_ERRDUMPV(const CByteVector &vb)
エラー出力ダンプログ.
DWORD TLASTERROR(LPCTSTR lpszFunctionName)
LastError出力ログ.
void TLOG_DUMPV(const CByteVector &vb)
トレース出力ダンプログ.
void TLOG_ERR(LPCTSTR lpszFormatText,...)
エラー出力ログ.
void TFUNC_RESULT(LPCTSTR lpszFormatText,...)
リザルトログ.
void TFUNC_PARAM(LPCTSTR lpszFormatText,...)
追加引数ログ.
CStr GetComputerName(void)
[取得] PC名取得
Definition: TnbStrEx.h:35
size_t GetLen(LPCSTR lpsz)
[計算] 文字列長計算(ASCII/SJIS用)
Definition: TnbStrLib.h:44
TNB::CStrT< char > CAscii
ASCII文字列クラス
Definition: TnbStr.h:1758
DWORD ToDword(LPCSTR lpsz, int iBase=10)
[変換] INT変換(ASCII/SJIS用).
Definition: TnbStrLib.h:395
TNB::CStrT< TCHAR > CStr
文字列クラス
Definition: TnbStr.h:1785
CStr GetProcessPath(void)
[取得] プロセスのパス取得.
Definition: TnbStrEx.h:57
void SystemErrorToMessageText(CSimpleStr &_str, DWORD dwError)
[変換] SystemErrorコード文字列化.
Definition: TnbDef.h:981
#define EXCLUSIVE(CLS)
簡易排他制御マクロ.
Definition: TnbSync.h:788
TNB Library
Definition: TnbDoxyTitle.txt:2
システムタイム型.
Definition: TnbTime.h:876
WORD wYear
Definition: TnbTime.h:877
WORD wSecond
Definition: TnbTime.h:883
WORD wMilliseconds
ミリ秒
Definition: TnbTime.h:884
WORD wMonth
Definition: TnbTime.h:878
WORD wHour
Definition: TnbTime.h:881
WORD wDay
Definition: TnbTime.h:880
WORD wMinute
Definition: TnbTime.h:882
非同期書き込みのコマンドインターフェース
virtual LONGLONG Seek(LONGLONG llOffset, ESeekMode eSeek=TOP) const =0
[操作] シーク.
書き込みインターフェース
Definition: TnbWriter.h:36
virtual bool CanWrite(void) const =0
[確認] 書込み可能か
virtual void Write(size_t size, LPCVOID P)=0
[保存] 書き込み