~registry/scalestack/trunk

« back to all changes in this revision

Viewing changes to scalestack/event/handler.h

  • Committer: Eric Day
  • Date: 2010-07-02 04:33:01 UTC
  • mfrom: (56.1.4)
  • Revision ID: git-v1:1084ed00d423bd6296f3362ba35e6781eca9233a
Merged style-updates branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <ctime>
20
20
 
21
21
#include <scalestack/common/macros.h>
22
 
#include <scalestack/event/service.h>
 
22
#include <scalestack/event/handler_service.h>
23
23
 
24
24
namespace scalestack
25
25
{
34
34
 */
35
35
class SCALESTACK_API handler
36
36
{
37
 
  friend class handler_provider;
38
 
 
39
37
public:
40
38
 
41
 
  handler(service& creator);
 
39
  handler(handler_service& handler_service);
42
40
 
43
41
  virtual ~handler();
44
42
 
45
43
  /**
46
 
   * Get the service this handler belongs to.
 
44
   * Get the handler service this handler belongs to.
47
45
   */
48
 
  service& get_service(void);
 
46
  handler_service& get_handler_service(void);
49
47
 
50
48
  /**
51
49
   * This method is run after the event service has added it.
116
114
 
117
115
protected:
118
116
 
119
 
  service& _service;
 
117
  handler_service& _handler_service;
120
118
  kernel::module& _module;
121
119
 
122
120
private:
134
132
  handler& operator=(const handler&);
135
133
 
136
134
  handler_provider* _handler_provider;
 
135
 
 
136
  friend class handler_provider;
137
137
};
138
138
 
139
139
/**
156
156
 
157
157
  /**
158
158
   * Set the handler for this handler_provider. This is used while
159
 
   * initializing the event handler in the service class. This is required
160
 
   * in order to reuse both handler and handler_provider instances, which
161
 
   * will be implemented by unrelated classes.
 
159
   * initializing the event handler in the handler service class. This is
 
160
   * required in order to reuse both handler and handler_provider instances,
 
161
   * which will be implemented by unrelated classes.
162
162
   *
163
 
   * @param[in] bound_handler Handler to bind to this provider.
 
163
   * @param[in] handler Handler to bind to this provider.
164
164
   */
165
 
  void set_handler(handler* bound_handler);
 
165
  void set_handler(handler* handler);
166
166
 
167
167
  /**
168
168
   * See handler::start().
245
245
 * Public handler methods.
246
246
 */
247
247
 
248
 
inline handler::handler(service& creator):
249
 
  _service(creator),
250
 
  _module(creator.get_module()),
 
248
inline handler::handler(handler_service& handler_service):
 
249
  _handler_service(handler_service),
 
250
  _module(handler_service.get_module()),
251
251
  _handler_provider(NULL)
252
252
{
253
253
}
256
256
{
257
257
}
258
258
 
259
 
inline service& handler::get_service(void)
 
259
inline handler_service& handler::get_handler_service(void)
260
260
{
261
 
  return _service;
 
261
  return _handler_service;
262
262
}
263
263
 
264
264
inline void handler::start(void)
334
334
  return _handler;
335
335
}
336
336
 
337
 
inline void handler_provider::set_handler(handler* bound_handler)
 
337
inline void handler_provider::set_handler(handler* handler)
338
338
{
339
 
  _handler = bound_handler;
 
339
  _handler = handler;
340
340
  _handler->_handler_provider = this;
341
341
}
342
342