Program Listing for File CSPFoundation.h
↰ Return to documentation for file (D:\work\3dc8e59b8cadf7a2\Library\include\CSP\CSPFoundation.h
)
/*
* Copyright 2023 Magnopus LLC
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "CSP/CSPCommon.h"
#include "CSP/Common/String.h"
#include <string>
namespace csp
{
class CSP_API ServiceDefinition
{
public:
ServiceDefinition()
: URI("")
, Version(0)
{
}
ServiceDefinition(const csp::common::String& InURI, const uint32_t InVersion)
: URI(InURI)
, Version(InVersion)
{
}
csp::common::String GetURI() const { return URI; }
void SetURI(const csp::common::String& InURI) { URI = InURI; }
int32_t GetVersion() const { return Version; }
CSP_NO_EXPORT void SetVersion(const uint32_t InVersion) { Version = InVersion; }
private:
csp::common::String URI;
uint32_t Version;
};
class CSP_API EndpointURIs
{
public:
ServiceDefinition UserService;
ServiceDefinition PrototypeService;
ServiceDefinition SpatialDataService;
ServiceDefinition MultiplayerService;
ServiceDefinition AggregationService;
ServiceDefinition TrackingService;
ServiceDefinition MaintenanceWindow;
};
class CSP_API ClientUserAgent
{
public:
// @brief Foundation version.
csp::common::String CSPVersion;
// @brief Operating system of the client.
csp::common::String ClientOS;
// @brief Client project code.
csp::common::String ClientSKU;
// @brief Client application version.
csp::common::String ClientVersion;
// @brief Build type of the client. e.g DEVELOPMENT.
csp::common::String ClientEnvironment;
// @brief Magnopus services environment. e.g odev.
csp::common::String CHSEnvironment;
};
class CSP_API CSPFoundation
{
public:
static bool Initialise(const csp::common::String& EndpointRootURI, const csp::common::String& Tenant);
static bool Shutdown();
static void Tick();
static const csp::common::String& GetVersion();
static const csp::common::String& GetBuildType();
static const csp::common::String& GetBuildID();
static const csp::common::String& GetDeviceId();
static bool GetIsInitialised();
static const EndpointURIs& GetEndpoints();
static EndpointURIs CreateEndpointsFromRoot(const csp::common::String& EndpointRootURI);
static void SetClientUserAgentInfo(const csp::ClientUserAgent& ClientUserAgentHeader);
static const ClientUserAgent& GetClientUserAgentInfo();
static const csp::common::String& GetClientUserAgentString();
static const csp::common::String& GetTenant();
private:
static bool IsInitialised;
static EndpointURIs* Endpoints;
static ClientUserAgent* ClientUserAgentInfo;
static csp::common::String* DeviceId;
static csp::common::String* ClientUserAgentString;
static csp::common::String* Tenant;
};
// Helper function to get function address for templates from wrappers
CSP_API void* GetFunctionAddress(const csp::common::String& Name);
// Helper function to free allocated memory from wrappers
CSP_API void Free(void* Pointer);
} // namespace csp