Merge branch 'development' into cmake/SPEC-7182

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Code/Editor/QtUtil.h
#	Code/Legacy/CryCommon/Linux_Win32Wrapper.h
#	Code/Legacy/CryCommon/ProjectDefines.h
#	Code/Legacy/CryCommon/StringUtils.h
#	Code/Legacy/CryCommon/UnicodeBinding.h
#	Code/Legacy/CryCommon/UnicodeEncoding.h
#	Code/Legacy/CryCommon/UnicodeFunctions.h
#	Code/Legacy/CryCommon/UnicodeIterator.h
#	Code/Legacy/CryCommon/WinBase.cpp
#	Code/Legacy/CryCommon/platform.h
#	Code/Legacy/CryCommon/platform_impl.cpp
#	Gems/LyShine/Code/Source/Animation/UiAnimationSystem.cpp
#	Gems/Maestro/Code/Source/Cinematics/Movie.cpp
This commit is contained in:
Esteban Papp
2021-08-11 11:16:24 -07:00
463 changed files with 2873 additions and 18373 deletions
@@ -417,12 +417,12 @@ namespace GridMate
{
GM_CLASS_ALLOCATOR(Connection); // make a pool and use it...
Connection(CarrierThread* threadOwner, const string& address);
Connection(CarrierThread* threadOwner, const AZStd::string& address);
~Connection();
CarrierThread* m_threadOwner; ///< Pointer to the carrier thread that operates with this connection.
AZStd::atomic<struct ThreadConnection*> m_threadConn; ///< Pointer to a thread connection. You can use it in the main thread only for a reference.
string m_fullAddress; ///< Connection full address.
AZStd::string m_fullAddress; ///< Connection full address.
Carrier::ConnectionStates m_state;
@@ -604,7 +604,7 @@ namespace GridMate
Connection* m_connection;
ThreadConnection* m_threadConnection;
string m_newConnectionAddress;
AZStd::string m_newConnectionAddress;
CarrierErrorCode m_errorCode;
AZ::u32 m_newRateBytesPerSec; ///< new send rate
AZStd::vector<AZStd::unique_ptr<CarrierACKCallback> > m_ackCallbacks;
@@ -999,7 +999,7 @@ namespace GridMate
/// Connect with host and port. This is ASync operation, the connection is active after OnConnectionEstablished is called.
ConnectionID Connect(const char* hostAddress, unsigned int port) override;
/// Connect with internal address format. This is ASync operation, the connection is active after OnConnectionEstablished is called.
ConnectionID Connect(const string& address) override;
ConnectionID Connect(const AZStd::string& address) override;
/// Request a disconnect procedure. This is ASync operation, the connection is closed after OnDisconnect is called.
void Disconnect(ConnectionID id) override;
@@ -1007,7 +1007,7 @@ namespace GridMate
unsigned int GetMessageMTU() override { return m_maxMsgDataSizeBytes; }
string ConnectionToAddress(ConnectionID id) override;
AZStd::string ConnectionToAddress(ConnectionID id) override;
void SendWithCallback(const char* data, unsigned int dataSize, AZStd::unique_ptr<CarrierACKCallback> ackCallback, ConnectionID target = AllConnections, DataReliability reliability = SEND_RELIABLE, DataPriority priority = PRIORITY_NORMAL, unsigned char channel = 0) override;
void Send(const char* data, unsigned int dataSize, ConnectionID target = AllConnections, DataReliability reliability = SEND_RELIABLE, DataPriority priority = PRIORITY_NORMAL, unsigned char channel = 0) override
@@ -1118,7 +1118,7 @@ using namespace GridMate;
// Connection
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
Connection::Connection(CarrierThread* threadOwner, const string& address)
Connection::Connection(CarrierThread* threadOwner, const AZStd::string& address)
: m_threadOwner(threadOwner)
, m_threadConn(NULL)
, m_fullAddress(address)
@@ -3740,7 +3740,7 @@ CarrierImpl::Connect(const char* hostAddress, unsigned int port)
// [1/12/2011]
//=========================================================================
ConnectionID
CarrierImpl::Connect(const string& address)
CarrierImpl::Connect(const AZStd::string& address)
{
// check if we don't have it in the list.
for(auto& i : m_connections)
@@ -3902,10 +3902,10 @@ CarrierImpl::DeleteConnection(Connection* conn, CarrierDisconnectReason reason)
// Carrier
// [9/14/2010]
//=========================================================================
string
AZStd::string
CarrierImpl::ConnectionToAddress(ConnectionID id)
{
string str;
AZStd::string str;
AZ_Assert(id != InvalidConnectionID, "Invalid connection id!");
if (id != InvalidConnectionID)
{
@@ -4911,7 +4911,7 @@ DefaultCarrier::Create(const CarrierDesc& desc, IGridMate* gridMate)
// ReasonToString
// [4/11/2011]
//=========================================================================
string
AZStd::string
CarrierEventsBase::ReasonToString(CarrierDisconnectReason reason)
{
const char* reasonStr = 0;
@@ -4951,5 +4951,5 @@ CarrierEventsBase::ReasonToString(CarrierDisconnectReason reason)
reasonStr = "Unknown reason";
}
return string(reasonStr);
return AZStd::string(reasonStr);
}
@@ -9,7 +9,6 @@
#define GM_CARRIER_H
#include <GridMate/Types.h>
#include <GridMate/String/string.h>
#include <GridMate/EBus.h>
#include <GridMate/Carrier/Compressor.h>
#include <GridMate/Carrier/Driver.h>
@@ -88,7 +87,7 @@ namespace GridMate
/// Connect with host and port. This is ASync operation, the connection is active after OnConnectionEstablished is called.
virtual ConnectionID Connect(const char* hostAddress, unsigned int port) = 0;
/// Connect with internal address format. This is ASync operation, the connection is active after OnConnectionEstablished is called.
virtual ConnectionID Connect(const string& address) = 0;
virtual ConnectionID Connect(const AZStd::string& address) = 0;
/// Request a disconnect procedure. This is ASync operation, the connection is closed after OnDisconnect is called.
virtual void Disconnect(ConnectionID id) = 0;
@@ -100,7 +99,7 @@ namespace GridMate
/// Returns maximum message size (with splitting or without). Splitting will make your message reliable, which might not be optimal for Unreliable messages. It's better to send two unreliable.
//virtual unsigned int GetMaxMessageSize(bool withSplitting = true) = 0;
virtual string ConnectionToAddress(ConnectionID id) = 0;
virtual AZStd::string ConnectionToAddress(ConnectionID id) = 0;
/**
* Sends buffer with an ACK callback. When the transport layer recieves an ACK it will run the callback.
@@ -401,7 +400,7 @@ namespace GridMate
public:
virtual ~CarrierEventsBase() {}
string ReasonToString(CarrierDisconnectReason reason);
AZStd::string ReasonToString(CarrierDisconnectReason reason);
};
class CarrierEvents
@@ -517,7 +516,7 @@ namespace GridMate
// Traffic control
/// Called every second when you update last second statistics
virtual void OnUpdateStatistics(const GridMate::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime) = 0;
virtual void OnUpdateStatistics(const AZStd::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime) = 0;
// Simulator
/// Enable/Disable
@@ -98,7 +98,7 @@ DefaultHandshake::OnConfirmAck(ConnectionID id, ReadBuffer& rb)
// [11/5/2010]
//=========================================================================
bool
DefaultHandshake::OnNewConnection(const string& address)
DefaultHandshake::OnNewConnection(const AZStd::string& address)
{
(void)address;
return true; /// We don't have a ban list yet
@@ -9,6 +9,7 @@
#define GM_DEFAULT_HANDSHAKE_H
#include <GridMate/Carrier/Handshake.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
@@ -47,7 +48,7 @@ namespace GridMate
*/
virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb);
/// Return true if you want to reject early reject a connection.
virtual bool OnNewConnection(const string& address);
virtual bool OnNewConnection(const AZStd::string& address);
/// Called when we close a connection.
virtual void OnDisconnect(ConnectionID id);
/// Return timeout in milliseconds of the handshake procedure.
@@ -12,6 +12,7 @@
#include <AzCore/Math/Crc.h>
#include <AzCore/Math/MathUtils.h>
#include <AzCore/std/string/string.h>
using namespace GridMate;
@@ -12,6 +12,8 @@
#include <GridMate/Containers/list.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
/**
@@ -145,7 +147,7 @@ namespace GridMate
StatisticData m_sdEffectiveLastSecond; ///< Last second statistics for effective data.
StatisticData m_sdEffectiveCurrentSecond; ///< Elapsing second statistics for effective data.
string m_address; ///< Full address for this connection. (we need for debug only)
AZStd::string m_address; ///< Full address for this connection. (we need for debug only)
unsigned int m_recvPacketAllowance; ///< Current allowance for number of incoming packets
bool m_canReceiveData; ///< Able to receive data on this connection
@@ -10,10 +10,9 @@
#include <GridMate/Types.h>
#include <GridMate/String/string.h>
#include <AzCore/std/delegate/delegate.h>
#include <AzCore/std/smart_ptr/intrusive_ptr.h>
#include <AzCore/std/string/conversions.h>
namespace GridMate
{
@@ -139,8 +138,8 @@ namespace GridMate
/// @{ Address conversion functionality. They MUST implemented thread safe. Generally this is not a problem since they just part local data.
/// Create address from ip and port. If ip == NULL we will assign a broadcast address.
virtual string IPPortToAddress(const char* ip, unsigned int port) const = 0;
virtual bool AddressToIPPort(const string& address, string& ip, unsigned int& port) const = 0;
virtual AZStd::string IPPortToAddress(const char* ip, unsigned int port) const = 0;
virtual bool AddressToIPPort(const AZStd::string& address, AZStd::string& ip, unsigned int& port) const = 0;
/// @}
/**
@@ -150,7 +149,7 @@ namespace GridMate
* \note Driver address allocates internal resources, use it only when you intend to communicate. Otherwise operate with
* the string address.
*/
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const string& address) = 0;
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const AZStd::string& address) = 0;
/**
* Returns true if the driver can accept new data (ex, has buffer space).
@@ -188,11 +187,11 @@ namespace GridMate
virtual ~DriverAddress() {}
virtual string ToString() const = 0;
virtual AZStd::string ToString() const = 0;
virtual string ToAddress() const = 0;
virtual AZStd::string ToAddress() const = 0;
virtual string GetIP() const = 0;
virtual AZStd::string GetIP() const = 0;
virtual unsigned int GetPort() const = 0;
@@ -10,7 +10,7 @@
#include <GridMate/Types.h>
#include <GridMate/Serialize/Buffer.h>
#include <GridMate/String/string.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
@@ -53,7 +53,7 @@ namespace GridMate
*/
virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) = 0;
/// Return true if you want to reject early reject a connection.
virtual bool OnNewConnection(const string& address) = 0;
virtual bool OnNewConnection(const AZStd::string& address) = 0;
/// Called when we close a connection.
virtual void OnDisconnect(ConnectionID id) = 0;
/// Return timeout in milliseconds of the handshake procedure.
@@ -1712,7 +1712,7 @@ namespace GridMate
}
// Calculate HMAC of buffer using the secret and peer address
GridMate::string addrStr = endpoint->ToAddress();
AZStd::string addrStr = endpoint->ToAddress();
unsigned char result[EVP_MAX_MD_SIZE];
unsigned int resultLen = 0;
HMAC(EVP_sha1(), m_cookieSecret.m_currentSecret, sizeof(m_cookieSecret.m_currentSecret),
@@ -1745,7 +1745,7 @@ namespace GridMate
}
// Calculate HMAC of buffer using the secret and peer address
GridMate::string addrStr = endpoint->ToAddress();
AZStd::string addrStr = endpoint->ToAddress();
unsigned char result[EVP_MAX_MD_SIZE];
unsigned int resultLen = 0;
HMAC(EVP_sha1(), m_cookieSecret.m_currentSecret, COOKIE_SECRET_LENGTH,
@@ -1809,7 +1809,7 @@ namespace GridMate
#ifdef AZ_DebugUseSocketDebugLog
if (handshake)
{
GridMate::string line = GridMate::string::format("%lld | [%08x] RawRecv %s size %d connection exists\n", AZStd::chrono::system_clock::now().time_since_epoch().count(), this, type, bytesReceived);
AZStd::string line = AZStd::string::format("%lld | [%08x] RawRecv %s size %d connection exists\n", AZStd::chrono::system_clock::now().time_since_epoch().count(), this, type, bytesReceived);
connection->m_dbgLog += line;
}
#endif
@@ -23,7 +23,7 @@
//#define AZ_DebugSecureSocket AZ_TracePrintf
//#define AZ_DebugSecureSocketConnection(window, fmt, ...) \
//{\
// GridMate::string line = GridMate::string::format(fmt, __VA_ARGS__);\
// AZStd::string line = AZStd::string::format(fmt, __VA_ARGS__);\
// this->m_dbgLog += line;\
//}
@@ -226,7 +226,7 @@ namespace GridMate
int m_dbgDgramsReceived;
int m_dbgPort;
#ifdef AZ_DebugUseSocketDebugLog
GridMate::string m_dbgLog;
AZStd::string m_dbgLog;
#endif
};
@@ -262,7 +262,7 @@ namespace GridMate
AZ::u32 m_maxTempBufferSize;
AZStd::queue<DatagramAddr> m_globalInQueue;
AZStd::unordered_map<SocketDriverAddress, Connection*, SocketDriverAddress::Hasher> m_connections;
AZStd::unordered_map<string, int> m_ipToNumConnections;
AZStd::unordered_map<AZStd::string, int> m_ipToNumConnections;
SecureSocketDesc m_desc;
AZStd::chrono::system_clock::time_point m_lastTimerCheck; ///Time last timers were checked
};
@@ -18,7 +18,6 @@
//#define AZ_LOG_UNBOUND_SEND_RECEIVE
#include <GridMate/Containers/unordered_set.h>
#include <GridMate/String/string.h>
#include <GridMate/Carrier/DriverEvents.h>
#include <AzCore/std/chrono/types.h>
@@ -498,7 +497,7 @@ namespace GridMate
}
}
SocketDriverAddress::SocketDriverAddress(Driver* driver, const string& ip, unsigned int port)
SocketDriverAddress::SocketDriverAddress(Driver* driver, const AZStd::string& ip, unsigned int port)
: DriverAddress(driver)
{
AZ_Assert(!ip.empty(), "Invalid address string!");
@@ -575,7 +574,7 @@ namespace GridMate
return !(*this == rhs);
}
string SocketDriverAddress::ToString() const
AZStd::string SocketDriverAddress::ToString() const
{
char ip[64];
unsigned short port;
@@ -590,15 +589,15 @@ namespace GridMate
port = ntohs(m_sockAddr.sin_port);
}
return string::format("%s|%d", ip, port);
return AZStd::string::format("%s|%d", ip, port);
}
string SocketDriverAddress::ToAddress() const
AZStd::string SocketDriverAddress::ToAddress() const
{
return ToString();
}
string SocketDriverAddress::GetIP() const
AZStd::string SocketDriverAddress::GetIP() const
{
char ip[64];
if (m_sockAddr.sin_family == AF_INET6)
@@ -609,7 +608,7 @@ namespace GridMate
{
inet_ntop(AF_INET, const_cast<void*>(reinterpret_cast<const void*>(&m_sockAddr.sin_addr)), ip, AZ_ARRAY_SIZE(ip));
}
return string(ip);
return AZStd::string(ip);
}
unsigned int SocketDriverAddress::GetPort() const
@@ -1144,11 +1143,11 @@ namespace GridMate
// CreateSocketDriver
// [3/4/2013]
//=========================================================================
string
AZStd::string
SocketDriverCommon::IPPortToAddressString(const char* ip, unsigned int port)
{
AZ_Assert(ip != nullptr, "Invalid address!");
return string::format("%s|%d", ip, port);
return AZStd::string::format("%s|%d", ip, port);
}
//=========================================================================
@@ -1156,17 +1155,17 @@ namespace GridMate
// [3/4/2013]
//=========================================================================
bool
SocketDriverCommon::AddressStringToIPPort(const string& address, string& ip, unsigned int& port)
SocketDriverCommon::AddressStringToIPPort(const AZStd::string& address, AZStd::string& ip, unsigned int& port)
{
AZStd::size_t pos = address.find('|');
AZ_Assert(pos != string::npos, "Invalid driver address!");
if (pos == string::npos)
AZ_Assert(pos != AZStd::string::npos, "Invalid driver address!");
if (pos == AZStd::string::npos)
{
return false;
}
ip = string(address.begin(), address.begin() + pos);
port = AZStd::stoi(string(address.begin() + pos + 1, address.end()));
ip = AZStd::string(address.begin(), address.begin() + pos);
port = AZStd::stoi(AZStd::string(address.begin() + pos + 1, address.end()));
return true;
}
@@ -1176,16 +1175,16 @@ namespace GridMate
// [7/11/2013]
//=========================================================================
Driver::BSDSocketFamilyType
SocketDriverCommon::AddressFamilyType(const string& ip)
SocketDriverCommon::AddressFamilyType(const AZStd::string& ip)
{
// TODO: We can/should use inet_ntop() to detect the family type
AZStd::size_t pos = ip.find(".");
if (pos != string::npos)
if (pos != AZStd::string::npos)
{
return BSD_AF_INET;
}
pos = ip.find("::");
if (pos != string::npos)
if (pos != AZStd::string::npos)
{
return BSD_AF_INET6;
}
@@ -1198,13 +1197,13 @@ namespace GridMate
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//=========================================================================
// CreateDriverAddress(const string&)
// CreateDriverAddress(const AZStd::string&)
// [1/12/2011]
//=========================================================================
AZStd::intrusive_ptr<DriverAddress>
SocketDriver::CreateDriverAddress(const string& address)
SocketDriver::CreateDriverAddress(const AZStd::string& address)
{
string ip;
AZStd::string ip;
unsigned int port;
if (!AddressToIPPort(address, ip, port))
{
@@ -1243,7 +1242,7 @@ namespace GridMate
namespace Utils
{
// \note function moved here to use addinfo when IPV6 is not in use, consider moving those definitions to a header file
bool GetIpByHostName(int familyType, const char* hostName, string& ip)
bool GetIpByHostName(int familyType, const char* hostName, AZStd::string& ip)
{
static const size_t kMaxLen = 64; // max length of ipv6 ip is 45 chars, so all ips should be able to fit in this buf
char ipBuf[kMaxLen];
@@ -83,14 +83,14 @@ namespace GridMate
SocketDriverAddress(Driver* driver);
SocketDriverAddress(Driver* driver, const sockaddr* addr);
SocketDriverAddress(Driver* driver, const string& ip, unsigned int port);
SocketDriverAddress(Driver* driver, const AZStd::string& ip, unsigned int port);
bool operator==(const SocketDriverAddress& rhs) const;
bool operator!=(const SocketDriverAddress& rhs) const;
virtual string ToString() const;
virtual string ToAddress() const;
virtual string GetIP() const;
virtual AZStd::string ToString() const;
virtual AZStd::string ToAddress() const;
virtual AZStd::string GetIP() const;
virtual unsigned int GetPort() const;
virtual const void* GetTargetAddress(unsigned int& addressSize) const;
@@ -163,18 +163,18 @@ namespace GridMate
/// @{ Address conversion functionality. They MUST implemented thread safe. Generally this is not a problem since they just part local data.
/// Create address from ip and port. If ip == NULL we will assign a broadcast address.
virtual string IPPortToAddress(const char* ip, unsigned int port) const { return IPPortToAddressString(ip, port); }
virtual bool AddressToIPPort(const string& address, string& ip, unsigned int& port) const { return AddressStringToIPPort(address, ip, port); }
virtual AZStd::string IPPortToAddress(const char* ip, unsigned int port) const { return IPPortToAddressString(ip, port); }
virtual bool AddressToIPPort(const AZStd::string& address, AZStd::string& ip, unsigned int& port) const { return AddressStringToIPPort(address, ip, port); }
/// Create address for the socket driver from IP and port
static string IPPortToAddressString(const char* ip, unsigned int port);
static AZStd::string IPPortToAddressString(const char* ip, unsigned int port);
/// Decompose an address to IP and port
static bool AddressStringToIPPort(const string& address, string& ip, unsigned int& port);
static bool AddressStringToIPPort(const AZStd::string& address, AZStd::string& ip, unsigned int& port);
/// Return the family type of the address (AF_INET,AF_INET6 AF_UNSPEC)
static BSDSocketFamilyType AddressFamilyType(const string& ip);
static BSDSocketFamilyType AddressFamilyType(const char* ip) { return AddressFamilyType(string(ip)); }
static BSDSocketFamilyType AddressFamilyType(const AZStd::string& ip);
static BSDSocketFamilyType AddressFamilyType(const char* ip) { return AddressFamilyType(AZStd::string(ip)); }
/// @}
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const string& address) = 0;
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const AZStd::string& address) = 0;
/// Additional CreateDriverAddress function should be implemented.
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const sockaddr* sockAddr) = 0;
@@ -352,7 +352,7 @@ namespace GridMate
* \note Driver address allocates internal resources, use it only when you intend to communicate. Otherwise operate with
* the string address.
*/
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const string& address);
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const AZStd::string& address);
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const sockaddr* addr);
/// Called only from the DriverAddress when the use count becomes 0
virtual void DestroyDriverAddress(DriverAddress* address);
@@ -364,7 +364,7 @@ namespace GridMate
namespace Utils
{
///< Retrieves ip address corresponding to a host name. Blocks thread until dns resolving is happened.
bool GetIpByHostName(int familyType, const char* hostName, string& ip);
bool GetIpByHostName(int familyType, const char* hostName, AZStd::string& ip);
}
/**
@@ -9,7 +9,6 @@
#define GM_TRAFFIC_CONTROL_H
#include <GridMate/Types.h>
#include <GridMate/String/string.h>
#include <AzCore/std/smart_ptr/intrusive_ptr.h>
@@ -8,14 +8,14 @@
#ifndef GM_CARRIER_UTILS_H
#define GM_CARRIER_UTILS_H
#include <GridMate/String/string.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
namespace Utils
{
///< Returns the machines address(ip) in a string. familyType is platform dependent.
string GetMachineAddress(int familyType = 0);
AZStd::string GetMachineAddress(int familyType = 0);
///< Returns a broadcast address based on a family type. On ipv6 we emulate broadbast using the multicast on the all nodes address (FF02::1). familyType is platform dependent.
const char* GetBroadcastAddress(int familyType = 0);
}
@@ -64,7 +64,7 @@ namespace GridMate
// OnUpdateStatistics
// [4/14/2011]
//=========================================================================
void CarrierDriller::OnUpdateStatistics(const GridMate::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime)
void CarrierDriller::OnUpdateStatistics(const AZStd::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime)
{
m_output->BeginTag(m_drillerTag);
m_output->BeginTag(AZ_CRC("Statistics", 0xe2d38b22));
@@ -42,7 +42,7 @@ namespace GridMate
//////////////////////////////////////////////////////////////////////////
// Carrier Driller Bus
void OnUpdateStatistics(const GridMate::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime) override;
void OnUpdateStatistics(const AZStd::string& address, const TrafficControl::Statistics& lastSecond, const TrafficControl::Statistics& lifeTime, const TrafficControl::Statistics& effectiveLastSecond, const TrafficControl::Statistics& effectiveLifeTime) override;
void OnConnectionStateChanged(Carrier* carrier, ConnectionID id, Carrier::ConnectionStates newState) override;
//////////////////////////////////////////////////////////////////////////
@@ -9,7 +9,6 @@
#include <GridMate/Replica/ReplicaChunk.h>
#include <GridMate/Replica/ReplicaChunkDescriptor.h>
#include <GridMate/Replica/RemoteProcedureCall.h>
#include <GridMate/String/string.h>
using namespace AZ::Debug;
@@ -224,7 +224,7 @@ namespace GridMate
// [4/15/2011]
//=========================================================================
void
SessionDriller::OnSessionError(GridSession* session, const string& errorMsg)
SessionDriller::OnSessionError(GridSession* session, const AZStd::string& errorMsg)
{
m_output->BeginTag(m_drillerTag);
m_output->BeginTag(AZ_CRC("SessionError", 0xc689cc40));
@@ -62,7 +62,7 @@ namespace GridMate
/// Callback that notifies the title when a session will be left. session pointer is NOT valid after the callback returns.
virtual void OnSessionDelete(GridSession* session);
/// Called when a session error occurs.
virtual void OnSessionError(GridSession* session, const string& errorMsg);
virtual void OnSessionError(GridSession* session, const AZStd::string& errorMsg);
/// Called when the actual game(match) starts
virtual void OnSessionStart(GridSession* session);
/// Called when the actual game(match) ends
@@ -9,7 +9,6 @@
#define GM_USER_SERVICE_TYPES_H
#include <GridMate/Types.h>
#include <GridMate/String/string.h>
namespace GridMate
{
@@ -12,7 +12,6 @@
#include <GridMate/Replica/RemoteProcedureCall.h>
#include <GridMate/Replica/ReplicaChunk.h>
#include <GridMate/Replica/ReplicaStatusInterface.h>
#include <GridMate/String/string.h>
#include <GridMate/Serialize/ContainerMarshal.h>
namespace GridMate
@@ -102,7 +101,7 @@ namespace GridMate
};
AZ::u8 m_flags;
string m_replicaName;
AZStd::string m_replicaName;
};
DataSet<ReplicaOptions, ReplicaOptions::Marshaler> m_options; // Flags and debug info
@@ -37,7 +37,7 @@ namespace GridMate
{
friend class LANMemberIDMarshaler;
static LANMemberID Create(MemberIDCompact id, const string& address)
static LANMemberID Create(MemberIDCompact id, const AZStd::string& address)
{
LANMemberID mid;
mid.m_id = id;
@@ -45,24 +45,24 @@ namespace GridMate
return mid;
}
void SetAddress(const string& address)
void SetAddress(const AZStd::string& address)
{
m_address = address;
}
MemberIDCompact GetID() const { return m_id; }
virtual string ToString() const
virtual AZStd::string ToString() const
{
return string::format("%x", m_id);
return AZStd::string::format("%x", m_id);
}
virtual string ToAddress() const { return m_address; }
virtual AZStd::string ToAddress() const { return m_address; }
virtual MemberIDCompact Compact() const { return m_id; }
virtual bool IsValid() const { return m_id != 0; }
private:
MemberIDCompact m_id;
string m_address;
AZStd::string m_address;
};
class LANMemberIDMarshaler
@@ -120,14 +120,14 @@ namespace GridMate
/// Creates the local player.
GridMember* CreateLocalMember(bool isHost, bool isInvited, RemotePeerMode peerMode);
/// Creates remote player, when he wants to join.
GridMember* CreateRemoteMember(const string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId = InvalidConnectionID) override;
GridMember* CreateRemoteMember(const AZStd::string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId = InvalidConnectionID) override;
/// Called when we receive the session replica. We create one and return the pointer.
LANSessionReplica* OnSessionReplicaArrived();
/// Called when session parameters have changed.
void OnSessionParamChanged(const GridSessionParam& param) override { (void)param; }
void OnSessionParamRemoved(const string& paramId) override { (void)paramId; }
void OnSessionParamRemoved(const AZStd::string& paramId) override { (void)paramId; }
private:
explicit LANSession(LANSessionService* service);
@@ -141,7 +141,7 @@ namespace GridMate
bool MatchMake(const LANSearchParams& sp);
string MakeSessionId();
AZStd::string MakeSessionId();
Driver* m_driver; ///< Driver for network searches
@@ -199,7 +199,7 @@ namespace GridMate
: public CtorContextBase
{
CtorDataSet<MemberIDCompact> m_memberId;
CtorDataSet<string> m_memberAddress; ///< As the server/host sees it!
CtorDataSet<AZStd::string> m_memberAddress; ///< As the server/host sees it!
CtorDataSet<RemotePeerMode> m_peerMode;
CtorDataSet<bool> m_isHost;
};
@@ -232,7 +232,7 @@ namespace GridMate
AZ_Assert(session, "We need to have a valid session!");
LANMember* member;
MemberIDCompact memberId = ctorContext.m_memberId.Get();
string memberAddress = ctorContext.m_memberAddress.Get();
AZStd::string memberAddress = ctorContext.m_memberAddress.Get();
RemotePeerMode remotePeerMode = ctorContext.m_peerMode.Get();
bool isMemberHost = ctorContext.m_isHost.Get();
@@ -349,7 +349,7 @@ namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName);
void AssignExtendedName(AZStd::string& extendedName);
}
}
@@ -364,7 +364,7 @@ LANMember::LANMember(const LANMemberID& id, LANSession* session)
: GridMember(id.Compact())
, m_memberId(id)
{
string extendedName;
AZStd::string extendedName;
Platform::AssignExtendedName(extendedName);
m_session = session;
@@ -741,8 +741,8 @@ LANSession::CreateLocalMember(bool isHost, bool isInvited, RemotePeerMode peerMo
{
AZ_Assert(m_myMember == nullptr, "We already have added a local member!");
string ip = Utils::GetMachineAddress(m_carrierDesc.m_familyType);
string address = SocketDriverCommon::IPPortToAddressString(ip.c_str(), m_carrierDesc.m_port);
AZStd::string ip = Utils::GetMachineAddress(m_carrierDesc.m_familyType);
AZStd::string address = SocketDriverCommon::IPPortToAddressString(ip.c_str(), m_carrierDesc.m_port);
/////////////////////////////////////////////////////////////////////////////
// TODO: Use the UUID as an ID, we will need to add marshalers and so on
AZ::Uuid uuid = AZ::Uuid::CreateRandom();
@@ -762,7 +762,7 @@ LANSession::CreateLocalMember(bool isHost, bool isInvited, RemotePeerMode peerMo
// [2/2/2011]
//==========================================================================
GridMember*
LANSession::CreateRemoteMember(const string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId)
LANSession::CreateRemoteMember(const AZStd::string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId)
{
MemberIDCompact id;
data.Read(id);
@@ -803,7 +803,7 @@ LANSession::OnStateCreate(AZ::HSM& sm, const AZ::HSM::Event& e)
{
// patch the ID if we use implicit port
AZ_Assert(m_carrier, "Carrier must be created!");
string ip;
AZStd::string ip;
unsigned int port;
SocketDriverCommon::AddressStringToIPPort(m_myMember->GetId().ToAddress(), ip, port);
AZ_Assert(port == 0 || port == m_carrier->GetPort(), "Carrier port missmatch! It should either be 0 (and patched here) in the implicit bind or the port number for explicit bind!");
@@ -881,7 +881,7 @@ LANSession::OnStateHostMigrateSession(AZ::HSM& sm, const AZ::HSM::Event& e)
if (m_driver->Initialize(Driver::BSD_AF_INET, nullptr, hostPort, true) != Driver::EC_OK)
{
// check the output for more info
string errorMsg = string::format("Failed to initialize socket at port %d!", hostPort);
AZStd::string errorMsg = AZStd::string::format("Failed to initialize socket at port %d!", hostPort);
EBUS_DBG_EVENT(Debug::SessionDrillerBus, OnSessionError, this, errorMsg);
EBUS_EVENT_ID(m_gridMate, SessionEventBus, OnSessionError, this, errorMsg);
// We can't be a real host if we failed to provide matching services.
@@ -899,7 +899,7 @@ LANSession::OnStateHostMigrateSession(AZ::HSM& sm, const AZ::HSM::Event& e)
// MakeSessionId
// [3/7/2013]
//=========================================================================
string
AZStd::string
LANSession::MakeSessionId()
{
char temp[64];
@@ -990,7 +990,7 @@ LANSearch::Update()
wb.Write(m_searchParams.m_params[i].m_type);
}
string serverAddress = m_searchParams.m_serverAddress;
AZStd::string serverAddress = m_searchParams.m_serverAddress;
if (serverAddress.empty())
{
serverAddress = Utils::GetBroadcastAddress(m_searchParams.m_familyType);
@@ -20,7 +20,7 @@ namespace GridMate
: m_port (0) // by default session can't be found (searched for)
{}
string m_address; /// empty to accept any address otherwise you can provide a specific bind address.
AZStd::string m_address; /// empty to accept any address otherwise you can provide a specific bind address.
/**
* Use 0 if you don't want you session to be searchable (default)
* Port on which we will register the LAN session (it will be used for session communication and should be different than the game/carrier one).
@@ -39,9 +39,9 @@ namespace GridMate
{}
int m_familyType; ///< Socket driver specific, by default 0.
string m_serverAddress; ///< Address of the server, we empty we create a broadcast address.
AZStd::string m_serverAddress; ///< Address of the server, we empty we create a broadcast address.
int m_serverPort; ///< Server port (must be provided).
string m_listenAddress; ///< Address to bind for listening. By default is empty, which means we are listening to any address.
AZStd::string m_listenAddress; ///< Address to bind for listening. By default is empty, which means we are listening to any address.
int m_listenPort; ///< Search listen port, if not set we will use ephimeral port.
unsigned int m_broadcastFrequencyMs; ///< Time in MS between search broadcasts.
};
@@ -52,7 +52,7 @@ namespace GridMate
struct LANSearchInfo
: public SearchInfo
{
string m_serverIP; ///< server ID as we see it
AZStd::string m_serverIP; ///< server ID as we see it
AZ::u16 m_serverPort; ///< server port for the session
};
}
@@ -60,7 +60,7 @@ namespace GridMate
typedef vector<NewConnection> NewConnectionsType;
typedef vector<AZ::u8> UserDataBufferType;
typedef unordered_set<string> AddressSetType;
typedef unordered_set<AZStd::string> AddressSetType;
GridSessionHandshake(unsigned int handshakeTimeoutMS, const VersionType& version);
virtual ~GridSessionHandshake() {}
@@ -92,19 +92,19 @@ namespace GridMate
*/
virtual bool OnConfirmAck(ConnectionID id, ReadBuffer& rb) { (void)id; (void)rb; return true; } // we don't do any further filtering
/// Return true if you want to reject early reject a connection.
virtual bool OnNewConnection(const string& address);
virtual bool OnNewConnection(const AZStd::string& address);
/// Called when we close a connection.
virtual void OnDisconnect(ConnectionID id);
/// Return timeout in milliseconds of the handshake procedure.
virtual unsigned int GetHandshakeTimeOutMS() const { return m_handshakeTimeOutMS; }
//////////////////////////////////////////////////////////////////////////
void BanAddress(string address);
void BanAddress(AZStd::string address);
void SetHost(bool isHost);
void SetInvited(bool isInvited);
void SetHostMigration(bool isMigrating);
void SetUserData(const void* data, size_t dataSize);
void SetSessionId(string sessionId);
void SetSessionId(AZStd::string sessionId);
bool IsNewConnections() { return !m_newConnections.empty(); }
NewConnectionsType& AcquireNewConnections();
void ReleaseNewConnections();
@@ -117,7 +117,7 @@ namespace GridMate
NewConnectionsType m_newConnections;
AddressSetType m_banList;
UserDataBufferType m_userData;
string m_sessionId;
AZStd::string m_sessionId;
RemotePeerMode m_peerMode;
VersionType m_version;
@@ -165,7 +165,7 @@ void GridSessionParam::SetValue(AZ::s32* values, size_t numElements)
if (numElements > 0)
{
AZ_Assert(values != nullptr, "Invalid values pointer!");
string temp;
AZStd::string temp;
for (size_t i = 0; i < numElements; ++i)
{
AZStd::to_string(temp, values[i]);
@@ -183,7 +183,7 @@ void GridSessionParam::SetValue(AZ::s64* values, size_t numElements)
if (numElements > 0)
{
AZ_Assert(values != nullptr, "Invalid values pointer!");
string temp;
AZStd::string temp;
for (size_t i = 0; i < numElements; ++i)
{
AZStd::to_string(temp, values[i]);
@@ -201,7 +201,7 @@ void GridSessionParam::SetValue(float* values, size_t numElements)
if (numElements > 0)
{
AZ_Assert(values != nullptr, "Invalid values pointer!");
string temp;
AZStd::string temp;
for (size_t i = 0; i < numElements; ++i)
{
AZStd::to_string(temp, values[i]);
@@ -219,7 +219,7 @@ void GridSessionParam::SetValue(double* values, size_t numElements)
if (numElements > 0)
{
AZ_Assert(values != nullptr, "Invalid values pointer!");
string temp;
AZStd::string temp;
for (size_t i = 0; i < numElements; ++i)
{
AZStd::to_string(temp, values[i]);
@@ -684,7 +684,7 @@ GridSession::SetParam(const GridSessionParam& param)
// RemoveParam
//=========================================================================
bool
GridSession::RemoveParam(const string& paramId)
GridSession::RemoveParam(const AZStd::string& paramId)
{
AZ_Assert(m_state, "Invalid session state replica. Session is not initialized.");
@@ -726,7 +726,7 @@ GridSession::RemoveParam(unsigned int index)
{
const GridSessionReplica::ParamContainer& curParams = m_state->m_params.Get();
const GridSessionParam& foundParam = curParams.at(index);
string paramId = foundParam.m_id;
AZStd::string paramId = foundParam.m_id;
m_state->m_params.Modify([=](Internal::GridSessionReplica::ParamContainer& params)
{
params.erase(&params.at(index));
@@ -970,7 +970,7 @@ GridSession::AddMember(GridMember* member)
// IsAddressInMemberList
//=========================================================================
bool
GridSession::IsAddressInMemberList(const string& address)
GridSession::IsAddressInMemberList(const AZStd::string& address)
{
for (AZStd::size_t i = 0; i < m_members.size(); ++i)
{
@@ -1220,7 +1220,7 @@ GridSession::OnDriverError(Carrier* carrier, ConnectionID id, const DriverError&
return; // not for us
}
uintptr_t idInt = reinterpret_cast<uintptr_t>(static_cast<void*>(id));
string errorMsg = string::format("Carrier driver error ConnectionID: %" PRIuPTR "ErrorCode: 0x%08x", idInt, error.m_errorCode);
AZStd::string errorMsg = AZStd::string::format("Carrier driver error ConnectionID: %" PRIuPTR "ErrorCode: 0x%08x", idInt, error.m_errorCode);
EBUS_DBG_EVENT(Debug::SessionDrillerBus, OnSessionError, this, errorMsg);
EBUS_EVENT_ID(m_gridMate, SessionEventBus, OnSessionError, this, errorMsg);
@@ -1248,7 +1248,7 @@ GridSession::OnSecurityError(Carrier* carrier, ConnectionID id, const SecurityEr
return; // not for us
}
uintptr_t idInt = reinterpret_cast<uintptr_t>(static_cast<void*>(id));
string errorMsg = string::format("Carrier security error ConnectionID: %" PRIuPTR " ErrorCode: 0x%08x", idInt, error.m_errorCode);
AZStd::string errorMsg = AZStd::string::format("Carrier security error ConnectionID: %" PRIuPTR " ErrorCode: 0x%08x", idInt, error.m_errorCode);
EBUS_DBG_EVENT(Debug::SessionDrillerBus, OnSessionError, this, errorMsg);
}
@@ -1976,7 +1976,7 @@ GridMember::GetNatType() const
//=========================================================================
// GetName
//=========================================================================
string
AZStd::string
GridMember::GetName() const
{
return m_clientState ? m_clientState->m_name.Get().c_str() : "Unknown";
@@ -2244,7 +2244,7 @@ GridMember::GetProcessId() const
//=========================================================================
// GetMachineName
//=========================================================================
string
AZStd::string
GridMember::GetMachineName() const
{
if (m_clientState)
@@ -2253,7 +2253,7 @@ GridMember::GetMachineName() const
}
else
{
return string();
return AZStd::string();
}
}
@@ -2688,7 +2688,7 @@ HandshakeErrorCode GridSessionHandshake::OnReceiveRequest(ConnectionID id, ReadB
{
(void)id;
AZStd::lock_guard<AZStd::mutex> l(m_dataLock);
string sessionId;
AZStd::string sessionId;
bool isInvited = false;
RemotePeerMode peerMode;
VersionType version;
@@ -2761,7 +2761,7 @@ bool GridSessionHandshake::OnConfirmRequest(ConnectionID id, ReadBuffer& rb)
(void)id;
AZStd::lock_guard<AZStd::mutex> l(m_dataLock);
string sessionId;
AZStd::string sessionId;
if (!rb.Read(sessionId))
{
return false;
@@ -2783,7 +2783,7 @@ bool GridSessionHandshake::OnConfirmRequest(ConnectionID id, ReadBuffer& rb)
//=========================================================================
// OnNewConnection
//=========================================================================
bool GridSessionHandshake::OnNewConnection(const string& address)
bool GridSessionHandshake::OnNewConnection(const AZStd::string& address)
{
AZStd::lock_guard<AZStd::mutex> l(m_dataLock);
@@ -2818,7 +2818,7 @@ void GridSessionHandshake::OnDisconnect(ConnectionID id)
//=========================================================================
// BanAddress
//=========================================================================
void GridSessionHandshake::BanAddress(string address)
void GridSessionHandshake::BanAddress(AZStd::string address)
{
AZStd::lock_guard<AZStd::mutex> l(m_dataLock);
m_banList.insert(address);
@@ -2864,7 +2864,7 @@ void GridSessionHandshake::SetUserData(const void* data, size_t dataSize)
//=========================================================================
// SetSessionId
//=========================================================================
void GridSessionHandshake::SetSessionId(string sessionId)
void GridSessionHandshake::SetSessionId(AZStd::string sessionId)
{
AZStd::lock_guard<AZStd::mutex> l(m_dataLock);
m_sessionId = sessionId;
@@ -39,8 +39,8 @@ namespace GridMate
struct MemberID
{
virtual ~MemberID() {}
virtual string ToString() const = 0;
virtual string ToAddress() const = 0;
virtual AZStd::string ToString() const = 0;
virtual AZStd::string ToAddress() const = 0;
virtual MemberIDCompact Compact() const = 0;
virtual bool IsValid() const = 0;
@@ -50,7 +50,7 @@ namespace GridMate
AZ_FORCE_INLINE bool operator!=(const MemberIDCompact& rhs) const { return Compact() != rhs; }
};
typedef string SessionID;
typedef AZStd::string SessionID;
struct SearchInfo;
@@ -87,8 +87,8 @@ namespace GridMate
void SetValue(float* values, size_t numElements);
void SetValue(double* values, size_t numElements);
string m_id;
string m_value;
AZStd::string m_id;
AZStd::string m_value;
AZ::u8 m_type;
AZ_FORCE_INLINE bool operator==(const GridSessionParam& rhs) const { return m_type == rhs.m_type && m_id == rhs.m_id && m_value == rhs.m_value; }
@@ -249,7 +249,7 @@ namespace GridMate
/// Callback that notifies the title when a session will be left. session pointer is NOT valid after the callback returns.
virtual void OnSessionDelete(GridSession* session) { (void)session; }
/// Called when a session error occurs.
virtual void OnSessionError(GridSession* session, const string& errorMsg) { (void)session; (void)errorMsg; }
virtual void OnSessionError(GridSession* session, const AZStd::string& errorMsg) { (void)session; (void)errorMsg; }
/// Called when the actual game(match) starts
virtual void OnSessionStart(GridSession* session) { (void)session; }
/// Called when the actual game(match) ends
@@ -303,7 +303,7 @@ namespace GridMate
virtual const PlayerId* GetPlayerId() const = 0;
NatType GetNatType() const;
string GetName() const;
AZStd::string GetName() const;
GridSession* GetSession() const { return m_session; }
@@ -353,7 +353,7 @@ namespace GridMate
//@{ Platform information
AZ::PlatformID GetPlatformId() const;
AZ::u32 GetProcessId() const;
string GetMachineName() const;
AZStd::string GetMachineName() const;
//@}
protected:
@@ -484,7 +484,7 @@ namespace GridMate
// Adds/updates a parameter. Returns false if parameter can not be added.
bool SetParam(const GridSessionParam& param);
// Removes a parameter by id. Returns false if parameter can not be removed.
bool RemoveParam(const string& paramId);
bool RemoveParam(const AZStd::string& paramId);
// Removes a parameter by index. Returns false if parameter can not be removed.
bool RemoveParam(unsigned int index);
@@ -543,9 +543,9 @@ namespace GridMate
/// Frees a slot based on a slot type.
void FreeSlot(int slotType);
/// Creates remote player, when he wants to join.
virtual GridMember* CreateRemoteMember(const string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId = InvalidConnectionID) = 0;
virtual GridMember* CreateRemoteMember(const AZStd::string& address, ReadBuffer& data, RemotePeerMode peerMode, ConnectionID connId = InvalidConnectionID) = 0;
/// Returns true if this address belongs to a member in the list, otherwise false.
virtual bool IsAddressInMemberList(const string& address);
virtual bool IsAddressInMemberList(const AZStd::string& address);
virtual bool IsConnectionIdInMemberList(const ConnectionID& connId);
/// Adds a created member to the session. Return false if no free slow was found!
virtual bool AddMember(GridMember* member);
@@ -558,7 +558,7 @@ namespace GridMate
/// Called when a session parameter is added/changed.
virtual void OnSessionParamChanged(const GridSessionParam& param) = 0;
/// Called when a session parameter is deleted.
virtual void OnSessionParamRemoved(const string& paramId) = 0;
virtual void OnSessionParamRemoved(const AZStd::string& paramId) = 0;
//////////////////////////////////////////////////////////////////////////
SessionID m_sessionId; ///< Session id. Content of the string will vary based on session types and platforms.
@@ -568,7 +568,7 @@ namespace GridMate
Internal::GridSessionHandshake* m_handshake;
typedef unordered_set<ConnectionID> ConnectionIDSet;
ConnectionIDSet m_connections;
string m_hostAddress;
AZStd::string m_hostAddress;
bool m_isShutdown;
GridMember* m_myMember; ///< Created with the session and bound when the server replica arrives.
@@ -923,14 +923,14 @@ namespace GridMate
DataSet<AZ::u8> m_numConnections;
DataSet<NatType> m_natType;
DataSet<string> m_name;
DataSet<AZStd::string> m_name;
DataSet<MemberIDCompact> m_memberId;
DataSet<MemberIDCompact> m_newHostVote; ///< Used when in host migration, to cast machine's vote.
MuteDataSetType m_muteList; ///< List of all players we have muted.
// Platform and application informational data
DataSet<AZ::PlatformID, ConversionMarshaler<AZ::u8, AZ::PlatformID> > m_platformId;
DataSet<string> m_machineName;
DataSet<AZStd::string> m_machineName;
DataSet<AZ::u32> m_processId;
DataSet<bool> m_isInvited;
};
@@ -975,7 +975,7 @@ namespace GridMate
/// Callback that notifies the title when a session will be left. session pointer is NOT valid after the callback returns.
virtual void OnSessionDelete(GridSession* session) { (void)session; }
/// Called when a session error occurs.
virtual void OnSessionError(GridSession* session, const string& errorMsg) { (void)session; (void)errorMsg; }
virtual void OnSessionError(GridSession* session, const AZStd::string& errorMsg) { (void)session; (void)errorMsg; }
/// Called when the actual game(match) starts
virtual void OnSessionStart(GridSession* session) { (void)session; }
/// Called when the actual game(match) ends
@@ -1,10 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <Gridmate/String/StringUtils_Platform.h>
@@ -1,26 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#ifndef GM_CONTAINERS_STRING_H
#define GM_CONTAINERS_STRING_H
#include <GridMate/Memory.h>
#include <AzCore/std/string/string.h>
#include <AzCore/std/string/conversions.h> // for getting from string->wstring and backwards
namespace GridMate
{
/**
* All libs should use specialized allocators
*/
typedef AZStd::basic_string<char, AZStd::char_traits<char>, SysContAlloc > string;
typedef AZStd::basic_string<wchar_t, AZStd::char_traits<wchar_t>, SysContAlloc > wstring;
typedef AZStd::basic_string<char, AZStd::char_traits<char>, GridMateStdAlloc > gridmate_string;
typedef AZStd::basic_string<wchar_t, AZStd::char_traits<wchar_t>, GridMateStdAlloc > gridmate_wstring;
}
#endif // GM_CONTAINERS_STRING_H
@@ -10,7 +10,6 @@
#include <GridMate/Memory.h>
#include <AzCore/EBus/EBus.h>
#include <GridMate/String/string.h>
namespace GridMate
{
@@ -120,6 +120,5 @@ set(FILES
Session/Session.cpp
Session/Session.h
Session/SessionServiceBus.h
String/string.h
VoiceChat/VoiceChatServiceBus.h
)
@@ -18,9 +18,9 @@
namespace GridMate
{
string Utils::GetMachineAddress(int familyType)
AZStd::string Utils::GetMachineAddress(int familyType)
{
string machineName;
AZStd::string machineName;
struct RTMRequest
{
nlmsghdr m_msghdr;
@@ -67,7 +67,7 @@ namespace GridMate
char address[INET6_ADDRSTRLEN] = { 0 };
bool isLoopback = false;
string devname;
AZStd::string devname;
for (int rtattrlen = IFA_PAYLOAD(nlmp); RTA_OK(rtatp, rtattrlen); rtatp = RTA_NEXT(rtatp, rtattrlen))
{
if (rtatp->rta_type == IFA_ADDRESS)
@@ -6,19 +6,18 @@
*
*/
#include <GridMate/String/string.h>
#include <unistd.h>
namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName)
void AssignExtendedName(AZStd::string& extendedName)
{
char hostName[64];
gethostname(hostName, AZ_ARRAY_SIZE(hostName));
extendedName = GridMate::string::format("%s", hostName);
extendedName = AZStd::string::format("%s", hostName);
}
}
}
@@ -18,9 +18,9 @@
namespace GridMate
{
string Utils::GetMachineAddress(int familyType)
AZStd::string Utils::GetMachineAddress(int familyType)
{
string machineName;
AZStd::string machineName;
struct ifaddrs* ifAddrStruct = nullptr;
struct ifaddrs* ifa = nullptr;
@@ -16,9 +16,9 @@
namespace GridMate
{
string Utils::GetMachineAddress(int familyType)
AZStd::string Utils::GetMachineAddress(int familyType)
{
string machineName;
AZStd::string machineName;
char name[MAX_PATH];
int result = gethostname(name, sizeof(name));
AZ_Error("GridMate", result == 0, "Failed in gethostname with result=%d, WSAGetLastError=%d!", result, WSAGetLastError());
@@ -6,19 +6,20 @@
*
*/
#include <GridMate/String/string.h>
#include <unistd.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName)
void AssignExtendedName(AZStd::string& extendedName)
{
char hostName[64];
gethostname(hostName, AZ_ARRAY_SIZE(hostName));
extendedName = GridMate::string::format("%s", hostName);
extendedName = AZStd::string::format("%s", hostName);
}
}
}
@@ -1,8 +0,0 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
@@ -6,19 +6,20 @@
*
*/
#include <GridMate/String/string.h>
#include <unistd.h>
#include <AzCore/std/string/string.h>
namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName)
void AssignExtendedName(AZStd::string& extendedName)
{
char hostName[64];
gethostname(hostName, AZ_ARRAY_SIZE(hostName));
extendedName = GridMate::string::format("%s", hostName);
extendedName = AZStd::string::format("%s", hostName);
}
}
}
@@ -6,22 +6,22 @@
*
*/
#include <GridMate/String/string.h>
#include <WinSock2.h>
#include <stdlib.h>
#include <AzCore/std/string/conversions.h>
namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName)
void AssignExtendedName(AZStd::string& extendedName)
{
char hostName[64];
gethostname(hostName, AZ_ARRAY_SIZE(hostName));
char procPath[256];
char procName[256];
DWORD ret = GetModuleFileName(NULL, procPath, 256);
DWORD ret = GetModuleFileNameA(NULL, procPath, 256);
if (ret > 0)
{
::_splitpath_s(procPath, 0, 0, 0, 0, procName, 256, 0, 0);
@@ -31,7 +31,7 @@ namespace GridMate
azsnprintf(procName, AZ_ARRAY_SIZE(procName), "Unknown");
}
extendedName = GridMate::string::format("%s::%s", hostName, procName);
extendedName = AZStd::string::format("%s::%s", hostName, procName);
}
}
}
@@ -6,19 +6,18 @@
*
*/
#include <GridMate/String/string.h>
#include <unistd.h>
namespace GridMate
{
namespace Platform
{
void AssignExtendedName(GridMate::string& extendedName)
void AssignExtendedName(AZStd::string& extendedName)
{
char hostName[64];
gethostname(hostName, AZ_ARRAY_SIZE(hostName));
extendedName = GridMate::string::format("%s", hostName);
extendedName = AZStd::string::format("%s", hostName);
}
}
}
+4 -4
View File
@@ -193,7 +193,7 @@ namespace UnitTest
CarrierCallbacksHandler clientCB, serverCB;
TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier test!");
AZStd::string str("Hello this is a carrier test!");
const char* targetAddress = "127.0.0.1";
@@ -377,7 +377,7 @@ namespace UnitTest
CarrierCallbacksHandler clientCB, serverCB;
TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier test!");
AZStd::string str("Hello this is a carrier test!");
clientCarrierDesc.m_driver = SocketProvider::CreateDriverForJoin();
serverCarrierDesc.m_driver = SocketProvider::CreateDriverForHost();
@@ -469,7 +469,7 @@ namespace UnitTest
CarrierCallbacksHandler clientCB, serverCB;
TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier stress test!");
AZStd::string str("Hello this is a carrier stress test!");
clientCarrierDesc.m_enableDisconnectDetection = false;
serverCarrierDesc.m_enableDisconnectDetection = false;
@@ -1401,7 +1401,7 @@ namespace UnitTest
CarrierCallbacksHandler clientCB, serverCB;
CarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier test!");
AZStd::string str("Hello this is a carrier test!");
const char* targetAddress = "127.0.0.1";
@@ -188,7 +188,7 @@ namespace UnitTest
CarrierStreamCallbacksHandler clientCB, serverCB;
TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier test!");
AZStd::string str("Hello this is a carrier test!");
const char* targetAddress = "127.0.0.1";
@@ -374,7 +374,7 @@ namespace UnitTest
CarrierStreamCallbacksHandler clientCB, serverCB;
TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier test!");
AZStd::string str("Hello this is a carrier test!");
clientCarrierDesc.m_driver = CreateDriverForJoin(clientCarrierDesc);
serverCarrierDesc.m_driver = CreateDriverForHost(serverCarrierDesc);
@@ -475,7 +475,7 @@ namespace UnitTest
CarrierStreamCallbacksHandler clientCB, serverCB;
UnitTest::TestCarrierDesc serverCarrierDesc, clientCarrierDesc;
string str("Hello this is a carrier stress test!");
AZStd::string str("Hello this is a carrier stress test!");
clientCarrierDesc.m_enableDisconnectDetection = /*false*/ true;
serverCarrierDesc.m_enableDisconnectDetection = /*false*/ true;
+2 -2
View File
@@ -3687,7 +3687,7 @@ public:
void Touch()
{
string randomStr;
AZStd::string randomStr;
for (unsigned i = 0; i < k_strSize; ++i)
{
randomStr += 'a' + (rand() % 26);
@@ -3698,7 +3698,7 @@ public:
bool IsReplicaMigratable() override { return false; }
static const unsigned k_strSize = 64;
DataSet<string> m_value;
DataSet<AZStd::string> m_value;
};
void run()
+2 -2
View File
@@ -471,12 +471,12 @@ namespace UnitTest
// ------------------------------------
// String
{
string s = "hello";
AZStd::string s = "hello";
wb.Write(s);
AZ_TEST_ASSERT(wb.Size() == s.length() + sizeof(AZ::u16));
string rs;
AZStd::string rs;
rb = ReadBuffer(wb.GetEndianType(), wb.Get(), wb.Size());
rb.Read(rs);
AZ_TEST_ASSERT(rs == s);
+6 -6
View File
@@ -241,7 +241,7 @@ namespace UnitTest
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
#ifndef AZ_LAN_TEST_MAIN_THREAD_BLOCKED // we will receive an error is we block for a long time
@@ -599,7 +599,7 @@ namespace UnitTest
(void)member;
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
AZ_TEST_ASSERT(false);
@@ -834,7 +834,7 @@ namespace UnitTest
(void)member;
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
#ifndef AZ_LAN_TEST_MAIN_THREAD_BLOCKED // we will receive an error is we block for a long time
@@ -1207,7 +1207,7 @@ namespace UnitTest
(void)member;
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
AZ_TEST_ASSERT(false);
@@ -1521,7 +1521,7 @@ namespace UnitTest
(void)member;
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
// On this test we will get a open port error because we have multiple hosts. This is ok, since we test migration here!
@@ -1861,7 +1861,7 @@ namespace UnitTest
(void)member;
(void)reason;
}
void OnSessionError(GridSession* session, const string& /*errorMsg*/) override
void OnSessionError(GridSession* session, const AZStd::string& /*errorMsg*/) override
{
(void)session;
// On this test we will get a open port error because we have multiple hosts. This is ok, since we test migration here!
+10 -10
View File
@@ -34,15 +34,15 @@ static bool CollectPerformanceCounters(const AZ::Debug::ProfilerRegister& reg, c
return true;
}
static string FormatString(const string& pre, const string& name, const string& post, AZ::u64 time, AZ::u64 calls)
static AZStd::string FormatString(const AZStd::string& pre, const AZStd::string& name, const AZStd::string& post, AZ::u64 time, AZ::u64 calls)
{
string units = "us";
AZStd::string units = "us";
if (AZ::u64 divtime = time / 1000)
{
time = divtime;
units = "ms";
}
return string::format("%s%s %s %10llu%s (%llu calls)\n", pre.c_str(), name.c_str(), post.c_str(), time, units.c_str(), calls);
return AZStd::string::format("%s%s %s %10llu%s (%llu calls)\n", pre.c_str(), name.c_str(), post.c_str(), time, units.c_str(), calls);
}
struct TotalSortContainer
@@ -56,28 +56,28 @@ struct TotalSortContainer
{
if (m_self && level >= 0)
{
string levelIndent;
AZStd::string levelIndent;
for (AZ::s32 i = 0; i < level; i++)
{
levelIndent += (i == level - 1) ? "+---" : "| ";
}
string name = m_self->m_name ? m_self->m_name : m_self->m_function;
string outputTotal = FormatString(levelIndent, name, " Total:", m_self->m_timeData.m_time, m_self->m_timeData.m_calls);
AZStd::string name = m_self->m_name ? m_self->m_name : m_self->m_function;
AZStd::string outputTotal = FormatString(levelIndent, name, " Total:", m_self->m_timeData.m_time, m_self->m_timeData.m_calls);
AZ_Printf(systemId, outputTotal.c_str());
if (m_self->m_timeData.m_childrenTime || m_self->m_timeData.m_childrenCalls)
{
string childIndent = levelIndent;
AZStd::string childIndent = levelIndent;
for (auto i = name.begin(); i != name.end(); ++i)
{
childIndent += " ";
}
childIndent[level * 4] = '|';
string outputChild = FormatString(childIndent, "", "Child:", m_self->m_timeData.m_childrenTime, m_self->m_timeData.m_childrenCalls);
AZStd::string outputChild = FormatString(childIndent, "", "Child:", m_self->m_timeData.m_childrenTime, m_self->m_timeData.m_childrenCalls);
AZ_Printf(systemId, outputChild.c_str());
string outputSelf = FormatString(childIndent, "", "Self :", m_self->m_timeData.m_time - m_self->m_timeData.m_childrenTime, m_self->m_timeData.m_calls);
AZStd::string outputSelf = FormatString(childIndent, "", "Self :", m_self->m_timeData.m_time - m_self->m_timeData.m_childrenTime, m_self->m_timeData.m_calls);
AZ_Printf(systemId, outputSelf.c_str());
}
}
@@ -237,7 +237,7 @@ void TestProfiler::PrintProfilingSelf(const char* systemId)
AZ_Printf(systemId, "Profiling timers by exclusive execution time:\n");
for (auto profiler : selfSorted)
{
string str = FormatString("", profiler->m_name ? profiler->m_name : profiler->m_function, "Self Time:",
AZStd::string str = FormatString("", profiler->m_name ? profiler->m_name : profiler->m_function, "Self Time:",
profiler->m_timeData.m_time - profiler->m_timeData.m_childrenTime, profiler->m_timeData.m_calls);
AZ_Printf(systemId, str.c_str());
}