LCOV - code coverage report
Current view: top level - store/source - object.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 20 0.0 %
Date: 2014-04-14 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          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             : #include "object.hxx"
      21             : 
      22             : #include "sal/types.h"
      23             : #include "rtl/alloc.h"
      24             : #include "rtl/ref.hxx"
      25             : #include "osl/diagnose.h"
      26             : #include "osl/interlck.h"
      27             : 
      28             : namespace store
      29             : {
      30             : 
      31             : /*========================================================================
      32             :  *
      33             :  * OStoreObject implementation.
      34             :  *
      35             :  *======================================================================*/
      36             : const sal_uInt32 OStoreObject::m_nTypeId = sal_uInt32(0x58190322);
      37             : 
      38             : /*
      39             :  * OStoreObject.
      40             :  */
      41           0 : OStoreObject::OStoreObject (void)
      42           0 :     : m_nRefCount (0)
      43             : {
      44           0 : }
      45             : 
      46             : /*
      47             :  * ~OStoreObject.
      48             :  */
      49           0 : OStoreObject::~OStoreObject (void)
      50             : {
      51             :     OSL_ASSERT(m_nRefCount == 0);
      52           0 : }
      53             : 
      54             : /*
      55             :  * operator new.
      56             :  */
      57           0 : void* OStoreObject::operator new (size_t n)
      58             : {
      59           0 :     return rtl_allocateMemory (n);
      60             : }
      61             : 
      62             : /*
      63             :  * operator delete.
      64             :  */
      65           0 : void OStoreObject::operator delete (void *p)
      66             : {
      67           0 :     rtl_freeMemory (p);
      68           0 : }
      69             : 
      70             : /*
      71             :  * isKindOf.
      72             :  */
      73           0 : bool OStoreObject::isKindOf (sal_uInt32 nTypeId)
      74             : {
      75           0 :     return (nTypeId == m_nTypeId);
      76             : }
      77             : 
      78             : /*
      79             :  * acquire.
      80             :  */
      81           0 : oslInterlockedCount SAL_CALL OStoreObject::acquire (void)
      82             : {
      83           0 :     oslInterlockedCount result = osl_atomic_increment (&m_nRefCount);
      84           0 :     return (result);
      85             : }
      86             : 
      87             : /*
      88             :  * release.
      89             :  */
      90           0 : oslInterlockedCount SAL_CALL OStoreObject::release (void)
      91             : {
      92           0 :     oslInterlockedCount result = osl_atomic_decrement (&m_nRefCount);
      93           0 :     if (result == 0)
      94             :     {
      95             :         // Last reference released.
      96           0 :         delete this;
      97             :     }
      98           0 :     return (result);
      99             : }
     100             : 
     101             : } // namespace store
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10