refs #403 extern templates

This commit is contained in:
Roland Winklmeier
2015-04-10 23:34:33 +02:00
parent 38b00e06b3
commit f75c81010d
10 changed files with 161 additions and 32 deletions

View File

@@ -22,6 +22,31 @@
namespace BlackMisc
{
namespace Aviation
{
class CAircraftSituation;
class CAircraftSituationList;
class CAircraftParts;
class CAircraftPartsList;
class CAircraft;
class CAircraftList;
class CAtcStation;
class CAtcStationList;
}
namespace Simulation
{
class CSimulatedAircraft;
class CSimulatedAircraftList;
}
namespace Network
{
class CClient;
class CClientList;
}
namespace Aviation
{
//! List of objects with callsign.
@@ -83,6 +108,13 @@ namespace BlackMisc
CONTAINER &container();
};
extern template class ICallsignObjectList<BlackMisc::Aviation::CAtcStation, BlackMisc::Aviation::CAtcStationList>;
extern template class ICallsignObjectList<BlackMisc::Aviation::CAircraft, BlackMisc::Aviation::CAircraftList>;
extern template class ICallsignObjectList<BlackMisc::Aviation::CAircraftSituation, BlackMisc::Aviation::CAircraftSituationList>;
extern template class ICallsignObjectList<BlackMisc::Aviation::CAircraftParts, BlackMisc::Aviation::CAircraftPartsList>;
extern template class ICallsignObjectList<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList>;
extern template class ICallsignObjectList<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>;
} //namespace
} // namespace

View File

@@ -85,6 +85,18 @@ namespace BlackMisc
}
}
template <class AVIO>
AVIO const *CModulator<AVIO>::derived() const
{
return static_cast<AVIO const *>(this);
}
template <class AVIO>
AVIO *CModulator<AVIO>::derived()
{
return static_cast<AVIO *>(this);
}
// see here for the reason of thess forward instantiations
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
template class CModulator<CComSystem>;

View File

@@ -22,6 +22,10 @@ namespace BlackMisc
namespace Aviation
{
class CComSystem;
class CNavSystem;
class CAdfSystem;
//! Base class for COM, NAV, Squawk units.
template <class AVIO> class CModulator : public CValueObject<CModulator<AVIO>, CAvionicsBase>
{
@@ -209,12 +213,16 @@ namespace BlackMisc
bool m_enabled = true; //!< is enabled, used e.g. for mute etc.
//! Easy access to derived class (CRTP template parameter)
AVIO const *derived() const { return static_cast<AVIO const *>(this); }
AVIO const *derived() const;
//! Easy access to derived class (CRTP template parameter)
AVIO *derived() { return static_cast<AVIO *>(this); }
AVIO *derived();
};
extern template class CModulator<CComSystem>;
extern template class CModulator<CNavSystem>;
extern template class CModulator<CAdfSystem>;
}
}