ProteoWizard
COMInitializer.hpp
Go to the documentation of this file.
1 //
2 // $Id: COMInitializer.hpp 1195 2009-08-14 22:12:04Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2008 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 #ifndef COMINITIALIZER_HPP_
24 #define COMINITIALIZER_HPP_
25 
26 
27 #include "Export.hpp"
28 
29 
30 namespace pwiz {
31 namespace util {
32 
33 
34 /// Singleton used to initialize and uninitialize COM once per thread
36 {
37  public:
38 
39  /// If COM is not yet initialized on the calling thread, initializes COM and returns true
40  /// If COM is already initialized on the calling thread, increments reference count and returns false
41  static bool initialize();
42 
43  /// If COM is not initialized on the calling thread, does nothing and returns false
44  /// If COM is initialized on the calling thread, decreases reference count:
45  /// If reference count is 0, uninitializes COM and return true, otherwise returns false
46  static bool uninitialize();
47 
48  private:
49  class Impl;
50 };
51 
52 
53 } // namespace util
54 } // namespace pwiz
55 
56 
57 #endif // COMINITIALIZER_HPP_