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