1 / 52

DPD-Tool & TMO

DPD-Tool & TMO. 2007. 1. 5 안 동 인. 목 차. 연구 배경 연구 필요성 DPD-Tool 의 설계 및 구현 분산객체그룹 프레임워크 기반의 DPD-Tool 구성요소 설계 GUI 환경 구현 DPD-Tool 을 이용한 분산응용 분산응용 개발절차 DPD-Tool 설치 및 실행 사칙연산 TMO 소개 개념 및 구조 , 특성 TMO 설정 프로젝트 속성 설정 config.ini TMO 프로그래밍 방법 TMO 선언 및 등록 TMO 예제

vail
Download Presentation

DPD-Tool & TMO

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DPD-Tool & TMO 2007. 1. 5 안 동 인

  2. 목 차 • 연구 배경 • 연구 필요성 • DPD-Tool의 설계 및 구현 • 분산객체그룹 프레임워크 기반의 DPD-Tool • 구성요소 설계 • GUI 환경 구현 • DPD-Tool을 이용한 분산응용 • 분산응용 개발절차 • DPD-Tool 설치 및 실행 • 사칙연산 • TMO 소개 • 개념 및 구조, 특성 • TMO 설정 • 프로젝트 속성 설정 • config.ini • TMO 프로그래밍 방법 • TMO 선언 및 등록 • TMO 예제 • Appendix C (one_node, two_node)

  3. 연구 배경 • 분산객체그룹 프레임워크  간편한 적용 필요 • 효율적인 분산객체 관리 기술 • 객체 그룹 • 다양한 분산서비스 지원 • 네이밍, 동적 바인딩, 다중복 객체 지원 서비스 • 실시간 서비스 지원 • 프레임워크의 지원기능을 DLL로 개별적으로 호출 • 분산객체그룹 프레임워크 기반의 분산 프로그래밍 개발 툴(Distributed Programming Developing Tool, DPD-Tool) • GUI환경에서 분산객체그룹 프레임워크 서비스를 편리하게 제공.

  4. 연구 필요성 • 분산응용의 편리한 개발 환경 지원 • 분산객체의 편리한 인터페이스 확인 • 다양한 분산서비스 제공 • 독립적인 분산응용 개발 환경 지원 Distributed Programming Developing Tool Distributed Object Group Framework Distributed Object User Interface User Model Presentation Model Conceptual Model Research Area Human Factors Language Architecture

  5. DPD-Tool의 설계 및 구현 • 분산객체그룹 프레임워크 기반의 DPD-Tool

  6. 분산객체그룹 프레임워크 기반의 DPD-Tool • 이종의 응용 프로그래밍 언어와 분산 미들웨어에 독립적인 환경에서 분산응용 프로그램을 개발가능 Distributed Application C C++ Java DPD-Tool DPD-Tool DPD-Tool CORBA TMOSM Java-ORB

  7. 구성요소 설계 • 분산객체그룹 프레임워크의 기능들을 편리하게 제공할 수 있도록 3개의 모듈로 설계 • 객체그룹 운영자 모듈 • 전체적인 수행환경을 관리 • 신뢰할 수 있는 서버 개발자와 클라이언트 개발자들에게 객체그룹을 사용할 권한을 부여 • 그룹별 동적 바인딩 알고리즘을 설정 • 서버 프로그램 개발자 모듈 • 서버 프로그램 개발자 자신들이 구현한 서버 객체들의 그룹 등록 및 철회. • 클라이언트 개발자의 서버 객체 사용 요청에 대한 접근권한 설정. • 클라이언트 프로그램 개발자 모듈 • 서비스 검색 및 접근권한 요청. • 접근이 허가된 서비스들의 그룹 재구성.

  8. GUI 환경 구현 (1/3) • 각 모듈에 따른 GUI 환경 제공 • 객체그룹 운영자 GUI ① : 분산응용들의 구성요소인 서버객체들의 제공서비스에 따라 그룹별로 등록된 DOGF의 객체정보저장소 내의 정보를. ② : 객체그룹 내에 중복객체들 중 서비스 수행에 적절한 객체를 선택하여 동적으로 바인딩 하기 위한 알고리즘을 적용. ③ : 현재 DOGF 내의 분산응용의 그룹관리를 위한 설정 및 상태 정보 표시.

  9. GUI 환경 구현 (2/3) • 서버 프로그램 개발자 GUI ① : 서버객체들이 제공하는 서비스에 따라 그룹별로 관리되고 있는 객체그룹 정보를 확인. ② : 클라이언트로부터 접수된 서버객체에 대한 접근권한 허가요청 목록을 확인하고, 접근권한을 설정. ③ : 개발된 서버객체들을 그룹으로 등록하거나 수정 및 삭제. ④ : DOGF의 그룹설정 및 상태 정보 표시.

  10. GUI 환경 구현 (3/3) • 클라이언트 프로그램 개발자 GUI ① : DOGF에 등록된 서버객체들을 검색하고, 사용할 서버객체에 대한 접근권한을 서버 개발자에게 요청. 접근권한이 부여된 서버객체들은 클라이언트 개발자가 새로운 그룹으로 재구성. ② : 클라이언트 개발자 시스템 내의 프로그램 에디터를 사용할 수 있도록 링크. ③ : 접근권한이 허가된 서버객체들로 재구성된 그룹을 보임. ④ : DOGF의 그룹설정 및 상태 정보 표시.

  11. DOGF OBJECT GROUP ADMINISTRATOR GUI DPD-Tool을 이용한 분산응용 • 분산응용 개발절차 • Step 1: 서버 프로그램 개발자는 클라이언트로부터 요청을 받을 수 있는 서버 프로그램을 개발한 후, 서버 프로그램 개발자 GUI를 이용해 객체그룹에 서버 프로그램을 등록. • Step 2: 클라이언트 프로그램 개발자는 객체그룹에 등록된 전체 서버 프로그램에서 자신이 사용할 서버 프로그램들을 선정한 후 접근권한을 요청. • Step 3: 서버 개발자로부터 접근권한을 허가받고 그룹을 재구성한 후 서비스를 요청하는 클라이언트 프로그램을 개발. • Step 4: 서버 및 클라이언트 프로그램 수행 시 클라이언트 프로그램은 분산객체그룹 프레임워크에게 자신이 이용할 서버의 속성정보를 요청 후 반환 • Step 5: 서버 프로그램에 접속하여 서비스를 이용. Step 4 Step 3 SERVER PROGRAM SERVER PROGRAM DEVELOPER GUI CLIENT PROGRAM DEVELOPER GUI CLIENT PROGRAM Step 1 Step 2 Step 5

  12. DPD-Tool 설치 및 실행 • DPD-Tool v0.43.zip 압축을 해제 • Admin.exe 는 관리 컴퓨터에서 실행 • Server.exe 는 서버 개발자 컴퓨터에서 실행 • Client.exe 는 클라이언트 개발자 컴퓨터에서 실행 • 실행하는 PC에 Visual Studio 설치가 안되었을 경우 압축 파일에 동봉된 DLL 파일도 실행파일(확장자 exe)과 함께 가지고 있어야 함. • 차후 자동 설치 할 수 있는 배포판 개발 예정. • DPD-Tool v0.43 실행 • Admin 실행  포트번호 설정 후 ‘Connect’ 버튼 클릭 • Server 실행 • 아이디, 패스워드 입력. • 객체그룹 생성 및 객체 등록 • Client 실행 • 아이디, 패스워드 입력. • 서비스 검색 및 접근권한 요청. • Server  등록한 객체에 대한 클라이언트의 접근권한 요청 처리 • Client  허가된 서비스를 이용하여 클라이언트 프로그램 작성

  13. 사칙연산 (1/4) • 개발 절차 서버 개발자 클라이언트 개발자 Add_TMO1 Add_TMO2 Add_TMO3 Subtract_TMO Multiple_TMO Divide_TMO 서버 객체 구현 (add, subtract, multiple, divide) 서버 객체 등록 (Operator 그룹 생성) 등록된 서비스 검색 (add, subtract, multiple, divide) 서비스 접근권한 요청 (add, subtract, multiple, divide) 클라이언트 접근권한 요청 처리 (add, subtract, multiple만 허가) 그룹 재구성 (Operator 그룹, divide 제외) 클라이언트 객체 구현 (Client) Client_TMO 분산응용 실행 (add, subtract, multiple) 분산응용 실행 (Client)

  14. 사칙연산 (2/4) • 분산 응용의 4개의 연산자(add(), subtract(), multiple(), divide())는 DOGF에 그룹(Operator)으로 등록되었음. • Client_TMO add() 서비스를 DOGF에 요청(Add_TMO1, Add_TMO2, Add_TMO3 중 선택) System A System B

  15. 사칙연산 (3/4) • 실행 결과

  16. 사칙연산 (4/4) • DPD-Tool 매뉴얼 ‘사칙연산’ 소스 참조 • 서버 객체 • Add_TMO1,2,3 • Subtract_TMO • Multiple_TMO • Divide_TMO • 클라이언트 객체 • Client_TMO

  17. TMO 소개 • TMO 개념 • Time-triggered Message-triggered Object • 기존 객체 모델에 대한 확장으로 객체 자체적인 실시간 특성에 따라 동작하는 실시간 객체 • 기존 객체는 클라이언트의 서비스 요청 메시지에 의해 동작하지만, TMO는 기존 객체 특성에 자치적인 동작 추가 • TMO 구조 • ODS(Object Data Store) • EAC(Environment Access Capability) • AAC(Autonomous Activation Condition) • SpMs(Spontaneous Methods) • SvMs(Service Methods) • TMO 특성 • 분산 컴퓨팅 컴포넌트 • SpM과 SvM • Basic Concurrency Constraint(BCC) • 모든 TMO 객체의 메소드에 마감시간 부여

  18. TMO 설정 (1/6) • TMO 사용환경. • Windows XP/2000/NT/CE  Visual Studio .NET 2003 • Linux • TMOSL의 Appendix G에 설정 방법 소개. • Appendix G 단점 – 불편하다. • 프로젝트 설정 시 라이브러리 등 모든 경로가 절대 경로로 잡힘. • TMO 지원 라이브러리의 위치가 변경될 경우, • 프로젝트 속성 재설정. • TMO 프로그램을 다른 컴퓨터로 옮길 경우, • 해당 컴퓨터에 설치된 TMO 지원 라이브러리 위치로 프로젝트 속성 재설정. • 새로운 설정 방법 • 상대 경로 이용.

  19. TMO 설정 (2/6) • 새 프로젝트 생성 • 새 프로젝트  Visual C++ 프로젝트  Win32 콘솔 프로젝트 • 응용 프로그램 설정  빈 프로젝트 체크 • 빌드 실행 (Debug 폴더 생성됨)

  20. TMO 설정 (3/6) • 라이브러리 파일  생성된 Debug 폴더로 복사 • config.ini • msvcp71d.dll • msvcr71d.dll • TMOSL.dll • TMOSL.h • TMOSL.lib • 프로젝트 속성 설정 • 소스 파일에 cpp 파일 추가 • 속성 설정을 위해 최소 하나 필요 • 프로젝트 명 오른쪽 버튼 클릭  속성 선택

  21. TMO 설정 (4/6) • 디버깅  작업 디렉터리 • ./Debug • C/C++  일반  추가 포함 디렉터리 • ./Debug • C/C++  전처리기  전처리기 정의 • 클릭 후 UNICODE;_UNICODE입력 • C/C++  코드 생성  런타임 라이브러리 • 다중 스레드 디버그 DLL (/MDd)선택 • 링커  일반  추가 라이브러리 디렉터리 • ./Debug • 링커  입력  추가 종속성 • TMOSL.lib • 확인 버튼 클릭

  22. TMO 설정 (5/6) • 기타 사항 • TMO에서 소켓 사용 시 ‘링커명령줄추가옵션’ 에 ‘ws2_32.lib’ 입력 • TMO 라이브러리를 이용한 객체 선언 시 상단에 아래 소스 추가 • 예) TMO 선언부, RMMC 선언부, ODSS 선언부 • 뒤에 소스에서 확인. #include "TMOSL.h" #pragma comment(lib, "TMOSL") using namespace TMO;

  23. TMO 설정 (6/6) • config.ini 파일 설정 • ip_addr = 서버 IP 입력 • local_ip = 로컬 IP 입력 • num_of_DC_nodes = 분산 노드 개수 • num_of_links = 분산 노드 개수 • (본인 IP, 본인 IP) = 0 • (본인 IP, 분산 노드 IP) = 0 • … < 분산 노드 개수 만큼 > • (본인 IP, 분산 노드 IP) = 0 서버 IP 로컬 IP 분산 노드 개수

  24. TMO 프로그래밍 방법 (1/5) • main() 함수에서 TMO 인스턴스 생성 void main() { StartTMOengine (); tms TMO_start_time1 = tm4_DCS_age(3*1000*1000); Ahn_TMO Ahn(_T("Ahn_TMO"),_T("Ahn_SvM"), _T("RMMC1"), TMO_start_time1); MainThrSleep (); } <출처 : TMOSL Manual>

  25. TMO 프로그래밍 방법 (2/5) • TMO 선언 및 등록 class Ahn_TMO: public CTMOBase { public: Ahn_TMO (TCHAR * TMO_name, TCHAR * SvM_name, TCHAR * RMMC_name, tms TMO_start_time); private: Ahn_ODSS ODSS1; int Ahn_SpM(); int Ahn_SvM(ParamStruct *); // SvM to be trigger by a SvM Parameter Message CRMMC RMMC1; }; < 클래스 : TMO 선언 > Ahn_TMO::Ahn_TMO(TCHAR * TMO_name, TCHAR * SvM_name, TCHAR * RMMC_name, tms TMO_start_time):RMMC1(RMMC_name, SvM_name) { // register SvM … // register SpM … // register TMO … } < 생성자 : TMO 등록 >

  26. TMO 프로그래밍 방법 (3/5) • register SvM // register SvM SvM_RegistParam svm_spec; svm_spec.GETB = 20 * 1000; _tcscpy(svm_spec.name, SvM_name); svm_spec.build_regist_info_ODSS(RMMC1.GetId(), RW); svm_spec.build_regist_info_ODSS(ODSS1.GetId(), RW); RegisterSvM((PFSvMBody)Ahn_SvM, &svm_spec);

  27. TMO 프로그래밍 방법 (4/5) • register SpM // register SpM SpM_RegistParam spm_spec; MicroSec from = 4 * 1000 * 1000; MicroSec until = 1 * 60 * 60; until *= 1000 * 1000; MicroSec every = 1 * 1000 * 1000; MicroSec est = 0; MicroSec lst = 150 * 1000; MicroSec by = 400 * 1000; AAC aac_spec(_T(""), tm4_DCS_age(from), tm4_DCS_age(until), every, est, lst, by); spm_spec.build_regist_info_AAC(aac_spec); spm_spec.build_regist_info_ODSS(RMMC1.GetId(), RW); spm_spec.build_regist_info_ODSS(ODSS1.GetId(), RW); RegisterSpM((PFSpMBody)Ahn_SpM, &spm_spec);

  28. TMO 프로그래밍 방법 (5/5) • register TMO // register TMO TMO_RegistParam tmo_spec; _tcscpy(tmo_spec.global_name, TMO_name); tmo_spec.start_time = TMO_start_time; RegisterTMO(&tmo_spec);

  29. TMO 예제 (1/24) • TMOSL의 Appendix C 예제 • one_node 예제

  30. TMO 예제 (2/24) • TestODSS.h #ifndef TESTODSS_H #define TESTODSS_H #include "TMOSL.h" #pragma comment(lib, "TMOSL") using namespace TMO; class ODSSClass1:public ODSSBaseClass <ODSSClass1> { public: int Count; ODSSClass1() {Count = 0; } }; typedef struct { TCHAR name[80]; MicroSec system_age; } ParamStruct_TMO1class_SvM; // Dummy parameter #endif //************************************************************************ // end of TestODSS.h //************************************************************************

  31. TMO 예제 (3/24) • TestTMO.h #ifndef TESTTMO_H #define TESTTMO_H #include "TestODSS.h" #include "TMOSL.h" #pragma comment(lib, "TMOSL") using namespace TMO; class TMO1: public CTMOBase { private: SvMGateClass gate1; ODSSClass1 ODSS1; int SpM1(); int SvM1(ParamStruct_TMO1class_SvM *); public: TMO1(TCHAR *, TCHAR *, AAC &, TCHAR *, TCHAR *, tms, tms); }; #endif //************************************************************************ // end of TestTMO.h //************************************************************************

  32. TMO 예제 (4/24) • TestTMO.cpp (1/4) #include "TestTMO.h" int TMO1::SpM1() { tmsp Timestamp; int count; MicroSec system_age; ParamStruct_TMO1class_SvM SvMPara; // SpM started TMOSLprintf(_T("<SpM Started>\n")); // SpM print out ODSS1 Counter value and Current System Age count = ODSS1.Count; system_age = GetCurrentDCSage(); TMOSLprintf(_T("<SpM> count: %d, System Age: %I64d\n"), count, system_age); // Call SvM1 through gate1 with dummy parameter _tcscpy(SvMPara.name, _T("SpM1 of TMO1 --> SvM1 of TMO1")); SvMPara.system_age = GetCurrentDCSage(); gate1.OnewaySR(&SvMPara, sizeof(SvMPara), Timestamp); return TRUE; // End SpM }

  33. TMO 예제 (5/24) • TestTMO.cpp (2/4) int TMO1::SvM1(ParamStruct_TMO1class_SvM * pReq) { MicroSec old_value = pReq->system_age; TMOSLprintf(_T("SvM1 (%d) is invoked, the client age is %I64d, server age is %I64d !\n"), GetCurrentThreadId(), old_value, pReq->system_age = GetCurrentDCSage()); ODSS1.Count++; return TRUE; }

  34. TMO 예제 (6/24) • TestTMO.cpp (3/4) TMO1::TMO1(TCHAR * TMO_external_name, TCHAR * SvM_external_name, AAC & aac_spec, TCHAR * ServerTMO_name, TCHAR * ServerSvM_name, tms gate_start_time1, tms TMO_start_time1):gate1(ServerTMO_name, ServerSvM_name, gate_start_time1) { // register SvM SvM_RegistParam svm_spec; svm_spec.GETB = 20 * 1000; _tcscpy(svm_spec.name, SvM_external_name); svm_spec.build_regist_info_ODSS(ODSS1.GetId(), RO); RegisterSvM((PFSvMBody)SvM1, &svm_spec); // register SpM SpM_RegistParam spm_spec; spm_spec.build_regist_info_AAC(aac_spec); spm_spec.build_regist_info_ODSS(ODSS1.GetId(), RW); RegisterSpM((PFSpMBody)SpM1, &spm_spec); // register TMO TMO_RegistParam tmo_spec; _tcscpy(tmo_spec.global_name, TMO_external_name); tmo_spec.start_time = TMO_start_time1; RegisterTMO(&tmo_spec); }

  35. TMO 예제 (7/24) • TestTMO.cpp (4/4) int main() { StartTMOengine(); tms TMO_start_time0 = tm4_DCS_age(2*1000*1000); tms gate_start_time0 = tm4_DCS_age(3*1000*1000); // Sometimes need to decompose assignment of microsecond-based time value // because MS compiler limits constant to 32 bits. MicroSec from = 5; from *= 1000 * 1000; MicroSec until = 2 * 60 * 60;until *= 1000 * 1000; MicroSec every = 1 * 1000 * 1000; MicroSec est = 0; MicroSec lst = 5 * 1000; MicroSec by = 100 * 1000; AAC aac1(_T(""), tm4_DCS_age(from), tm4_DCS_age(until), every, est, lst,by); TMO1 T1(_T("TMO1"), _T("SvM1"), aac1, _T("TMO1"), _T("SvM1"), gate_start_time0, TMO_start_time0); MainThrSleep(); return TRUE; } //************************************************************************ // end of TestTMO.cpp //************************************************************************

  36. TMO 예제 (8/24) • config.ini 파일 수정 서버 IP 로컬 IP 분산 노드 개수

  37. TMO 예제 (9/24) • 실행 결과

  38. TMO 예제 (10/24) • two_node 예제

  39. TMO 예제 (11/24) • TestODSS1.h #ifndef TESTODSS1_H #define TESTODSS1_H #include "TMOSL.h" #pragma comment(lib, "TMOSL") using namespace TMO; class ODSSClass1:public ODSSBaseClass <ODSSClass1> { public: int Count; ODSSClass1():Count(0){} }; typedef struct { int count; } ParamStruct_TMO1class_SvM1; typedef struct { MicroSec system_age; } ParamStruct_TMO2class_SvM2; #endif //********************************** // end of TestODSS1.h //**********************************

  40. TMO 예제 (12/24) • TestTMO1.h #ifndef TESTTMO1_H #define TESTTMO1_H #include "TestODSS1.h" #include "TMOSL.h" #pragma comment(lib, "TMOSL") using namespace TMO; class TMO1: public CTMOBase { public: TMO1(TCHAR *, TCHAR *, AAC&, TCHAR *, TCHAR *, tms, tms); private: ODSSClass1 ODSS1; SvMGateClass gate1; int SpM1(); int SvM1(ParamStruct_TMO1class_SvM1 * param); }; #endif //********************************** // end of TestTMO1.h //**********************************

  41. TMO 예제 (13/24) • TestTMO1.cpp (1/4) #include "TestTMO1.h" int TMO1::SpM1() { tmsp Timestamp; int count; MicroSec system_age, system_age_again; ParamStruct_TMO2class_SvM2 SvM2Para; // SpM started TMOSLprintf(_T("SpM Started \n")); // Get and print out Counter and // current System Age count = ODSS1.Count ; system_age = GetCurrentDCSage(); TMOSLprintf(_T("%d:: System Age : %I64d\n"), count, system_age); // Call TMO2 SvM1 to get TMO2 System Age. gate1.NonBlockingSR(&SvM2Para, sizeof(SvM2Para), Timestamp); // You might do something here gate1.BlockingGetResultOfNonBlockingSR(Timestamp, 70000); // Print out TMO2 System Age and // Current System Age system_age_again = GetCurrentDCSage(); TMOSLprintf(_T("TMO2 System Age : %I64d\n"), SvM2Para.system_age); TMOSLprintf(_T("Curt System Age : %I64d + %I64d = %I64d\n"), system_age, system_age_again - system_age, system_age_again); return TRUE; }

  42. TMO 예제 (14/24) • TestTMO1.cpp (2/4) int TMO1::SvM1(ParamStruct_TMO1class_SvM1 * pReq) { int count; // SvM started TMOSLprintf(_T("SvM1 Started\n")); // Receive Service Request and // return Counter value count = ODSS1.Count ; pReq->count = count; // Increment Counter ODSS1.Count = ++count ; return TRUE; }

  43. TMO 예제 (15/24) • TestTMO1.cpp (3/4) TMO1::TMO1(TCHAR * TMO_external_name, TCHAR * SvM_external_name, AAC & aac_spec, TCHAR * ServerTMO_name, TCHAR * ServerSvM_name, tms gate_start_time1, tms TMO_start_time1):gate1(ServerTMO_name, ServerSvM_name, gate_start_time1) { // register SvM SvM_RegistParam svm_spec; svm_spec.GETB = 20 * 1000; _tcscpy(svm_spec.name, SvM_external_name); svm_spec.build_regist_info_ODSS(ODSS1.GetId(), RW); RegisterSvM((PFSvMBody)SvM1, &svm_spec); // register SpM SpM_RegistParam spm_spec; spm_spec.build_regist_info_AAC(aac_spec); spm_spec.build_regist_info_ODSS(ODSS1.GetId(), RW); RegisterSpM((PFSpMBody)SpM1, &spm_spec); // register TMO TMO_RegistParam tmo_spec; _tcscpy(tmo_spec.global_name, TMO_external_name); tmo_spec.start_time = TMO_start_time1; RegisterTMO(&tmo_spec); }

  44. TMO 예제 (16/24) • TestTMO1.cpp (4/4) int main() { StartTMOengine(); tms TMO_start_time0 = tm4_DCS_age(5*1000*1000); tms gate_start_time0 = tm4_DCS_age(7*1000*1000); // Sometimes need to decompose assignment // of microsecond-based time value because // MS compiler limits constant to 32 bits. MicroSec from = 5; from *= 1000 * 1000; MicroSec until = 2 * 60 * 60; until *= 1000 * 1000; MicroSec every = 1 * 1000 * 1000; MicroSec est = 0; MicroSec lst = 5 * 1000; MicroSec by = 100 * 1000; AAC aac1(_T(""), tm4_DCS_age(from),tm4_DCS_age(until),every, est, lst, by); TMO1 T1(_T("TMO1"), _T("SvM1"), aac1,_T("TMO2"), _T("SvM2"), gate_start_time0, TMO_start_time0); MainThrSleep(); return TRUE; } //********************************** // end of TestTMO1.cpp //**********************************

  45. TMO 예제 (17/24) • TestODSS2.h #ifndef TESTODSS2_H #define TESTODSS2_H #include "TMOSL.h" #pragma comment(lib, "TMOSL") #include "TestODSS2.h" using namespace TMO; typedef struct { int count; } ParamStruct_TMO1class_SvM1; typedef struct { MicroSec system_age; } ParamStruct_TMO2class_SvM2; #endif //********************************** // end of TestODSS2.h //**********************************

  46. TMO 예제 (18/24) • TestTMO2.h #ifndef TESTTMO2_H #define TESTTMO2_H #include "TMOSL.h" #pragma comment(lib, "TMOSL") #include "TestODSS2.h" using namespace TMO; class TMO2: public CTMOBase { public: TMO2(TCHAR *, TCHAR *, AAC &, TCHAR *, TCHAR *, tms, tms); private: SvMGateClass gate2; int SpM2(); int SvM2(ParamStruct_TMO2class_SvM2 * param); }; #endif //********************************** // end of TestTMO2.h //**********************************

  47. TMO 예제 (19/24) • TestTMO2.cpp (1/4) #include "TestTMO2.h" int TMO2::SpM2() { tmsp Timestamp; MicroSec system_age; ParamStruct_TMO1class_SvM1 SvM1Para; // SpM started. TMOSLprintf(_T("SpM Started \n")); // Print out current System Age. system_age = GetCurrentDCSage(); TMOSLprintf(_T(" :: current System Age : %I64d\n"), system_age); // Call TMO1 SvM1 to get ODSS1 Counter gate2.NonBlockingSR(&SvM1Para, sizeof(SvM1Para), Timestamp); // You might do something here gate2.BlockingGetResultOfNonBlockingSR(Timestamp, 70000); // Print out Counter value and // current System Age. TMOSLprintf(_T("%d:: current System Age : %I64d ::Interval\n"), SvM1Para.count, GetCurrentDCSage() - system_age); return TRUE; // End SpM }

  48. TMO 예제 (20/24) • TestTMO2.cpp (2/4) int TMO2::SvM2(ParamStruct_TMO2class_SvM2 * pReq) { // int count; // SvM started TMOSLprintf(_T("SvM2 Started\n")); // Return local node's System Age. pReq->system_age = GetCurrentDCSage(); return TRUE; }

  49. TMO 예제 (21/24) • TestTMO2.cpp (3/4) TMO2::TMO2(TCHAR * TMO_external_name, TCHAR * SvM_external_name, AAC & aac_spec, TCHAR * ServerTMO_name, TCHAR * ServerSvM_name, tms gate_start_time2, tms TMO_start_time2):gate2(ServerTMO_name, ServerSvM_name, gate_start_time2) { // register SvM SvM_RegistParam svm_spec; svm_spec.GETB = 20 * 1000; _tcscpy(svm_spec.name, SvM_external_name); RegisterSvM((PFSvMBody)SvM2, &svm_spec); // register SpM SpM_RegistParam spm_spec; spm_spec.build_regist_info_AAC(aac_spec); RegisterSpM((PFSpMBody)SpM2, &spm_spec); // register TMO TMO_RegistParam tmo_spec; _tcscpy(tmo_spec.global_name, TMO_external_name); tmo_spec.start_time = TMO_start_time2; RegisterTMO(&tmo_spec); }

  50. TMO 예제 (22/24) • TestTMO2.cpp (4/4) int main() { StartTMOengine(); tms TMO_start_time0 = tm4_DCS_age(5*1000*1000); tms gate_start_time0 = tm4_DCS_age(7*1000*1000); // Sometimes need to decompose assignment // of microsecond-based time value because // MS compiler limits constant to 32 bits. MicroSec from = 5; from *= 1000 * 1000; MicroSec until = 2 * 60 * 60; until *= 1000 * 1000; MicroSec every = 1 * 1000 * 1000; MicroSec est = 0; MicroSec lst = 5 * 1000; MicroSec by = 100 * 1000; AAC aac2(_T(""), tm4_DCS_age(from), tm4_DCS_age(until), every, est, lst, by); TMO2 T2(_T("TMO2"), _T("SvM2"), aac2, _T("TMO1"), _T("SvM1"), gate_start_time0 , TMO_start_time0); MainThrSleep(); return TRUE; } //********************************** // end of TestTMO2.cpp //**********************************

More Related