码迷,mamicode.com
首页 > 移动开发 > 详细

object oriented programming : class application

时间:2017-04-06 12:50:05      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:roc   virtual   min   guard   logs   fine   tar   har   shutdown   

class Thread_Sync;
class Critical;
class Info;

class Info{Info(std::string str):m_info(str){}
    private:
    std::string m_info;};

// a process need: { pre-run();run();post-run();mutex for threads, running previlledge}

#define APPL_DECLARE_APP( YourAppClass )    class YourAppClass : public Application    {    public:        YourAppClass(int argc, const char * argv[])     : Application(argc, argv) {};        virtual        int Main(int argc, ArgvType argv);    };

// provide a main() runtine
#define APPL_DEFINE_MAIN( YourAppClass )        int        main(int argc, const char * argv[])    {    a
    YourAppClass theApp(argc, argv);        return(theApp.Run());    }

class Application
{
public:
    virtual ~Application();
    int Run(){if(Startup() && Main(argc,argv)&& Shutdown()) { return true;} return false;)
    static Application & TheApp();
    bool SetProcessPriority(int priority);
protected:
    Application(int argc, const char * argv[]);
    virtual int Startup();
    virtual int Main(int argc, char ** argv) { return 1; }
    virtual int Shutdown();
private:
    Critical* m_pGuard;
    Info * m_info;int m_priority;
    int m_argc;char ** m_argv;
    static Application * pInstance;
};

 

object oriented programming : class application

标签:roc   virtual   min   guard   logs   fine   tar   har   shutdown   

原文地址:http://www.cnblogs.com/resibe-3/p/6672716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!