Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3225692
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:22:09+00:00 2026-05-17T16:22:09+00:00

I have been developing this class for loading plugins in the form of shared

  • 0

I have been developing this class for loading plugins in the form of shared objects for an application. I currently have thought of 2 ways of loading the file names of all the plugins to be loaded by the app. I have written an interface for loading file names. I have a few questions about how to improve this design. Please help. Thanks.

EDIT: Code change per feedback :D.

#include "Plugin.h"

//This class is an interface for loading the list of file names of shared objects. 
//Could be by loading all filienames in a dir, or by loading filenames specified in a file.
class FileNameLoader
{
    public:
        virtual std::list<std::string>& LoadFileNames() = 0;
};

class PluginLoader
{
public:
    explicit PluginLoader(LoadingMethod, const std::string& = "");
    virtual ~PluginLoader();

    virtual bool Load();

    virtual bool LoadPlugins(FileNameLoader&);
    virtual bool LoadFunctions();

protected:
private:
    explicit PluginLoader(const PluginLoader&);
    PluginLoader& operator=(const PluginLoader&);

    bool LoadSharedObjects();

    list<std::string> l_FileNames;
    list<PluginFunction*> l_Functions;
    list<Plugin*> l_Plugins;
};

Anything that seems ugly still? Thanks for the feedback anyway.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:22:09+00:00Added an answer on May 17, 2026 at 4:22 pm

    You created a fine interface, but then you don’t use it. And you then store the file names in a private member l_FileNames.

    I would change the PluginLoader constructor to accept a FileNameLoader reference and use that reference to load file names. This way you won’t need the LoadingMethod in the PluginLoader class.

    Write two classes that implement the FileNameLoader interface, one for each loading method.

    edit:

    class FileNameLoader
    {
        public:
            //RVO will work right? :D
            virtual std::list<std::string>& LoadFileNames() = 0;
    };
    
    class FileNameLoaderByFile : public FileNameLoader
    {
    public:
        std::list<std::string>& LoadFileNames()
        {
            //  ...
        }
    
    }
    
    class FileNameLoaderByDirectory : public FileNameLoader
    {
    public:
        std::list<std::string>& LoadFileNames()
        {
            //  ...
        }
    
    }
    
    
    
    class PluginLoader
    {
    public:
        explicit PluginLoader(FileNameLoader& loader)
        {
        fileNames = loader.LoadFileNames()
        }
    
        virtual ~PluginLoader();
    
    private:
        list<std::string> fileNames;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing a C# windows form application in XP. It all works
People have been developing own solutions to the following problems: Consistent messaging frameworks for
I have been developing websites for a couple of years now and I almost
I have been developing in asp.net since its existence (also classic asp before that)
I have been developing with Java for several years and last six months I
Up till now I have been developing my personal and school projects at home
There are several people about (myself being one of them) who have been developing
Like most developers here and in the entire world, I have been developing software
I have been tasked with developing a solution that tracks changes to a database.
I have been tasked with developing a new retail e-commerce storefront for my current

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.