mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 04:25:42 +08:00
refs #441 Rename COriginator to CIdentifier and rename COriginatorAware to CIdentifiable.
This commit is contained in:
52
src/blackmisc/identifiable.h
Normal file
52
src/blackmisc/identifiable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* Copyright (C) 2015
|
||||
* swift Project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef BLACKMISC_IDENTIFIABLE_H
|
||||
#define BLACKMISC_IDENTIFIABLE_H
|
||||
|
||||
//! \file
|
||||
|
||||
#include "blackmiscexport.h"
|
||||
#include "identifier.h"
|
||||
#include <QObject>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
/*!
|
||||
* Base class with a member CIdentifier to be inherited by a class which has an identity in the environment of modular distributed swift processes
|
||||
*/
|
||||
class BLACKMISC_EXPORT CIdentifiable
|
||||
{
|
||||
public:
|
||||
//! Get identifier
|
||||
const CIdentifier &identifier() const { return m_identifier; }
|
||||
|
||||
//! Identifier with current timestamp
|
||||
CIdentifier getCurrentTimestampIdentifier() const;
|
||||
|
||||
//! My identifier?
|
||||
bool isMyIdentifier(const CIdentifier &otherIdentifier) { return m_identifier == otherIdentifier; }
|
||||
|
||||
protected:
|
||||
//! Use literal based object name
|
||||
CIdentifiable(const QString &objectName) : m_identifier(objectName) {}
|
||||
|
||||
//! Connect with QObject providing then name
|
||||
CIdentifiable(QObject *nameProvider);
|
||||
|
||||
//! Destructor
|
||||
~CIdentifiable();
|
||||
|
||||
private:
|
||||
CIdentifier m_identifier;
|
||||
QMetaObject::Connection m_connection;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user