Files
pilotclient/src/blackmisc/identifiable.h
Klaus Basan 84428b1284 Ref T270, log display can trigger display in sim and further improvements
* log display can trigger displayed log in simulator
* check prerequisites for log and display overlay
* made component identifiable
* pre-load parts
2018-06-13 13:59:45 +02:00

61 lines
1.8 KiB
C++

/* 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.
*/
//! \file
#ifndef BLACKMISC_IDENTIFIABLE_H
#define BLACKMISC_IDENTIFIABLE_H
#include "blackmisc/blackmiscexport.h"
#include "blackmisc/compare.h"
#include "blackmisc/identifier.h"
#include <QMetaObject>
#include <QObject>
#include <QString>
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; }
//! Set identifier, allows to set an external identifier
void setIdentifier(const CIdentifier &identifier) { m_identifier = identifier; }
//! Identifier with current timestamp
CIdentifier getCurrentTimestampIdentifier() const;
//! My identifier?
bool isMyIdentifier(const CIdentifier &otherIdentifier) const { return m_identifier == otherIdentifier; }
protected:
//! Use literal based object name
CIdentifiable(const QString &objectName) : m_identifier(objectName) {}
//! Connect with QObject providing the name
CIdentifiable(QObject *nameProvider);
//! Destructor
~CIdentifiable();
private:
CIdentifier m_identifier;
QMetaObject::Connection m_connection;
};
} // namespace
#endif // guard