Main  /  Edit  /  History  /   /  Users Area

cppcms::manager

Role

This is central class of any CppCMS application. It is responsible on starting up all required services, setting up worker model and running application.

Constructors

    manager(char const *file);
    manager(int argc, char **argv);
    manager(int argc, char **argv,char const *file);

Create cppcms::manager with configuration that can be taken from file, from command line parameters. If no file in command line parameters is given and environment variable CPPCMS_CONFIG is not defined, default configuration file can be specified as third parameter:

manager app(argc,argv,"/etc/myapp_config.txt");

Public members:

All access to configuration facilities of CppCMS application are done though config member of manager class:

cppcms_config config;

See cppcms::cppcms_config for reference.

Public member functions

set_worker()

void set_worker(base_factory *w);

Setups new factory of "worker" applications. This pointer would be freed when manager is destroyed.

cppcms::base_factory usually build using template class:

template<typename T>
cppcms::application_factory;

For example:

manager app(argc,argv);
app.set_worker(new application_factory<hello_world>());

If standard simple factory does not satisfy your needs you may create your own factory class. you should derive it from:

namespace cppcms {
  class base_factory {
  public:
    virtual shared_ptr<worker_thread> operator()(manager const &cf) const = 0;
    virtual ~base_factory() {};
  };
}

Where operator()(manager const &) should return boost::shared_ptr to newly create worker_thread class.

See worker_thread and application for further explanations.

execute()

Main application loop is started by calling:

void execute();

Auxiliary member functions for advanced users:

There are additional functions for advanced users who want to reimplement standard modules of CppCMS.

void set_cache(cache_factory *c);
void set_api(cgi_api *a);
void set_mod(web_application *m);
void set_gettext(transtext::trans_factory *);
void set_sessions(session_backend_factory);

Relate to documentation of CppCMS internals for usage.

About

CppCMS is a web development framework for performance demanding applications.

Support This Project

SourceForge.net Logo

Поддержать проект

CppCMS needs You


Navigation

Main Page



Valid CSS | Valid XHTML 1.0