Util--  1.1
dummy.hh
Go to the documentation of this file.
1 /* -*- C++ -*-
2  * $Id: dummy.hh 990 2005-09-14 15:17:04Z sjoyeux $
3  */
4 #ifndef UTILMM_SINGLETON_DUMMY_HEADER
5 # define UTILMM_SINGLETON_DUMMY_HEADER
6 
7 # include <string>
8 #include <boost/utility.hpp>
9 
11 
12 namespace utilmm {
13  namespace singleton {
14  class dummy;
15 
16  namespace details {
17  struct dummy_factory {
18  virtual ~dummy_factory() {};
19  virtual dummy* create() const = 0;
20  };
21  }
22 
32  class dummy :public ::boost::noncopyable {
33  protected:
35  dummy();
37  virtual ~dummy() =0;
38 
48  static void attach(std::string const &name, details::dummy_factory const& factory);
57  static void detach(std::string const &name);
58 
66  static dummy *instance(std::string const &name);
67 
68  private:
69  void incr_ref() const;
70  bool decr_ref() const;
71 
72  mutable size_t ref_counter;
73 
75  }; // class utilmm::singleton::dummy
76 
77  } // namespace utilmm::singleton
78 } // namespace utilmm
79 
80 #endif // UTILMM_SINGLETON_DUMMY_HEADER
81 
static void attach(std::string const &name, details::dummy_factory const &factory)
Attach a new singleton.
static void detach(std::string const &name)
Detach to a singleton.
static dummy * instance(std::string const &name)
Singleton generic access.
Generic Factory implementation.
Definition: factory.hh:46
virtual ~dummy_factory()
Definition: dummy.hh:18
dummy()
Default Constructor.
virtual ~dummy()=0
Destructor.
virtual dummy * create() const =0
friend class utilmm::singleton::server
Definition: dummy.hh:74
Forward declaration of utilmm::singleton::server.
base class for utilmm::singleton::wrapper
Definition: dummy.hh:32

Generated on Tue Oct 9 2018 10:12:45 for Util-- by doxygen 1.8.6
SourceForge.net Project Page