반응형

개발관련/C&C++ 16

FileLogger

code : https://github.com/EomTaeWook/Cpp-Util/tree/master/Util/Logger C#처럼 Parallel 환경 테스트가 안되어서 싱글쓰레드 테스트 Default Message 입력된 시간으로 정렬됨. 2번째 인자로 시간을 넘겨주면 시간 순대로 정렬 사용예제 1000000개 11초 걸림 int count = 0;auto now = std::chrono::system_clock::now();try{while (count++ < 5){for (int i = 0; i < 200000; i++){auto now = std::chrono::system_clock::now();auto second = std::chrono::duration_cast(now.time_sinc..

개발관련/C&C++ 2018.10.02

반복자(iterator)가 포함된 Queue

code : https://github.com/EomTaeWook/Cpp-Util/blob/master/Util/Collections/Queue.h std::find 로 Queue 안에 데이터를 찾기 위해 반복자가 포함된 Queue를 만듦 릴리즈 모드 => STL Queue랑 비교시 조금 빠르다. std::chrono::duration stlQueueSec;Queue uq;std::queue q;std::chrono::duration utilQueueSec;{std::chrono::system_clock::time_point start = std::chrono::system_clock::now();for (int i = 0; i < 10000000; i++)uq.Push(TEMP(i));while (!u..

개발관련/C&C++ 2018.09.08

MSMQ(MS MessageQueue)

code : https://github.com/EomTaeWook/Cpp-Util/tree/master/Util/System/Message C#은 워낙 API가 잘되어 있어서 사용법이 간단함. Receive 동기적 Receive 쪽은 C#은 10만건 1700byte를 전체 Read 하는데 6초 정도 걸리고 C++은 3초 후반대 정도임.Send 쪽은 C# 10만건 1700byte 4초, C++ 1.7초... API와 사용법을 좀 더 찾아보고 다른 MQ 속도도 비교해보고 속도 개선 해봐야 할 듯 C#>> namespace MSMQ{ //Send {00:00:04.3840442} //Receive {00:00:05.5640045} //한글 690 자 1700 byte class Program { static ..

개발관련/C&C++ 2018.05.15

Functional 이용한 델리게이트

C++용 소켓 서버/클라이언트 콜백 메소드를 담기위해 만듦. 모든 델리게이터는 MulticastDelegate로만 생성 하거나 상속 NS.h #pragma once#ifndef COMMON_H#define COMMON_H#define NS_COMMON_BEGIN namespace Util { namespace Common {#define NS_COMMON_END } }#define USING_COMMON using namespace Util::Common;#endif Delegate.h #pragma once#include "NS.h"#include #include NS_COMMON_BEGINtemplateclass MulticastDelegate; templateclass Delegate{private..

개발관련/C&C++ 2018.04.26

StringFormat

C# StringFormat 처럼 짜려다가 가변인자 타입 자체를 확인을 못함.어쩔수 없이 출력 형식로 확인 code : https://github.com/EomTaeWook/Cpp-Util/tree/master/Util/Common 사용법자리수까지 구현은 했으나 별로...printf("%s",Common::String::Format("%lf %s", 10.0, "test").c_str()); ※ 장점은 출력 형식을 내맘대로 정할수 있다는 점이지만 vsnprintf로 구현하는게 속 편할듯 NS.h #pragma once#ifndef COMMON_H#define COMMON_H#define NS_COMMON_BEGIN namespace Common {#define NS_COMMON_END }#define U..

개발관련/C&C++ 2018.03.20

라이브러리 빌드 전/후 이벤트 명령어

Header 파일과 Lib파일 출력 폴더에 복사 빌드 전 이벤트 : IF NOT EXIST "$(SolutionDir)$(Configuration)\$(PlatformTarget)\include" (mkdir "$(SolutionDir)$(Configuration)\$(PlatformTarget)\include") 빌드 후 이벤트 : IF NOT EXIST "$(SolutionDir)$(Configuration)\$(PlatformTarget)\include" (mkdir "$(SolutionDir)$(Configuration)\$(PlatformTarget)\include")xcopy /S/Y "$(ProjectDir)*.h" "$(SolutionDir)$(Configuration)\$(Platform..

개발관련/C&C++ 2018.03.16

C#처럼 이벤트 처리

CEF 재작업중.. CEF 콜백에 대한 처리를 Event Bind 형식이 더 편할 것 같은 느낌이라 C# Event처럼 구현함. template이라 Cpp 파일은 없음. 내부적으로 Delegate리스트는 unique_ptr 을 사용함. 사용법이벤트 객체class test{public:Util::Event LoadingState;} 이벤트 구독//void* sender 타입 고정//bool* e 인 경우 Genericvoid CLauncherDlg::OnLoadingStateChange(void* sender, bool* e){//.....}BOOL CLauncherDlg::OnInitDialog(){//안에서만 namespace 사용{using namespace std::placeholders;handl..

개발관련/C&C++ 2018.02.27
반응형