xref: /aoo4110/main/sw/inc/IInterface.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24  #ifndef IINTERFACE_HXX_INCLUDED
25  #define IINTERFACE_HXX_INCLUDED
26 
27  #include <sal/types.h>
28 
29  /** The base interface
30  */
31  class IInterface
32  {
33  public:
34 
35     /** Aquire a reference to an instance. A caller shall release
36 	    the instance by calling 'release' when it is no longer needed.
37         'acquire' and 'release' calls need to be balanced.
38 
39         @returns
40         the current reference count of the instance for debugging purposes.
41     */
42     virtual sal_Int32 acquire() = 0;
43 
44     /** Releases a reference to an instance. A caller has to call
45         'release' when a before aquired reference to an instance
46         is no longer needed. 'acquire' and 'release' calls need to
47         be balanced.
48 
49 	@returns
50 	    the current reference count of the instance for debugging purposes.
51     */
52     virtual sal_Int32 release() = 0;
53 
54     /** Returns the current reference count. This method should be used for
55         debugging purposes. Using it otherwise is a signal of a design flaw.
56     */
57     virtual sal_Int32 getReferenceCount() const = 0;
58 
59 protected:
~IInterface()60     virtual ~IInterface() {};
61  };
62 
63  #endif // IDOCUMENT_HXX_INCLUDED
64