diff --git a/daemon/README b/daemon/README index 27f0b8d8f9677de1859bbcf9c07ce4bad27af6b8..fd222d45b4cdaefe6bee49c8f283bb1b2be574a6 100644 --- a/daemon/README +++ b/daemon/README @@ -51,8 +51,6 @@ Short description of content of source tree ------------------------------------------- - ringtones/ contains the different ringtones. -- stund/ is an implementation of the protocol STUN used when there is a NAT. -- utilspp/ allows to implement a singleton. - src/ is the core of SFLphone. It contains the main.cpp, managerimpl.cpp files, audio and gui directories, and files about signalisation SIP. Later, it should be better, when IAX will be implemented, that a directory groups diff --git a/daemon/configure.ac b/daemon/configure.ac index 6492e2af3c34724f007ca68fda58afe63b1ff365..1a644e9e1c78d1f9ccd1422ec6c8a26ca9c0ab44 100644 --- a/daemon/configure.ac +++ b/daemon/configure.ac @@ -257,8 +257,6 @@ CXXFLAGS="${CXXFLAGS} -g -Wno-return-type -Wall -Wextra -Wnon-virtual-dtor -Weff dnl What to generate AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([libs/Makefile \ - libs/utilspp/Makefile \ - libs/utilspp/singleton/Makefile \ libs/iax2/Makefile]) AC_CONFIG_FILES([src/Makefile \ diff --git a/daemon/libs/Makefile.am b/daemon/libs/Makefile.am index da08ea625d6194b4d887ad36554994d3917bad7d..105bcd0231a42a82de43d0f493962f5c01bef334 100644 --- a/daemon/libs/Makefile.am +++ b/daemon/libs/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = utilspp iax2 +SUBDIRS = iax2 EXTRA_DIST=pjproject diff --git a/daemon/libs/utilspp/Makefile.am b/daemon/libs/utilspp/Makefile.am deleted file mode 100644 index 403b7fc158899e61b14337c92505efb4f8e6b2ba..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -SUBDIRS = singleton - -noinst_LTLIBRARIES = libutilspp.la - -libutilspp_la_SOURCES = \ - null_type.hpp \ - singleton.hpp \ - threading_single.hpp threading_single.inl - -libutilspp_la_LIBADD = ./singleton/libsingleton.la diff --git a/daemon/libs/utilspp/null_type.hpp b/daemon/libs/utilspp/null_type.hpp deleted file mode 100644 index 0ba1208ad44028f147ecbbd0840d299771d7e88a..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/null_type.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef UTILSPP_NULLTYPE_HPP -#define UTILSPP_NULLTYPE_HPP - -namespace utilspp -{ - struct NullType; -} - -#endif diff --git a/daemon/libs/utilspp/singleton.hpp b/daemon/libs/utilspp/singleton.hpp deleted file mode 100644 index 649394f938addcb72c6cb317953dd20b4cf6c3a8..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton.hpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "threading_single.hpp" -#include "singleton/singleton_holder.hpp" diff --git a/daemon/libs/utilspp/singleton/Makefile.am b/daemon/libs/utilspp/singleton/Makefile.am deleted file mode 100644 index d494c4c5e8f963fd9a25b28abd8e576bbb0e78d9..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -noinst_LTLIBRARIES = libsingleton.la - -libsingleton_la_SOURCES = \ - creation_using_new.hpp creation_using_new.inl \ - lifetime_default.hpp lifetime_default.inl \ - singleton_holder.hpp singleton_holder.inl diff --git a/daemon/libs/utilspp/singleton/creation_using_new.hpp b/daemon/libs/utilspp/singleton/creation_using_new.hpp deleted file mode 100644 index fe94f128528572979518adbf753436e8338a2b83..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/creation_using_new.hpp +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __CREATION_USING_NEW_HPP__ -#define __CREATION_USING_NEW_HPP__ - -/** - * This class is a creation policy for the utilspp::singleton_holder. The - * policy is creating the singleton by a "new" call. - */ -namespace utilspp -{ - template< typename T > - struct CreationUsingNew - { - static T *create(); - static void destroy( T *obj ); - }; -} - -#include "creation_using_new.inl" -#endif // __CREATION_USING_NEW_HPP__ diff --git a/daemon/libs/utilspp/singleton/creation_using_new.inl b/daemon/libs/utilspp/singleton/creation_using_new.inl deleted file mode 100644 index 5c9ae88eb8d07084494879f7849ef0d994015f78..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/creation_using_new.inl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef CREATION_USING_NEW_INL -#define CREATION_USING_NEW_INL - -template< typename T > -T * -utilspp::CreationUsingNew< T >::create() -{ - return new T; -} - -template< typename T > -void -utilspp::CreationUsingNew< T >::destroy( T *obj ) -{ - delete obj; -} - - -#endif diff --git a/daemon/libs/utilspp/singleton/lifetime_default.hpp b/daemon/libs/utilspp/singleton/lifetime_default.hpp deleted file mode 100644 index ba0208c0a2fbf4e5a7fcb0c5ce10fe7873140078..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/lifetime_default.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef LIFETIME_DEFAULT_HPP -#define LIFETIME_DEFAULT_HPP - -namespace utilspp -{ - template< typename T > - class LifetimeDefault - { - public: - static void scheduleDestruction( T *obj, void (*func)() ); - static void onDeadReference(); - }; -} - -#include "lifetime_default.inl" - -#endif diff --git a/daemon/libs/utilspp/singleton/lifetime_default.inl b/daemon/libs/utilspp/singleton/lifetime_default.inl deleted file mode 100644 index 6760ececcd6d07376fc9b33df7556d1b4d092063..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/lifetime_default.inl +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __LIFETIME_DEFAULT_INL__ -#define __LIFETIME_DEFAULT_INL__ - -#include <cstdlib> -#include <stdexcept> - -template< typename T > -void -utilspp::LifetimeDefault< T >::scheduleDestruction( T *, void (*func)() ) -{ - std::atexit(func); -} - -template< typename T > -void -utilspp::LifetimeDefault< T >::onDeadReference() -{ - throw std::logic_error("Dead reference detected"); -} - -#endif // __LIFETIME_DEFAULT_INL__ diff --git a/daemon/libs/utilspp/singleton/singleton_holder.hpp b/daemon/libs/utilspp/singleton/singleton_holder.hpp deleted file mode 100644 index 6b0fcf47b1503620c1f12c59fc256ff065e2c83d..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/singleton_holder.hpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __SINGLETON_HOLDER_HPP__ -#define __SINGLETON_HOLDER_HPP__ - -#include "creation_using_new.hpp" -#include "lifetime_default.hpp" -#include "../threading_single.hpp" - -namespace utilspp -{ - template - < class T, - template < class > class CreationPolicy = utilspp::CreationUsingNew, - template < class > class LifetimePolicy = utilspp::LifetimeDefault, - template < class > class ThreadingModel = utilspp::ThreadingSingle > - class SingletonHolder - { - public: - //the accessor method. - static T& instance(); - static void makeInstance(); - static void terminate(); - - protected: - //protected to be sure that nobody may create one by himself. - SingletonHolder(); - - private: - static void destroySingleton(); - - private: - typedef typename ThreadingModel< T * >::VolatileType InstanceType; - static InstanceType mInstance; - static bool mDestroyed; - }; - -} - -#include "singleton_holder.inl" - -#endif diff --git a/daemon/libs/utilspp/singleton/singleton_holder.inl b/daemon/libs/utilspp/singleton/singleton_holder.inl deleted file mode 100644 index 5fb9fab7f480e13a2243d95f572e77a9d93fa0c0..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/singleton/singleton_holder.inl +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __SINGLETON_HOLDER_INL__ -#define __SINGLETON_HOLDER_INL__ - -#include <cassert> -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -T& -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel -> -::instance() -{ - if ( mInstance == NULL ) - { - makeInstance(); - } - - return ( *mInstance ); -} - -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -void -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel ->::makeInstance() -{ - if ( mInstance == NULL ) - { - typename ThreadingModel< T >::lock guard; - (void)guard; - - if ( mInstance == NULL ) { - if ( mDestroyed ) - { - LifetimePolicy< T >::onDeadReference(); - mDestroyed = false; - } - - mInstance = CreationPolicy< T >::create(); - LifetimePolicy< T >::scheduleDestruction( mInstance, &destroySingleton ); - } - } -} - -template -< -class T, -template < class > class CreationPolicy, -template < class > class LifetimePolicy, -template < class > class ThreadingModel -> -void -utilspp::SingletonHolder -< -T, -CreationPolicy, -LifetimePolicy, -ThreadingModel -> -::destroySingleton() -{ - assert( !mDestroyed ); - CreationPolicy< T >::destroy( mInstance ); - mInstance = NULL; - mDestroyed = true; -} - -template < class T, -template < class > class C, -template < class > class L, -template < class > class M -> -typename utilspp::SingletonHolder< T, C, L, M>::InstanceType -utilspp::SingletonHolder< T, C, L, M >::mInstance; - -template -< -class T, -template < class > class C, -template < class > class L, -template < class > class M -> -bool utilspp::SingletonHolder< T, C, L, M >::mDestroyed; - -#endif // __SINGLETON_HOLDER_INL__ diff --git a/daemon/libs/utilspp/threading_single.hpp b/daemon/libs/utilspp/threading_single.hpp deleted file mode 100644 index 81c023402c5dd18dc9e107b48653ee33df80dbcd..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/threading_single.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __THREADING_SINGLE_HPP__ -#define __THREADING_SINGLE_HPP__ - -#include "null_type.hpp" - -namespace utilspp -{ - template < typename T = utilspp::NullType > - struct ThreadingSingle - { - struct mutex - { - void lock(); - void unlock(); - }; - - struct lock - { - lock(); - lock( mutex &m ); - }; - - typedef T VolatileType; - }; -} - -#include "threading_single.inl" - -#endif // __THREADING_SINGLE_HPP__ diff --git a/daemon/libs/utilspp/threading_single.inl b/daemon/libs/utilspp/threading_single.inl deleted file mode 100644 index 4d26c4ff1dab7593a37761e024d7537d3857e99a..0000000000000000000000000000000000000000 --- a/daemon/libs/utilspp/threading_single.inl +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) <2002-2004> <Jean-Philippe Barrette-LaPierre> - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (cURLpp), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#ifndef __THREADING_SINGLE_INL__ -#define __THREADING_SINGLE_INL__ - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock() -{} - -template< typename T > -inline -utilspp::ThreadingSingle< T >::lock::lock( - utilspp::ThreadingSingle< T >::mutex & ) -{} - -template< typename T > -inline -void -utilspp::ThreadingSingle< T >::mutex::lock() -{} - -template< typename T > -inline -void -utilspp::ThreadingSingle< T >::mutex::unlock() -{} - -#endif // __THREADING_SINGLE_INL__ diff --git a/daemon/src/Makefile.am b/daemon/src/Makefile.am index 158628f70c342cb43fe6eaa4bc0847287ae6f033..3886ea0855895ccaae1bf565fc288fbbec9f3654 100644 --- a/daemon/src/Makefile.am +++ b/daemon/src/Makefile.am @@ -51,7 +51,6 @@ noinst_HEADERS = \ noncopyable.h libsflphone_la_LIBADD = \ - $(top_builddir)/libs/utilspp/libutilspp.la \ $(top_builddir)/libs/iax2/libiax2.la \ $(IAX_LIB) \ ./im/libim.la \ @@ -91,6 +90,7 @@ libsflphone_la_SOURCES = conference.cpp \ voiplink.cpp \ preferences.cpp \ managerimpl.cpp \ + manager.cpp \ managerimpl_registration.cpp \ eventthread.cpp \ call.cpp \ diff --git a/daemon/src/audio/alsa/alsalayer.cpp b/daemon/src/audio/alsa/alsalayer.cpp index fdd666f40d553dba8e1dc555694843806f0e7a56..d40f78afe10fd83e25a038911be190846c9448f7 100644 --- a/daemon/src/audio/alsa/alsalayer.cpp +++ b/daemon/src/audio/alsa/alsalayer.cpp @@ -33,7 +33,7 @@ #include "audio/dcblocker.h" #include "eventthread.h" #include "audio/samplerateconverter.h" -#include "managerimpl.h" +#include "manager.h" #include "noncopyable.h" #include "dbus/configurationmanager.h" diff --git a/daemon/src/audio/audiolayer.h b/daemon/src/audio/audiolayer.h index a3dc0543ae9c0782330b8fcff6312b969f5e2e8b..a0f60fb58ef9d49b48d50f113be1275f56770452 100644 --- a/daemon/src/audio/audiolayer.h +++ b/daemon/src/audio/audiolayer.h @@ -37,7 +37,6 @@ #include <commoncpp/thread.h> // for ost::Mutex #include <sys/time.h> -#include "manager.h" #include "ringbuffer.h" #include "dcblocker.h" #include "samplerateconverter.h" @@ -49,6 +48,7 @@ */ class MainBuffer; +class AudioPreference; namespace ost { class Time; diff --git a/daemon/src/audio/pulseaudio/audiostream.cpp b/daemon/src/audio/pulseaudio/audiostream.cpp index 2eb1308e5098c1e1c54fe6635b38737edcaa1b21..4053d5b4ab72c7cef7425b7521e93e0444d7e587 100644 --- a/daemon/src/audio/pulseaudio/audiostream.cpp +++ b/daemon/src/audio/pulseaudio/audiostream.cpp @@ -28,8 +28,9 @@ * as that of the covered work. */ -#include <audiostream.h> +#include "audiostream.h" #include "pulselayer.h" +#include <stdexcept> AudioStream::AudioStream(pa_context *c, pa_threaded_mainloop *m, const char *desc, int type, int smplrate, std::string& deviceName) : audiostream_(0), mainloop_(m) diff --git a/daemon/src/audio/pulseaudio/pulselayer.cpp b/daemon/src/audio/pulseaudio/pulselayer.cpp index fd4b896f22539f83bcc12e12fa471b2797af6ee2..4cc0fcc73d9eccd90a4b6d9a93682c83bee1aa09 100644 --- a/daemon/src/audio/pulseaudio/pulselayer.cpp +++ b/daemon/src/audio/pulseaudio/pulselayer.cpp @@ -30,11 +30,12 @@ */ #include <algorithm> // for std::find +#include <stdexcept> #include "audiostream.h" #include "pulselayer.h" #include "audio/samplerateconverter.h" #include "audio/dcblocker.h" -#include "managerimpl.h" +#include "manager.h" namespace { diff --git a/daemon/src/dbus/networkmanager.cpp b/daemon/src/dbus/networkmanager.cpp index ece8cc0115949062be6f7b75586bc2ef09a84c87..52680d4acb8b02e6b4372458d7e9e9cacc3e17ea 100644 --- a/daemon/src/dbus/networkmanager.cpp +++ b/daemon/src/dbus/networkmanager.cpp @@ -30,6 +30,7 @@ #include "networkmanager.h" #include "../manager.h" +#include "logger.h" const std::string NetworkManager::statesString[5] = {"unknown", "asleep", "connecting", "connected", diff --git a/daemon/src/main.cpp b/daemon/src/main.cpp index 30fd9126d62133172c6b051a5c7d5eafa0bc3ad4..0d5fe3834359e86fbb01c7fd90f6cf5335a3948f 100644 --- a/daemon/src/main.cpp +++ b/daemon/src/main.cpp @@ -84,7 +84,7 @@ int main(int argc, char **argv) return 1; try { - Manager::instance().init(); + Manager::instance().init(""); } catch (const std::exception &e) { std::cerr << e.what() << std::endl; return 1; diff --git a/daemon/src/manager.cpp b/daemon/src/manager.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b09fde7606417d2f2e8d59a30027dbf061d98627 --- /dev/null +++ b/daemon/src/manager.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. + * Author : Tristan Matthews <tristan.matthews@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Additional permission under GNU GPL version 3 section 7: + * + * If you modify this program, or any covered work, by linking or + * combining it with the OpenSSL project's OpenSSL library (or a + * modified version of that library), containing parts covered by the + * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. + * grants you additional permission to convey the resulting work. + * Corresponding Source for a non-source form of such a combination + * shall include the source code for the parts of OpenSSL used as well + * as that of the covered work. + */ + +#include "manager.h" + +ManagerImpl& Manager::instance() +{ + // Meyers singleton + static ManagerImpl instance_; + return instance_; +} diff --git a/daemon/src/manager.h b/daemon/src/manager.h index 730b4d0b3f7376679745b83ed217119cb1b46a84..50d740679fdddb376934f7ddfcdaa537d8ee7d47 100644 --- a/daemon/src/manager.h +++ b/daemon/src/manager.h @@ -29,13 +29,16 @@ * as that of the covered work. */ -#ifndef SFLPHONE_MANAGER_H -#define SFLPHONE_MANAGER_H +#ifndef MANAGER_H_ +#define MANAGER_H_ -#include "utilspp/singleton.hpp" +// we could forward declare ManagerImpl BUT anyone who will call instance +// will need this include. #include "managerimpl.h" -typedef utilspp::SingletonHolder<ManagerImpl> Manager; +namespace Manager { + ManagerImpl& instance(); +} -#endif +#endif // MANAGER_H_ diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index 04428236e551c2c7741daee7509bd4fd264b5533..6729a0f3f9e576050596b8cea9a1d19d03b817f9 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -90,7 +90,7 @@ ManagerImpl::ManagerImpl() : ManagerImpl::~ManagerImpl() {} -void ManagerImpl::init(std::string config_file) +void ManagerImpl::init(const std::string &config_file) { path_ = config_file.empty() ? createConfigFile() : config_file; DEBUG("Manager: configuration file path: %s", path_.c_str()); diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h index 2fd9665b92353b8e52916757113beafc14ba9935..c4b968fa2d3668d51edfb838685fed3efc299f0f 100644 --- a/daemon/src/managerimpl.h +++ b/daemon/src/managerimpl.h @@ -32,8 +32,8 @@ * as that of the covered work. */ -#ifndef __SFL_MANAGER_H__ -#define __SFL_MANAGER_H__ +#ifndef MANAGER_IMPL_H_ +#define MANAGER_IMPL_H_ #include <string> #include <vector> @@ -129,7 +129,7 @@ class ManagerImpl { * Initialisation of thread (sound) and map. * Init a new VoIPLink, audio codec and audio driver */ - void init(std::string config_file = ""); + void init(const std::string &config_file); /** * Terminate all thread (sound, link) and unload AccountMap @@ -1091,4 +1091,4 @@ class ManagerImpl { */ History history_; }; -#endif // __MANAGER_H__ +#endif // MANAGER_IMPL_H_