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:
parent
2c17b743c7
commit
757bc7b934
@ -23,7 +23,7 @@ local registrar_sources =
|
|||||||
PriorityMessageQueue.cpp
|
PriorityMessageQueue.cpp
|
||||||
RecentApps.cpp
|
RecentApps.cpp
|
||||||
RecentEntries.cpp
|
RecentEntries.cpp
|
||||||
Referencable.cpp
|
Referenceable.cpp
|
||||||
Registrar.cpp
|
Registrar.cpp
|
||||||
RosterAppInfo.cpp
|
RosterAppInfo.cpp
|
||||||
RosterSettingsCharStream.cpp
|
RosterSettingsCharStream.cpp
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <messaging.h>
|
#include <messaging.h>
|
||||||
|
|
||||||
#include "MessageDeliverer.h"
|
#include "MessageDeliverer.h"
|
||||||
#include "Referencable.h"
|
#include "Referenceable.h"
|
||||||
|
|
||||||
// sDeliverer -- the singleton instance
|
// sDeliverer -- the singleton instance
|
||||||
MessageDeliverer *MessageDeliverer::sDeliverer = NULL;
|
MessageDeliverer *MessageDeliverer::sDeliverer = NULL;
|
||||||
@ -23,10 +23,10 @@ MessageDeliverer *MessageDeliverer::sDeliverer = NULL;
|
|||||||
static const bigtime_t kRetryDelay = 20000; // 20 ms
|
static const bigtime_t kRetryDelay = 20000; // 20 ms
|
||||||
|
|
||||||
// Message
|
// Message
|
||||||
class MessageDeliverer::Message : public Referencable {
|
class MessageDeliverer::Message : public Referenceable {
|
||||||
public:
|
public:
|
||||||
Message(void *data, int32 dataSize)
|
Message(void *data, int32 dataSize)
|
||||||
: Referencable(true),
|
: Referenceable(true),
|
||||||
fData(data),
|
fData(data),
|
||||||
fDataSize(dataSize),
|
fDataSize(dataSize),
|
||||||
fCreationTime(system_time()),
|
fCreationTime(system_time()),
|
||||||
|
@ -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 "Debug.h"
|
||||||
#include "Referencable.h"
|
#include "Referenceable.h"
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
Referencable::Referencable(bool deleteWhenUnreferenced)
|
Referenceable::Referenceable(bool deleteWhenUnreferenced)
|
||||||
: fReferenceCount(1),
|
: fReferenceCount(1),
|
||||||
fDeleteWhenUnreferenced(deleteWhenUnreferenced)
|
fDeleteWhenUnreferenced(deleteWhenUnreferenced)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
// destructor
|
||||||
Referencable::~Referencable()
|
Referenceable::~Referenceable()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddReference
|
// AddReference
|
||||||
void
|
void
|
||||||
Referencable::AddReference()
|
Referenceable::AddReference()
|
||||||
{
|
{
|
||||||
atomic_add(&fReferenceCount, 1);
|
atomic_add(&fReferenceCount, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveReference
|
// RemoveReference
|
||||||
bool
|
bool
|
||||||
Referencable::RemoveReference()
|
Referenceable::RemoveReference()
|
||||||
{
|
{
|
||||||
bool unreferenced = (atomic_add(&fReferenceCount, -1) == 1);
|
bool unreferenced = (atomic_add(&fReferenceCount, -1) == 1);
|
||||||
if (fDeleteWhenUnreferenced && unreferenced)
|
if (fDeleteWhenUnreferenced && unreferenced)
|
||||||
@ -34,7 +37,7 @@ Referencable::RemoveReference()
|
|||||||
|
|
||||||
// CountReferences
|
// CountReferences
|
||||||
int32
|
int32
|
||||||
Referencable::CountReferences() const
|
Referenceable::CountReferences() const
|
||||||
{
|
{
|
||||||
return fReferenceCount;
|
return fReferenceCount;
|
||||||
}
|
}
|
@ -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
|
#ifndef REFERENCABLE_H
|
||||||
#define REFERENCABLE_H
|
#define REFERENCABLE_H
|
||||||
|
|
||||||
#include <SupportDefs.h>
|
#include <SupportDefs.h>
|
||||||
|
|
||||||
// Referencable
|
// Referenceable
|
||||||
class Referencable {
|
class Referenceable {
|
||||||
public:
|
public:
|
||||||
Referencable(
|
Referenceable(
|
||||||
bool deleteWhenUnreferenced = false);
|
bool deleteWhenUnreferenced = false);
|
||||||
virtual ~Referencable();
|
virtual ~Referenceable();
|
||||||
|
|
||||||
void AddReference();
|
void AddReference();
|
||||||
bool RemoveReference(); // returns true after last
|
bool RemoveReference(); // returns true after last
|
Loading…
Reference in New Issue
Block a user