mirror of
https://github.com/oatpp/oatpp.git
synced 2025-04-18 19:00:23 +08:00
Compatibility(MSVC): rename 'interface' to '_interface'. (#458)
This commit is contained in:
parent
1542f469f7
commit
809b3fb3f1
@ -29,8 +29,8 @@ namespace oatpp { namespace network { namespace virtual_ {
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ListenerLock
|
||||
|
||||
Interface::ListenerLock::ListenerLock(Interface* interface)
|
||||
: m_interface(interface)
|
||||
Interface::ListenerLock::ListenerLock(Interface* _interface)
|
||||
: m_interface(_interface)
|
||||
{}
|
||||
|
||||
Interface::ListenerLock::~ListenerLock() {
|
||||
@ -45,17 +45,17 @@ Interface::ListenerLock::~ListenerLock() {
|
||||
std::recursive_mutex Interface::m_registryMutex;
|
||||
std::unordered_map<oatpp::String, std::weak_ptr<Interface>> Interface::m_registry;
|
||||
|
||||
void Interface::registerInterface(const std::shared_ptr<Interface>& interface) {
|
||||
void Interface::registerInterface(const std::shared_ptr<Interface>& _interface) {
|
||||
|
||||
std::lock_guard<std::recursive_mutex> lock(m_registryMutex);
|
||||
|
||||
auto it = m_registry.find(interface->getName());
|
||||
auto it = m_registry.find(_interface->getName());
|
||||
if(it != m_registry.end()) {
|
||||
throw std::runtime_error
|
||||
("[oatpp::network::virtual_::Interface::registerInterface()]: Error. Interface with such name already exists - '" + *interface->getName() + "'.");
|
||||
("[oatpp::network::virtual_::Interface::registerInterface()]: Error. Interface with such name already exists - '" + *_interface->getName() + "'.");
|
||||
}
|
||||
|
||||
m_registry.insert({interface->getName(), interface});
|
||||
m_registry.insert({_interface->getName(), _interface});
|
||||
|
||||
}
|
||||
|
||||
@ -104,9 +104,9 @@ std::shared_ptr<Interface> Interface::obtainShared(const oatpp::String& name) {
|
||||
return it->second.lock();
|
||||
}
|
||||
|
||||
std::shared_ptr<Interface> interface(new Interface(name));
|
||||
registerInterface(interface);
|
||||
return interface;
|
||||
std::shared_ptr<Interface> _interface(new Interface(name));
|
||||
registerInterface(_interface);
|
||||
return _interface;
|
||||
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ private:
|
||||
static std::recursive_mutex m_registryMutex;
|
||||
static std::unordered_map<oatpp::String, std::weak_ptr<Interface>> m_registry;
|
||||
private:
|
||||
static void registerInterface(const std::shared_ptr<Interface>& interface);
|
||||
static void registerInterface(const std::shared_ptr<Interface>& _interface);
|
||||
static void unregisterInterface(const oatpp::String& name);
|
||||
public:
|
||||
|
||||
@ -54,7 +54,7 @@ public:
|
||||
private:
|
||||
Interface* m_interface;
|
||||
private:
|
||||
ListenerLock(Interface* interface);
|
||||
ListenerLock(Interface* _interface);
|
||||
public:
|
||||
~ListenerLock();
|
||||
};
|
||||
|
@ -31,9 +31,9 @@ void ConnectionProvider::ConnectionInvalidator::invalidate(const std::shared_ptr
|
||||
socket->close();
|
||||
}
|
||||
|
||||
ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface>& interface)
|
||||
ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface>& _interface)
|
||||
: m_invalidator(std::make_shared<ConnectionInvalidator>())
|
||||
, m_interface(interface)
|
||||
, m_interface(_interface)
|
||||
, m_maxAvailableToRead(-1)
|
||||
, m_maxAvailableToWrite(-1)
|
||||
{
|
||||
@ -41,8 +41,8 @@ ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface
|
||||
setProperty(PROPERTY_PORT, "0");
|
||||
}
|
||||
|
||||
std::shared_ptr<ConnectionProvider> ConnectionProvider::createShared(const std::shared_ptr<virtual_::Interface>& interface) {
|
||||
return std::make_shared<ConnectionProvider>(interface);
|
||||
std::shared_ptr<ConnectionProvider> ConnectionProvider::createShared(const std::shared_ptr<virtual_::Interface>& _interface) {
|
||||
return std::make_shared<ConnectionProvider>(_interface);
|
||||
}
|
||||
|
||||
void ConnectionProvider::stop() {
|
||||
@ -76,11 +76,11 @@ ConnectionProvider::getAsync() {
|
||||
public:
|
||||
|
||||
ConnectCoroutine(const std::shared_ptr<ConnectionInvalidator>& invalidator,
|
||||
const std::shared_ptr<virtual_::Interface>& interface,
|
||||
const std::shared_ptr<virtual_::Interface>& _interface,
|
||||
v_io_size maxAvailableToRead,
|
||||
v_io_size maxAvailableToWrite)
|
||||
: m_invalidator(invalidator)
|
||||
, m_interface(interface)
|
||||
, m_interface(_interface)
|
||||
, m_maxAvailableToRead(maxAvailableToRead)
|
||||
, m_maxAvailableToWrite(maxAvailableToWrite)
|
||||
{}
|
||||
|
@ -57,14 +57,14 @@ public:
|
||||
* Constructor.
|
||||
* @param interface - &id:oatpp::network::virtual_::Interface;.
|
||||
*/
|
||||
ConnectionProvider(const std::shared_ptr<virtual_::Interface>& interface);
|
||||
ConnectionProvider(const std::shared_ptr<virtual_::Interface>& _interface);
|
||||
|
||||
/**
|
||||
* Create shared ConnectionProvider.
|
||||
* @param interface - &id:oatpp::network::virtual_::Interface;.
|
||||
* @return - `std::shared_ptr` to ConnectionProvider.
|
||||
*/
|
||||
static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<virtual_::Interface>& interface);
|
||||
static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<virtual_::Interface>& _interface);
|
||||
|
||||
/**
|
||||
* Limit the available amount of bytes to read from socket and limit the available amount of bytes to write to socket. <br>
|
||||
|
@ -33,10 +33,10 @@ void ConnectionProvider::ConnectionInvalidator::invalidate(const std::shared_ptr
|
||||
socket->close();
|
||||
}
|
||||
|
||||
ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface>& interface)
|
||||
ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface>& _interface)
|
||||
: m_invalidator(std::make_shared<ConnectionInvalidator>())
|
||||
, m_interface(interface)
|
||||
, m_listenerLock(interface->bind())
|
||||
, m_interface(_interface)
|
||||
, m_listenerLock(_interface->bind())
|
||||
, m_open(true)
|
||||
, m_maxAvailableToRead(-1)
|
||||
, m_maxAvailableToWrite(-1)
|
||||
@ -45,8 +45,8 @@ ConnectionProvider::ConnectionProvider(const std::shared_ptr<virtual_::Interface
|
||||
setProperty(PROPERTY_PORT, "0");
|
||||
}
|
||||
|
||||
std::shared_ptr<ConnectionProvider> ConnectionProvider::createShared(const std::shared_ptr<virtual_::Interface>& interface) {
|
||||
return std::make_shared<ConnectionProvider>(interface);
|
||||
std::shared_ptr<ConnectionProvider> ConnectionProvider::createShared(const std::shared_ptr<virtual_::Interface>& _interface) {
|
||||
return std::make_shared<ConnectionProvider>(_interface);
|
||||
}
|
||||
|
||||
void ConnectionProvider::setSocketMaxAvailableToReadWrtie(v_io_size maxToRead, v_io_size maxToWrite) {
|
||||
|
@ -58,14 +58,14 @@ public:
|
||||
* Constructor.
|
||||
* @param interface - &id:oatpp::network::virtual_::Interface;.
|
||||
*/
|
||||
ConnectionProvider(const std::shared_ptr<virtual_::Interface>& interface);
|
||||
ConnectionProvider(const std::shared_ptr<virtual_::Interface>& _interface);
|
||||
|
||||
/**
|
||||
* Create shared ConnectionProvider.
|
||||
* @param interface - &id:oatpp::network::virtual_::Interface;.
|
||||
* @return - `std::shared_ptr` to ConnectionProvider.
|
||||
*/
|
||||
static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<virtual_::Interface>& interface);
|
||||
static std::shared_ptr<ConnectionProvider> createShared(const std::shared_ptr<virtual_::Interface>& _interface);
|
||||
|
||||
/**
|
||||
* Limit the available amount of bytes to read from socket and limit the available amount of bytes to write to socket. <br>
|
||||
|
@ -45,9 +45,9 @@ namespace {
|
||||
oatpp::String m_dataSample;
|
||||
public:
|
||||
|
||||
ClientTask(const std::shared_ptr<Interface>& interface,
|
||||
ClientTask(const std::shared_ptr<Interface>& _interface,
|
||||
const oatpp::String& dataSample)
|
||||
: m_interface(interface)
|
||||
: m_interface(_interface)
|
||||
, m_dataSample(dataSample)
|
||||
{}
|
||||
|
||||
@ -107,10 +107,10 @@ namespace {
|
||||
v_int32 m_numTasks;
|
||||
public:
|
||||
|
||||
Server(const std::shared_ptr<Interface>& interface,
|
||||
Server(const std::shared_ptr<Interface>& _interface,
|
||||
const oatpp::String& dataSample,
|
||||
v_int32 numTasks)
|
||||
: m_interface(interface)
|
||||
: m_interface(_interface)
|
||||
, m_dataSample(dataSample)
|
||||
, m_numTasks(numTasks)
|
||||
{}
|
||||
@ -134,17 +134,17 @@ void InterfaceTest::onRun() {
|
||||
|
||||
oatpp::String dataSample = "1234567890-=][poiuytrewqasdfghjkl;'/.,mnbvcxzzxcvbnm,./';lkjhgfdsaqwertyuiop][=-0987654321";
|
||||
|
||||
auto interface = Interface::obtainShared("virtualhost");
|
||||
auto bindLock = interface->bind();
|
||||
auto _interface = Interface::obtainShared("virtualhost");
|
||||
auto bindLock = _interface->bind();
|
||||
|
||||
v_int32 numTasks = 100;
|
||||
|
||||
ThreadList threadList;
|
||||
|
||||
std::thread server(&Server::run, Server(interface, dataSample, numTasks));
|
||||
std::thread server(&Server::run, Server(_interface, dataSample, numTasks));
|
||||
|
||||
for(v_int32 i = 0; i < numTasks; i++) {
|
||||
threadList.push_back(std::thread(&ClientTask::run, ClientTask(interface, dataSample)));
|
||||
threadList.push_back(std::thread(&ClientTask::run, ClientTask(_interface, dataSample)));
|
||||
}
|
||||
|
||||
for(auto& thread : threadList) {
|
||||
|
@ -70,9 +70,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) { // Use oatpp virtual interface
|
||||
auto interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
auto _interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -109,9 +109,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
auto interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
auto _interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -72,9 +72,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -101,9 +101,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -75,9 +75,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -104,9 +104,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) { // Use oatpp virtual interface
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -101,9 +101,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -67,9 +67,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) { // Use oatpp virtual interface
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -96,9 +96,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -63,9 +63,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) { // Use oatpp virtual interface
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ServerConnectionProvider>(
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
@ -91,9 +91,9 @@ public:
|
||||
OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ClientConnectionProvider>, clientConnectionProvider)([this] {
|
||||
|
||||
if(m_port == 0) {
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, interface);
|
||||
OATPP_COMPONENT(std::shared_ptr<oatpp::network::virtual_::Interface>, _interface);
|
||||
return std::static_pointer_cast<oatpp::network::ClientConnectionProvider>(
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(interface)
|
||||
oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -178,9 +178,9 @@ void ServerStopTest::onRun() {
|
||||
std::shared_ptr<oatpp::network::ClientConnectionProvider> clientConnectionProvider;
|
||||
|
||||
if(m_port == 0) {
|
||||
auto interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
serverConnectionProvider = oatpp::network::virtual_::server::ConnectionProvider::createShared(interface);
|
||||
clientConnectionProvider = oatpp::network::virtual_::client::ConnectionProvider::createShared(interface);
|
||||
auto _interface = oatpp::network::virtual_::Interface::obtainShared("virtualhost");
|
||||
serverConnectionProvider = oatpp::network::virtual_::server::ConnectionProvider::createShared(_interface);
|
||||
clientConnectionProvider = oatpp::network::virtual_::client::ConnectionProvider::createShared(_interface);
|
||||
} else {
|
||||
serverConnectionProvider = oatpp::network::tcp::server::ConnectionProvider::createShared({"localhost", 8000});
|
||||
clientConnectionProvider = oatpp::network::tcp::client::ConnectionProvider::createShared({"localhost", 8000});
|
||||
|
Loading…
x
Reference in New Issue
Block a user