포트폴리오 만들기

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점

Roka_is_back 2024. 1. 17.

1.ScriptReLoad 감지 Console Test Code

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 1.ScriptReLoad 감지 Console Test Code

 

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 1.ScriptReLoad 감지 Console Test Code
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 1.ScriptReLoad 감지 Console Test Code
감지 잘 된다.

 

2. Map 변경점

Map Find 매개인자 변경

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - Map Find 매개인자 변경
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - Map Find 매개인자 변경
기존 함수 선언
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - Map Find 매개인자 변경
변경된 함수 선언

 

Key 값에 따라 const 가 붙어줬으면 했다.

예를 들어 T == int => const int

                T == int*=> const int* const

문제는 * 의 경우 const int* 가 아닌 int* const가 된다. (T에 대한 const 라 주소를 const 한듯.)

예전에 봤던 타입 추론에 대한 내용이 가물 가물 해서 그 부분과 헷갈렸다.

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - Map Find 매개인자 변경
예제1
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - Map Find 매개인자 변경
예제2

예제 1의 경우 class 객체를 선언할때 T 가 정해진다.

이 상태에서 const 를 붙이면 T = TCHAR* => const T = TCHAR* const 가 되는 것.

TCHAR 주소를 const 시키는게 된다.

 

예제 2의 경우도 const TCHAR* 에 대한 const가 붙기 때문에 const TCHAR* const가 된다.

 

결론

const TCHAR* const& 가 되길 바라면

1. 매개 인자는 const T& arg

2. template 객체 선언시 const TCHAR* 로 선언. 

템플릿 형식 연역 - 타입 추론

https://ramingstudy.tistory.com/58

 

map inner clear 시 const char 도 delete[] 로 처리.

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - map inner clear 시 const char 도 delete[] 로 처리.
기존 코드
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - map inner clear 시 const char 도 delete[] 로 처리.
바뀐 코드

innerDelete 를 하겠다고 되어 있으면 const char* 도 동적 할당됐다고 판단하여 delete[] 하도록 했다.

생각해보면 const char* ch = new char[10]("test"); 와 같이 된 경우도 삭제될 수 있어야 하기 때문에 이렇게 하는게 옳다고 생각한다.

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - map inner clear 시 const char 도 delete[] 로 처리.
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 2. Map 변경점 - map inner clear 시 const char 도 delete[] 로 처리.

3.MemoryPool 변경점

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 3.MemoryPool 변경점

위의 맵 변경점 이후

RBT 선언때는 key 값을 size_t 로 해놓고 저 함수에서는 int로 써져 있는 상태라 에러가 발생했다.

자료형을 size_t로 맞춰줘서 해결.

 

4.CRKEngine 변경점

Engine Dll 에 FileManager 등록.

 main 프로젝트에서 생성한 instance는 dll에 공유되지 않기 때문에 dll에 등록해서 사용해야 한다.

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - Engine Dll 에 FileManager 등록.
Engine Project  CRKEngine
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - Engine Dll 에 FileManager 등록.
Roka Project(Main) MainManager

CScriptReLoad 객체 생성

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - CScriptReLoad 객체 생성
CScriptReLoad 생성자에 this를 넘겨주고 있다. 자세한건 해당 class 설명에서 말함.

ScriptMonitor 함수에서 CScriptReLoad 객체 호출

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - ScriptMonitor 함수에서 CScriptReLoad 객체 호출

 

결과

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - ScriptMonitor 함수에서 CScriptReLoad 객체 호출 - 결과
변화 감지를 위해 일부러 초기 타임 스탬프 값을 변경했다.
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 4.CRKEngine 변경점 - ScriptMonitor 함수에서 CScriptReLoad 객체 호출 - 결과
잘 걸리는걸 볼 수 있다.

 

5.ScriptReLoad Class 생성

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 5.ScriptReLoad Class 생성
.h
13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 5.ScriptReLoad Class 생성
생성과 동시에 정보를 설정해둔다.

Main Project에서 받아온 FileManager Instance가 필요하기 때문에 CRKEngine을 참조하고 있다.

 

TimeStempMonitor()

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 5.ScriptReLoad Class 생성 - TimeStempMonitor()

마우스 포커스 아웃-인 됐을 때 Script들의 Time Stemp 변화를 감지하여 bool 값을 리턴한다.

 

관계도

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 5.ScriptReLoad Class 생성 - 관계도

CScriptReLoad 는 CRKEngine을 참조하고(Association), 

CRKEngine 은 CScriptReLoad를 포함하며 생명주기가 동일하다.(Composition)

 

6.FileManager 변경점

13.ConsoleTestCode/Map변경점/CRKEngine변경점/CScriptReLoad Class 생성/FileManager 변경점 - 6.FileManager 변경점

특정 경로의 특정 확장자를 가진 파일들의 TimeStemp를 읽을수 있도록 함수를 구현하였다.

댓글