SVCS - English Documentation
Loading...
Searching...
No Matches
ServerBaseCommand.hxx
Go to the documentation of this file.
1
19
20#pragma once
21
26
27#include <memory>
28#include <string>
29
47namespace svcs::server::cli {
49using namespace svcs::core;
50using namespace svcs::cli;
51using namespace svcs::services;
52
70class ServerBaseCommand : public ICommand {
71public:
83 ServerBaseCommand(std::shared_ptr<ISubject> event_bus,
84 std::shared_ptr<RepositoryManager> repo_manager);
85
93 virtual ~ServerBaseCommand() = default;
94
106 [[nodiscard]] virtual std::string getName() const override = 0;
107
119 [[nodiscard]] virtual std::string getDescription() const override = 0;
120
132 [[nodiscard]] virtual std::string getUsage() const override = 0;
133
134
147 virtual bool execute(const std::vector<std::string>& args) override = 0;
148
158 virtual void showHelp() const override = 0;
159
160protected:
172 void notifyInfo(const std::string& message) const;
173
185 void notifyError(const std::string& message) const;
186
194 std::shared_ptr<ISubject> event_bus_;
195
203 std::shared_ptr<RepositoryManager> repo_manager_;
204};
205
206}
Defines the event structure used for the Observer pattern notifications.
Declaration of the ICommand interface for all executable CLI commands.
Defines the interface for the Subject (Publisher) component of the Observer pattern.
Declaration of the RepositoryManager class, managing all repository-level file operations.
Interface (abstract base class) for all commands executed via the CLI.
Definition ICommand.hxx:34
virtual std::string getDescription() const override=0
Pure virtual method to get the command description.
virtual ~ServerBaseCommand()=default
Virtual destructor for proper cleanup of derived classes.
virtual std::string getName() const override=0
Pure virtual method to get the command name.
std::shared_ptr< ISubject > event_bus_
Shared pointer to the event bus for system notifications.
Definition ServerBaseCommand.hxx:126
virtual std::string getUsage() const override=0
Pure virtual method to get the command usage syntax.
void notifyInfo(const std::string &message) const
Sends an informational notification via the event bus.
Definition ServerBaseCommand.cxx:24
virtual void showHelp() const override=0
Pure virtual method to display detailed help information.
ServerBaseCommand(std::shared_ptr< ISubject > event_bus, std::shared_ptr< RepositoryManager > repo_manager)
Constructs a ServerBaseCommand with necessary dependencies.
Definition ServerBaseCommand.cxx:17
virtual bool execute(const std::vector< std::string > &args) override=0
Pure virtual method to execute the command logic.
std::shared_ptr< RepositoryManager > repo_manager_
Shared pointer to the repository manager for repository operations.
Definition ServerBaseCommand.hxx:132
void notifyError(const std::string &message) const
Sends an error notification via the event bus.
Definition ServerBaseCommand.cxx:31
Command-line interface components and command implementations.
Core VCS data structures and object model.
Server administration command-line interface components.
Service layer components and infrastructure services.