dummy.cc
Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * $Id: dummy.cc 970 2005-04-08 16:30:46Z sjoyeux $
00003  */
00004 #include "server.hh"
00005 
00006 using namespace utilmm::singleton;
00007 
00008 /*
00009  * class utilmm::singleton::dummy
00010  */
00011 
00012 // structors 
00013 dummy::dummy()
00014   :ref_counter(0ul) {}
00015 
00016 dummy::~dummy() {}
00017 
00018 // modifiers 
00019 void dummy::incr_ref() const {
00020   ++ref_counter;
00021 }
00022 
00023 bool dummy::decr_ref() const {
00024   return (ref_counter--)<=1;
00025 }
00026 
00027 // statics
00028 void dummy::attach(std::string const &name, details::dummy_factory const& inst) {
00029   server::lock_type locker(server::sing_mtx);
00030   server::instance().attach(name, inst);
00031 }
00032 
00033 void dummy::detach(std::string const &name) {
00034   server::lock_type locker(server::sing_mtx);
00035   if( server::instance().detach(name) )
00036     delete server::the_instance;
00037 }
00038 
00039 dummy *dummy::instance(std::string const &name) {
00040   server::lock_type locker(server::sing_mtx);
00041   return server::instance().get(name);
00042 }


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:01