mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Merge pull request #71 from VILLASframework/no-ptr-alias
Remove aliases for smart pointers and lists
This commit is contained in:
commit
d855198de7
8 changed files with 21 additions and 28 deletions
|
@ -49,10 +49,6 @@ class PCIeCardFactory;
|
|||
|
||||
class Card {
|
||||
public:
|
||||
|
||||
using Ptr = std::shared_ptr<PCIeCard>;
|
||||
using List = std::list<Ptr>;
|
||||
|
||||
friend PCIeCardFactory;
|
||||
};
|
||||
|
||||
|
@ -83,13 +79,13 @@ public:
|
|||
void dump()
|
||||
{ }
|
||||
|
||||
ip::Core::Ptr
|
||||
std::shared_ptr<ip::Core>
|
||||
lookupIp(const std::string &name) const;
|
||||
|
||||
ip::Core::Ptr
|
||||
std::shared_ptr<ip::Core>
|
||||
lookupIp(const Vlnv &vlnv) const;
|
||||
|
||||
ip::Core::Ptr
|
||||
std::shared_ptr<ip::Core>
|
||||
lookupIp(const ip::IpIdentifier &id) const;
|
||||
|
||||
bool
|
||||
|
@ -100,7 +96,7 @@ private:
|
|||
std::set<MemoryManager::AddressSpaceId> memoryBlocksMapped;
|
||||
|
||||
public: // TODO: make this private
|
||||
ip::Core::List ips; // IPs located on this FPGA card
|
||||
std::list<std::shared_ptr<ip::Core>> ips; // IPs located on this FPGA card
|
||||
|
||||
bool doReset; // Reset VILLASfpga during startup?
|
||||
int affinity; // Affinity for MSI interrupts
|
||||
|
@ -136,11 +132,11 @@ protected:
|
|||
class PCIeCardFactory : public plugin::Plugin {
|
||||
public:
|
||||
|
||||
static Card::List
|
||||
make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci, std::shared_ptr<kernel::vfio::Container> vc);
|
||||
static
|
||||
std::list<std::shared_ptr<PCIeCard>> make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci, std::shared_ptr<kernel::vfio::Container> vc);
|
||||
|
||||
static PCIeCard*
|
||||
create()
|
||||
static
|
||||
PCIeCard* create()
|
||||
{
|
||||
return new PCIeCard();
|
||||
}
|
||||
|
|
|
@ -114,9 +114,6 @@ public:
|
|||
|
||||
virtual ~Core() = default;
|
||||
|
||||
using Ptr = std::shared_ptr<Core>;
|
||||
using List = std::list<Core::Ptr>;
|
||||
|
||||
public:
|
||||
// Generic management interface for IPs
|
||||
|
||||
|
@ -284,7 +281,7 @@ public:
|
|||
|
||||
// Returns a running and checked FPGA IP
|
||||
static
|
||||
Core::List make(PCIeCard* card, json_t *json_ips);
|
||||
std::list<std::shared_ptr<Core>> make(PCIeCard* card, json_t *json_ips);
|
||||
|
||||
virtual
|
||||
std::string getType() const
|
||||
|
|
|
@ -42,9 +42,9 @@ static PCIeCardFactory PCIeCardFactoryInstance;
|
|||
|
||||
static const kernel::pci::Device defaultFilter((kernel::pci::Id(FPGA_PCI_VID_XILINX, FPGA_PCI_PID_VFPGA)));
|
||||
|
||||
PCIeCard::List PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci, std::shared_ptr<kernel::vfio::Container> vc)
|
||||
std::list<std::shared_ptr<PCIeCard>> PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci, std::shared_ptr<kernel::vfio::Container> vc)
|
||||
{
|
||||
PCIeCard::List cards;
|
||||
std::list<std::shared_ptr<PCIeCard>> cards;
|
||||
auto logger = getStaticLogger();
|
||||
|
||||
const char *card_name;
|
||||
|
@ -182,7 +182,7 @@ PCIeCard::~PCIeCard()
|
|||
}
|
||||
}
|
||||
|
||||
ip::Core::Ptr PCIeCard::lookupIp(const std::string &name) const
|
||||
std::shared_ptr<ip::Core> PCIeCard::lookupIp(const std::string &name) const
|
||||
{
|
||||
for (auto &ip : ips) {
|
||||
if (*ip == name) {
|
||||
|
@ -193,7 +193,7 @@ ip::Core::Ptr PCIeCard::lookupIp(const std::string &name) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ip::Core::Ptr PCIeCard::lookupIp(const Vlnv &vlnv) const
|
||||
std::shared_ptr<ip::Core> PCIeCard::lookupIp(const Vlnv &vlnv) const
|
||||
{
|
||||
for (auto &ip : ips) {
|
||||
if (*ip == vlnv) {
|
||||
|
@ -204,7 +204,7 @@ ip::Core::Ptr PCIeCard::lookupIp(const Vlnv &vlnv) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
ip::Core::Ptr PCIeCard::lookupIp(const ip::IpIdentifier &id) const
|
||||
std::shared_ptr<ip::Core> PCIeCard::lookupIp(const ip::IpIdentifier &id) const
|
||||
{
|
||||
for (auto &ip : ips) {
|
||||
if (*ip == id) {
|
||||
|
|
|
@ -50,7 +50,7 @@ vlnvInitializationOrder = {
|
|||
Vlnv(AxiStreamSwitchFactory::getCompatibleVlnvString()),
|
||||
};
|
||||
|
||||
Core::List
|
||||
std::list<std::shared_ptr<Core>>
|
||||
CoreFactory::make(PCIeCard* card, json_t *json_ips)
|
||||
{
|
||||
// We only have this logger until we know the factory to build an IP with
|
||||
|
@ -59,8 +59,8 @@ CoreFactory::make(PCIeCard* card, json_t *json_ips)
|
|||
std::list<IpIdentifier> allIps; // All IPs available in config
|
||||
std::list<IpIdentifier> orderedIps; // IPs ordered in initialization order
|
||||
|
||||
Core::List configuredIps; // Successfully configured IPs
|
||||
Core::List initializedIps; // Initialized, i.e. ready-to-use IPs
|
||||
std::list<std::shared_ptr<Core>> configuredIps; // Successfully configured IPs
|
||||
std::list<std::shared_ptr<Core>> initializedIps; // Initialized, i.e. ready-to-use IPs
|
||||
|
||||
// Parse all IP instance names and their VLNV into list `allIps`
|
||||
const char* ipName;
|
||||
|
|
|
@ -81,7 +81,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto card = fpga::setupFpgaCard(configFile, fpgaName);
|
||||
|
||||
std::vector<fpga::ip::AuroraXilinx::Ptr> aurora_channels;
|
||||
std::vector<std::shared_ptr<fpga::ip::AuroraXilinx>> aurora_channels;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto name = fmt::format("aurora_8b10b_ch{}", i);
|
||||
auto id = fpga::ip::IpIdentifier("xilinx.com:ip:aurora_8b10b:", name);
|
||||
|
|
|
@ -73,7 +73,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto card = fpga::setupFpgaCard(configFile, fpgaName);
|
||||
|
||||
std::vector<fpga::ip::AuroraXilinx::Ptr> aurora_channels;
|
||||
std::vector<std::shared_ptr<fpga::ip::AuroraXilinx>> aurora_channels;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto name = fmt::format("aurora_8b10b_ch{}", i);
|
||||
auto id = fpga::ip::IpIdentifier("xilinx.com:ip:aurora_8b10b:", name);
|
||||
|
|
|
@ -73,7 +73,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
auto card = fpga::setupFpgaCard(configFile, fpgaName);
|
||||
|
||||
std::vector<fpga::ip::AuroraXilinx::Ptr> aurora_channels;
|
||||
std::vector<std::shared_ptr<fpga::ip::AuroraXilinx>> aurora_channels;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto name = fmt::format("aurora_8b10b_ch{}", i);
|
||||
auto id = fpga::ip::IpIdentifier("xilinx.com:ip:aurora_8b10b:", name);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
class FpgaState {
|
||||
public:
|
||||
// List of all available FPGA cards, only first will be tested at the moment
|
||||
villas::fpga::PCIeCard::List cards;
|
||||
std::list<std::shared_ptr<villas::fpga::PCIeCard>> cards;
|
||||
};
|
||||
|
||||
// Global state to be shared by unittests
|
||||
|
|
Loading…
Add table
Reference in a new issue