mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T701, IAircraftModelSetProvider 1st version
* added to matcher * and simulator context * in facade changed init order, as we need getCContextOwnAircraft() / getCContextSimulator() Remark: Need 2 contexts is not ideal, but accepted for the moment
This commit is contained in:
committed by
Mat Sutcliffe
parent
9ac457edb3
commit
0767deb41d
32
src/blackmisc/simulation/aircraftmodelsetprovider.cpp
Normal file
32
src/blackmisc/simulation/aircraftmodelsetprovider.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 2019
|
||||
* 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. 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.
|
||||
*/
|
||||
|
||||
#include "aircraftmodelsetprovider.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
// pin vtables to this file
|
||||
void CAircraftModelSetAware::anchor()
|
||||
{ }
|
||||
|
||||
CAircraftModelList CAircraftModelSetAware::getModelSet() const
|
||||
{
|
||||
if (!this->hasProvider()) { return CAircraftModelList(); }
|
||||
return this->provider()->getModelSet();
|
||||
}
|
||||
|
||||
int CAircraftModelSetAware::getModelSetCount() const
|
||||
{
|
||||
if (!this->hasProvider()) { return -1; }
|
||||
return this->provider()->getModelSetCount();
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
61
src/blackmisc/simulation/aircraftmodelsetprovider.h
Normal file
61
src/blackmisc/simulation/aircraftmodelsetprovider.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/* Copyright (C) 2019
|
||||
* 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. 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_SIMULATION_AIRCRAFTMODELSETPROVIDER_H
|
||||
#define BLACKMISC_SIMULATION_AIRCRAFTMODELSETPROVIDER_H
|
||||
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/provider.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Simulation
|
||||
{
|
||||
//! Value object encapsulating a list of aircraft models
|
||||
class BLACKMISC_EXPORT IAircraftModelSetProvider : public IProvider
|
||||
{
|
||||
public:
|
||||
//! Get the model set models
|
||||
virtual CAircraftModelList getModelSet() const = 0;
|
||||
|
||||
//! Get the model set models count
|
||||
virtual int getModelSetCount() const = 0;
|
||||
|
||||
//! Constructor
|
||||
IAircraftModelSetProvider() = default;
|
||||
};
|
||||
|
||||
//! Delegating class which can be directly used to access an \sa IAircraftModelSetProvider instance
|
||||
class BLACKMISC_EXPORT CAircraftModelSetAware : public IProviderAware<IAircraftModelSetProvider>
|
||||
{
|
||||
virtual void anchor();
|
||||
|
||||
public:
|
||||
//! Set the provider
|
||||
void setOwnAircraftProvider(IAircraftModelSetProvider *provider) { this->setProvider(provider); }
|
||||
|
||||
//! \copydoc IAircraftModelSetProvider::getModelSet
|
||||
CAircraftModelList getModelSet() const;
|
||||
|
||||
//! \copydoc IAircraftModelSetProvider::getModelSetCount
|
||||
int getModelSetCount() const;
|
||||
|
||||
protected:
|
||||
//! Constructor
|
||||
CAircraftModelSetAware(IAircraftModelSetProvider *modelSetProvider) : IProviderAware(modelSetProvider) { Q_ASSERT(modelSetProvider); }
|
||||
};
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Q_DECLARE_INTERFACE(BlackMisc::Simulation::IAircraftModelSetProvider, "org.swift-project.blackmisc.simulation.iaircraftmodelsetprovider")
|
||||
|
||||
#endif //guard
|
||||
Reference in New Issue
Block a user