LCOV - code coverage report
Current view: top level - store/source - object.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 20 90.0 %
Date: 2012-08-25 Functions: 6 8 75.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 6 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include "object.hxx"
      22                 :            : 
      23                 :            : #include "sal/types.h"
      24                 :            : #include "rtl/alloc.h"
      25                 :            : #include "rtl/ref.hxx"
      26                 :            : #include "osl/diagnose.h"
      27                 :            : #include "osl/interlck.h"
      28                 :            : 
      29                 :            : namespace store
      30                 :            : {
      31                 :            : 
      32                 :            : /*========================================================================
      33                 :            :  *
      34                 :            :  * OStoreObject implementation.
      35                 :            :  *
      36                 :            :  *======================================================================*/
      37                 :            : const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322);
      38                 :            : 
      39                 :            : /*
      40                 :            :  * OStoreObject.
      41                 :            :  */
      42                 :    1964544 : OStoreObject::OStoreObject (void)
      43                 :    1964544 :     : m_nRefCount (0)
      44                 :            : {
      45                 :    1964544 : }
      46                 :            : 
      47                 :            : /*
      48                 :            :  * ~OStoreObject.
      49                 :            :  */
      50                 :    1962291 : OStoreObject::~OStoreObject (void)
      51                 :            : {
      52                 :            :     OSL_ASSERT(m_nRefCount == 0);
      53         [ -  + ]:    1962291 : }
      54                 :            : 
      55                 :            : /*
      56                 :            :  * operator new.
      57                 :            :  */
      58                 :    1964544 : void* OStoreObject::operator new (size_t n)
      59                 :            : {
      60                 :    1964544 :     return rtl_allocateMemory (n);
      61                 :            : }
      62                 :            : 
      63                 :            : /*
      64                 :            :  * operator delete.
      65                 :            :  */
      66                 :    1962291 : void OStoreObject::operator delete (void *p)
      67                 :            : {
      68                 :    1962291 :     rtl_freeMemory (p);
      69                 :    1962291 : }
      70                 :            : 
      71                 :            : /*
      72                 :            :  * isKindOf.
      73                 :            :  */
      74                 :          0 : sal_Bool SAL_CALL OStoreObject::isKindOf (sal_uInt32 nTypeId)
      75                 :            : {
      76                 :          0 :     return (nTypeId == m_nTypeId);
      77                 :            : }
      78                 :            : 
      79                 :            : /*
      80                 :            :  * acquire.
      81                 :            :  */
      82                 :   69016125 : oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
      83                 :            : {
      84                 :   69016125 :     oslInterlockedCount result = osl_incrementInterlockedCount (&m_nRefCount);
      85                 :   69016125 :     return (result);
      86                 :            : }
      87                 :            : 
      88                 :            : /*
      89                 :            :  * release.
      90                 :            :  */
      91                 :   68720735 : oslInterlockedCount SAL_CALL OStoreObject::release (void)
      92                 :            : {
      93                 :   68720735 :     oslInterlockedCount result = osl_decrementInterlockedCount (&m_nRefCount);
      94         [ +  + ]:   68720735 :     if (result == 0)
      95                 :            :     {
      96                 :            :         // Last reference released.
      97         [ +  - ]:    1962291 :         delete this;
      98                 :            :     }
      99                 :   68720735 :     return (result);
     100                 :            : }
     101                 :            : 
     102                 :            : } // namespace store
     103                 :            : 
     104                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10