Skip to content

Commit

Permalink
S.O.L.I.D
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-schilasky committed Feb 7, 2025
1 parent 43879f4 commit 6e78300
Show file tree
Hide file tree
Showing 84 changed files with 615 additions and 377 deletions.
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/command_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace eCAL
// Constructor & Destructor
/////////////////////////////////

CommandExecutor::CommandExecutor(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::string& remote_hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service)
CommandExecutor::CommandExecutor(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::string& remote_hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service)
: rec_server_instance_ (rec_server_instance)
, remote_hostname_ (remote_hostname)
, remote_rec_server_service_(remote_rec_server_service)
Expand Down
4 changes: 2 additions & 2 deletions app/rec/rec_server_cli/src/command_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace eCAL
// Constructor & Destructor
/////////////////////////////////
public:
CommandExecutor(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::string& remote_hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service);
CommandExecutor(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::string& remote_hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service);
~CommandExecutor();

/////////////////////////////////
Expand All @@ -70,7 +70,7 @@ namespace eCAL
private:
std::shared_ptr<eCAL::rec_server::RecServer> rec_server_instance_;
std::string remote_hostname_;
std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>> remote_rec_server_service_;
std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>> remote_rec_server_service_;

std::vector<std::pair<std::string, std::unique_ptr<eCAL::rec_cli::command::Command>>> command_map_;

Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/activate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace eCAL
return eCAL::rec::Error::OK;
}

eCAL::rec::Error Activate::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error Activate::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
// Arg check
if (argv.size() > 0)
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/activate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/rec/rec_server_cli/src/commands/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace eCAL
{
namespace command
{
eCAL::rec::Error Command::GetRemoteStatus(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerStatus& status_output)
eCAL::rec::Error Command::GetRemoteStatus(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerStatus& status_output)
{
eCAL::pb::rec_server::Status status_pb;

Expand All @@ -53,7 +53,7 @@ namespace eCAL
}
}

eCAL::rec::Error Command::GetRemoteConfig(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerConfig& config_output)
eCAL::rec::Error Command::GetRemoteConfig(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerConfig& config_output)
{
// Service call
eCAL::pb::rec_server::GenericRequest request_pb;
Expand All @@ -73,7 +73,7 @@ namespace eCAL
}
}

eCAL::rec::Error Command::CallRemoteEcalrecService(const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_ecalrec_service
eCAL::rec::Error Command::CallRemoteEcalrecService(const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_ecalrec_service
, const std::string& hostname
, const std::string& method_name
, const google::protobuf::Message& request
Expand Down
8 changes: 4 additions & 4 deletions app/rec/rec_server_cli/src/commands/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ namespace eCAL
virtual std::string Example() const = 0;

virtual eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const = 0;
virtual eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const = 0;
virtual eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const = 0;

virtual void Interrupt() const {};

static eCAL::rec::Error GetRemoteStatus(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerStatus& status_output);
static eCAL::rec::Error GetRemoteConfig(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerConfig& config_output);
static eCAL::rec::Error GetRemoteStatus(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerStatus& status_output);
static eCAL::rec::Error GetRemoteConfig(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, eCAL::rec_server::RecServerConfig& config_output);

static eCAL::rec::Error CallRemoteEcalrecService(const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_ecalsys_service
static eCAL::rec::Error CallRemoteEcalrecService(const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_ecalsys_service
, const std::string& hostname
, const std::string& method_name
, const google::protobuf::Message& request
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/comment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace eCAL
}
}

eCAL::rec::Error Comment::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error Comment::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
// Arg check
if (argv.size() < 1)
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/comment.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/deactivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ namespace eCAL
return eCAL::rec::Error::OK;
}

eCAL::rec::Error DeActivate::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error DeActivate::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
// Arg check
if (argv.size() > 0)
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/deactivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace eCAL
return rec_server_instance->DeleteMeasurement(meas_id);
}

eCAL::rec::Error Delete::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error Delete::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
// Arg check
if (argv.size() == 0)
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/delete.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/exit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace eCAL
return eCAL::rec::Error::ErrorCode::OK;
}

eCAL::rec::Error Exit::Execute(const std::string& /*hostname*/, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& /*remote_rec_server_service*/, const std::vector<std::string>& /*argv*/) const
eCAL::rec::Error Exit::Execute(const std::string& /*hostname*/, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& /*remote_rec_server_service*/, const std::vector<std::string>& /*argv*/) const
{
return eCAL::rec::Error::ErrorCode::OK;
}
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/exit.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/get_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace eCAL
return PrintConfig(rec_server_instance->GetConfig());
}

eCAL::rec::Error GetConfig::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& /*argv*/) const
eCAL::rec::Error GetConfig::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& /*argv*/) const
{
eCAL::rec_server::RecServerConfig config;
eCAL::rec::Error error = GetRemoteConfig(hostname, remote_rec_server_service, config);
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/get_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;

eCAL::rec::Error PrintConfig(const eCAL::rec_server::RecServerConfig& config) const;
};
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/load_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ namespace eCAL
}
}

eCAL::rec::Error LoadConfig::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error LoadConfig::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
// Arg check
if (argv.empty())
Expand Down
2 changes: 1 addition & 1 deletion app/rec/rec_server_cli/src/commands/load_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/rec/rec_server_cli/src/commands/record.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace eCAL
return Execute(rec_server_instance, time_to_rec);
}

eCAL::rec::Error Record::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
eCAL::rec::Error Record::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const
{
std::chrono::duration<double> time_to_rec(0);

Expand Down Expand Up @@ -111,7 +111,7 @@ namespace eCAL
return eCAL::rec::Error::ErrorCode::OK;
}

eCAL::rec::Error Record::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, std::chrono::duration<double> time_to_rec) const
eCAL::rec::Error Record::Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, std::chrono::duration<double> time_to_rec) const
{
// Retrieve Status
eCAL::rec_server::RecServerStatus status;
Expand Down
4 changes: 2 additions & 2 deletions app/rec/rec_server_cli/src/commands/record.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ namespace eCAL
std::string Example() const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, const std::vector<std::string>& argv) const override;

eCAL::rec::Error Execute(const std::shared_ptr<eCAL::rec_server::RecServer>& rec_server_instance, std::chrono::duration<double> time_to_rec = std::chrono::duration<double>(0)) const;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClient<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, std::chrono::duration<double> time_to_rec = std::chrono::duration<double>(0)) const;
eCAL::rec::Error Execute(const std::string& hostname, const std::shared_ptr<eCAL::protobuf::CServiceClientUntypedCallback<eCAL::pb::rec_server::EcalRecServerService>>& remote_rec_server_service, std::chrono::duration<double> time_to_rec = std::chrono::duration<double>(0)) const;

void Interrupt() const override;

Expand Down
Loading

0 comments on commit 6e78300

Please sign in to comment.