X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fbackend.hh;fp=src%2Fmoof%2Fbackend.hh;h=b40a72a67a4d2f7ca0a1ed61817a6638ecccb106;hb=831f04d4bc19a390415ac0bbac4331c7a65509bc;hp=0000000000000000000000000000000000000000;hpb=299af4f2047e767e5d79501c26444473bda64c64;p=chaz%2Fyoink diff --git a/src/moof/backend.hh b/src/moof/backend.hh new file mode 100644 index 0000000..b40a72a --- /dev/null +++ b/src/moof/backend.hh @@ -0,0 +1,59 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_BACKEND_HH_ +#define _MOOF_BACKEND_HH_ + +/** + * \file backend.hh + * Initialize the backend libraries and subsystems. + */ + + +namespace moof { + + +/** + * Some classes and subsystems require certain backend libraries to be + * initialized. This is the mechanism to accomplish that. Classes which + * rely on any backend libraries just need to instantiate this class as a + * member. Backend cleanup will occur automagically when there are no more + * instances. + */ +class backend +{ +public: + + /** + * Construct a backend reference, initializing the backend if it hasn't + * already been initialized. + */ + backend(); + + /** + * Get whether or not the backend has been initialized. + * \return True if the backend is initialized, false otherwise. + */ + static bool is_initialized(); + + + // The rest of this stuff is to implement the reference counting. + + backend(const backend& backend); + backend& operator=(const backend& backend); + ~backend(); +}; + + +} // namespace moof + +#endif // _MOOF_BACKEND_HH_ +