Renamed Referencable to Referenceable (mainly to make Axel happier :-).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11035 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-01-25 16:10:03 +00:00
parent 2c17b743c7
commit 757bc7b934
4 changed files with 22 additions and 16 deletions

View File

@ -23,7 +23,7 @@ local registrar_sources =
PriorityMessageQueue.cpp
RecentApps.cpp
RecentEntries.cpp
Referencable.cpp
Referenceable.cpp
Registrar.cpp
RosterAppInfo.cpp
RosterSettingsCharStream.cpp

View File

@ -15,7 +15,7 @@
#include <messaging.h>
#include "MessageDeliverer.h"
#include "Referencable.h"
#include "Referenceable.h"
// sDeliverer -- the singleton instance
MessageDeliverer *MessageDeliverer::sDeliverer = NULL;
@ -23,10 +23,10 @@ MessageDeliverer *MessageDeliverer::sDeliverer = NULL;
static const bigtime_t kRetryDelay = 20000; // 20 ms
// Message
class MessageDeliverer::Message : public Referencable {
class MessageDeliverer::Message : public Referenceable {
public:
Message(void *data, int32 dataSize)
: Referencable(true),
: Referenceable(true),
fData(data),
fDataSize(dataSize),
fCreationTime(system_time()),

View File

@ -1,30 +1,33 @@
// Referencable.cpp
/*
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#include "Debug.h"
#include "Referencable.h"
#include "Referenceable.h"
// constructor
Referencable::Referencable(bool deleteWhenUnreferenced)
Referenceable::Referenceable(bool deleteWhenUnreferenced)
: fReferenceCount(1),
fDeleteWhenUnreferenced(deleteWhenUnreferenced)
{
}
// destructor
Referencable::~Referencable()
Referenceable::~Referenceable()
{
}
// AddReference
void
Referencable::AddReference()
Referenceable::AddReference()
{
atomic_add(&fReferenceCount, 1);
}
// RemoveReference
bool
Referencable::RemoveReference()
Referenceable::RemoveReference()
{
bool unreferenced = (atomic_add(&fReferenceCount, -1) == 1);
if (fDeleteWhenUnreferenced && unreferenced)
@ -34,7 +37,7 @@ Referencable::RemoveReference()
// CountReferences
int32
Referencable::CountReferences() const
Referenceable::CountReferences() const
{
return fReferenceCount;
}

View File

@ -1,16 +1,19 @@
// Referencable.h
/*
* Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef REFERENCABLE_H
#define REFERENCABLE_H
#include <SupportDefs.h>
// Referencable
class Referencable {
// Referenceable
class Referenceable {
public:
Referencable(
Referenceable(
bool deleteWhenUnreferenced = false);
virtual ~Referencable();
virtual ~Referenceable();
void AddReference();
bool RemoveReference(); // returns true after last