instance 함수

구체적 팩토리에서 플러깅을 완료하려면 <env>OS.cpp에 정의된 instance 함수를 작성해야 합니다. 이 함수는 구체적 운영 체제 팩토리에 대한 포인터를 리턴합니다. instance 메소드는 OMOSFactory의 단일 인스턴스를 작성합니다. 이는 다음과 같이 정의합니다.

static OMOSFactory* instance();

예를 들어, VxWorks에서 선언은 다음과 같습니다.

OMOSFactory* OMOSFactory::instance()
{
   static VxOSFactory theFactory;
   return &theFactory;
}

피드백