//Editor-Info: -*- C++ -*-
//
//Subject: TOVE project / OVOPS++
//
//File: system.h
//
//Version: $Revision: 1.17 $
//
//State: $State: Exp $
//
//Date: $Date: 1998/10/19 11:15:24 $
//
//Organisation:
//      Helsinki University of Technology
//      Laboratory of Telecommunications Software and Multimedia
// 
//Authors:
//	Timo Kokkonen
//      Juhana Räsänen
//      Pasi Nummisalo
//
//Description:
//     A System class encapsulates SF scheduler framework
//
//      Singleton pattern ensures a class only has one instance, and provides
//      a global point of access to it.
//
//Copyright:     
//      Copyright 1999 Helsinki University of Technology
//      ALL RIGHTS RESERVED BETWEEN JANUARY 1996 AND JUNE 1999.
//
//      
//Licence:
//     
//
//History:
//
//
 
#ifndef __PF_SYSTEM_H__
#define __PF_SYSTEM_H__

class sfScheduler;
class pfTimer;
class pfProtocol;
class pfDevice;

#include <typeinfo>
#include <string>
#include <vector>
#include <OB/CORBA.h>

class pfSystem
{
    public:
        static void init(int argc, char *argv[]);
        static pfSystem *instance(void);

	// running the event loop continuously (run)
	//  or one step at a time (next)
        void run(void);
        void next(void);

        CORBA_ORB_ptr getORB(void);

        // starting programs
        void startProgram(const string &programName_,
                          const vector<string> &arguments_);

	// registering timers, conduits and devices to the scheduler
        void registerTimer(pfTimer *timer_);
        void registerConduit(pfProtocol *conduit_);
        void registerDevice(pfDevice *device_);

    protected:
        pfSystem(void);
        pfSystem(int argc, char *argv[]);
        virtual ~pfSystem(void);
        
    private:
	pfSystem(const pfSystem &other_);
	pfSystem &operator=(const pfSystem &other_);
        sfScheduler *_scheduler;
        static pfSystem *_only;
};

#endif // __PF_SYSTEM_H__

