Skip to content

Commit

Permalink
Fix namespace in demo servers (C++ and C#)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Feb 10, 2025
1 parent dc2b2d6 commit b1cd934
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 26 deletions.
3 changes: 1 addition & 2 deletions cpp/Ice/config/Chatbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
#include <sstream>

using namespace std;
using namespace ConfigServer;

string
Chatbot::greet(string name, const Ice::Current&)
Server::Chatbot::greet(string name, const Ice::Current&)
{
cout << "Dispatching greet request { name = '" << name << "' }" << endl;

Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/config/Chatbot.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "Greeter.h"

namespace ConfigServer
namespace Server
{
/// A Chatbot is an Ice servant that implements Slice interface Greeter.
class Chatbot : public VisitorCenter::Greeter
Expand Down
3 changes: 1 addition & 2 deletions cpp/Ice/config/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <iostream>

using namespace std;
using namespace ConfigServer;

int
main(int argc, char* argv[])
Expand All @@ -26,7 +25,7 @@ main(int argc, char* argv[])
auto adapter = communicator->createObjectAdapter("GreeterAdapter");

// Register the Chatbot servant with the adapter.
adapter->add(make_shared<Chatbot>(), Ice::stringToIdentity("greeter"));
adapter->add(make_shared<Server::Chatbot>(), Ice::stringToIdentity("greeter"));

// Start dispatching requests.
adapter->activate();
Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/greeter/Chatbot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using namespace std;

string
GreeterServer::Chatbot::greet(string name, const Ice::Current&)
Server::Chatbot::greet(string name, const Ice::Current&)
{
cout << "Dispatching greet request { name = '" << name << "' }" << endl;

Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/greeter/Chatbot.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "Greeter.h"

namespace GreeterServer
namespace Server
{
/// A Chatbot is an Ice servant that implements Slice interface Greeter.
class Chatbot : public VisitorCenter::Greeter
Expand Down
4 changes: 2 additions & 2 deletions cpp/Ice/greeter/ChatbotAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

using namespace std;

GreeterServerAMD::Chatbot::~Chatbot()
ServerAMD::Chatbot::~Chatbot()
{
// Wait for all tasks to complete.
for (auto& task : _tasks)
Expand All @@ -19,7 +19,7 @@ GreeterServerAMD::Chatbot::~Chatbot()
}

void
GreeterServerAMD::Chatbot::greetAsync(
ServerAMD::Chatbot::greetAsync(
string name,
function<void(string_view)> response,
[[maybe_unused]] function<void(std::exception_ptr)> exception,
Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/greeter/ChatbotAMD.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "GreeterAMD.h"

namespace GreeterServerAMD
namespace ServerAMD
{
/// A Chatbot is an Ice servant that implements Slice interface Greeter.
class Chatbot : public VisitorCenter::Greeter
Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/greeter/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main(int argc, char* argv[])
auto adapter = communicator->createObjectAdapterWithEndpoints("GreeterAdapter", "tcp -p 4061");

// Register the Chatbot servant with the adapter.
adapter->add(make_shared<GreeterServer::Chatbot>(), Ice::stringToIdentity("greeter"));
adapter->add(make_shared<Server::Chatbot>(), Ice::stringToIdentity("greeter"));

// Start dispatching requests.
adapter->activate();
Expand Down
2 changes: 1 addition & 1 deletion cpp/Ice/greeter/ServerAMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ main(int argc, char* argv[])
auto adapter = communicator->createObjectAdapterWithEndpoints("GreeterAdapter", "tcp -p 4061");

// Register the Chatbot servant with the adapter.
adapter->add(make_shared<GreeterServerAMD::Chatbot>(), Ice::stringToIdentity("greeter"));
adapter->add(make_shared<ServerAMD::Chatbot>(), Ice::stringToIdentity("greeter"));

// Start dispatching requests.
adapter->activate();
Expand Down
2 changes: 1 addition & 1 deletion csharp/Ice/Config/Server/Chatbot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using VisitorCenter;

namespace ConfigServer;
namespace Server;

/// <summary>A Chatbot is an Ice servant that implements Slice interface Greeter.</summary>
internal class Chatbot : GreeterDisp_
Expand Down
4 changes: 1 addition & 3 deletions csharp/Ice/Config/Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright (c) ZeroC, Inc.

using ConfigServer;

// Create an Ice communicator to initialize the Ice runtime. The communicator gets its configuration properties from
// file config.server, in the server's current working directory. The communicator initialization also parses the
// command-line options to find and set additional properties.
Expand All @@ -12,7 +10,7 @@
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("GreeterAdapter");

// Register the Chatbot servant with the adapter.
adapter.add(new Chatbot(), Ice.Util.stringToIdentity("greeter"));
adapter.add(new Server.Chatbot(), Ice.Util.stringToIdentity("greeter"));

// Start dispatching requests.
adapter.activate();
Expand Down
2 changes: 1 addition & 1 deletion csharp/Ice/Greeter/Server/Chatbot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using VisitorCenter;

namespace GreeterServer;
namespace Server;

/// <summary>A Chatbot is an Ice servant that implements Slice interface Greeter.</summary>
internal class Chatbot : GreeterDisp_
Expand Down
4 changes: 1 addition & 3 deletions csharp/Ice/Greeter/Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Copyright (c) ZeroC, Inc.

using GreeterServer;

// Create an Ice communicator to initialize the Ice runtime. The communicator is disposed before the program exits.
using Ice.Communicator communicator = Ice.Util.initialize(ref args);

// Create an object adapter that listens for incoming requests and dispatches them to servants.
Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("GreeterAdapter", "tcp -p 4061");

// Register the Chatbot servant with the adapter.
adapter.add(new Chatbot(), Ice.Util.stringToIdentity("greeter"));
adapter.add(new Server.Chatbot(), Ice.Util.stringToIdentity("greeter"));

// Start dispatching requests.
adapter.activate();
Expand Down
2 changes: 1 addition & 1 deletion csharp/Ice/Greeter/ServerAMD/Chatbot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using VisitorCenter;

namespace GreeterServerAMD;
namespace ServerAMD;

/// <summary>A Chatbot is an Ice servant that implements Slice interface Greeter.</summary>
internal class Chatbot : GreeterDisp_
Expand Down
4 changes: 1 addition & 3 deletions csharp/Ice/Greeter/ServerAMD/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// Copyright (c) ZeroC, Inc.

using GreeterServerAMD;

// Create an Ice communicator to initialize the Ice runtime. The communicator is disposed before the program exits.
using Ice.Communicator communicator = Ice.Util.initialize(ref args);

// Create an object adapter that listens for incoming requests and dispatches them to servants.
Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("GreeterAdapter", "tcp -p 4061");

// Register the Chatbot servant with the adapter.
adapter.add(new Chatbot(), Ice.Util.stringToIdentity("greeter"));
adapter.add(new ServerAMD.Chatbot(), Ice.Util.stringToIdentity("greeter"));

// Start dispatching requests.
adapter.activate();
Expand Down
2 changes: 1 addition & 1 deletion swift/Ice/greeter/Sources/Server/Chatbot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Ice

/// A Chatbot is an Ice servant that implements Slice interface Greeter.
class ChatBot: Greeter {
class Chatbot: Greeter {

// Implements the protocol method greet from the Greeter protocol generated by the Slice compiler.
func greet(name: String, current _: Ice.Current) throws -> String {
Expand Down
2 changes: 1 addition & 1 deletion swift/Ice/greeter/Sources/Server/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let adapter = try communicator.createObjectAdapterWithEndpoints(
name: "GreeterAdapter", endpoints: "tcp -p 4061")

// Register the Chatbot servant with the adapter.
try adapter.add(servant: GreeterDisp(ChatBot()), id: Ice.stringToIdentity("greeter"))
try adapter.add(servant: GreeterDisp(Chatbot()), id: Ice.stringToIdentity("greeter"))

// Start dispatching requests.
try adapter.activate()
Expand Down

0 comments on commit b1cd934

Please sign in to comment.