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

  • Home
  • SEARCH
  • 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 putting off developing this part of my app for sometime purely
I have been developing a project and in this project i have designed my
I have been developing the application for drawing, and I have the problem: my
I have been developing the application for drawing and I need to detect double
I have been developing the application for drawing, and there is the code: public
I have been developing the application for drawing and I have some problems: the
I have been developing a managed extensibility framework application for the last several months
I've been developing an application using asp.net MVC, and I have some configurations that
I have been developing the application which must recognize SMS commands. So, I need
I have been developing the application which can manage a device using SMS commands;

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.