More github cleanup

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-03 17:59:09 -07:00
parent 928c8ff16c
commit cbfdf99a9e
37 changed files with 125 additions and 183 deletions
@@ -422,7 +422,7 @@ namespace GridMate
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;
@@ -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
@@ -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>
@@ -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
@@ -145,7 +145,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,7 +138,7 @@ 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 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;
/// @}
@@ -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,6 @@
#include <GridMate/Types.h>
#include <GridMate/Serialize/Buffer.h>
#include <GridMate/String/string.h>
namespace GridMate
{
@@ -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>
@@ -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);
}
//=========================================================================
@@ -1159,14 +1158,14 @@ namespace GridMate
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;
}
@@ -1180,12 +1179,12 @@ namespace GridMate
{
// 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;
}
@@ -88,9 +88,9 @@ namespace GridMate
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,15 +163,15 @@ 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 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 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 AZStd::string& ip);
static BSDSocketFamilyType AddressFamilyType(const char* ip) { return AddressFamilyType(string(ip)); }
static BSDSocketFamilyType AddressFamilyType(const char* ip) { return AddressFamilyType(AZStd::string(ip)); }
/// @}
virtual AZStd::intrusive_ptr<DriverAddress> CreateDriverAddress(const AZStd::string& address) = 0;
@@ -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;
@@ -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
@@ -52,17 +52,17 @@ namespace GridMate
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
@@ -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();
@@ -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).
@@ -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() {}
@@ -99,12 +99,12 @@ namespace GridMate
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]);
@@ -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));
@@ -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;
@@ -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; }
@@ -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:
@@ -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;
};
@@ -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
)
@@ -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,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);
}
}
}
@@ -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,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);
}
}
}
@@ -6,15 +6,15 @@
*
*/
#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));
@@ -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);
+10 -10
View File
@@ -34,15 +34,15 @@ static bool CollectPerformanceCounters(const AZ::Debug::ProfilerRegister& reg, c
return true;
}
static string FormatString(const AZStd::string& pre, const AZStd::string& name, const AZStd::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());
}