Moves Code/Tools/Standalone to Code/Tools/LuaIDE

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-12-02 14:43:36 -08:00
parent 5dfd40d056
commit 4e081e74bb
95 changed files with 11 additions and 22 deletions
@@ -0,0 +1,31 @@
/*
* 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
#ifndef TELEMETRY_TELEMETRYBUS_H
#define TELEMETRY_TELEMETRYBUS_H
#include <AzCore/EBus/EBus.h>
#include "Source/Telemetry/TelemetryEvent.h"
namespace Telemetry
{
class TelemetryComponent;
class TelemetryEvents
: public AZ::EBusTraits
{
public:
virtual void Initialize(const char* applicationName, AZ::u32 processIntervalInSecs, bool doSDKInitShutdown) = 0;
virtual void LogEvent(const TelemetryEvent& event) = 0;
virtual void Shutdown() = 0;
};
typedef AZ::EBus<TelemetryEvents> TelemetryEventsBus;
}
#endif
@@ -0,0 +1,48 @@
/*
* 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
*
*/
#include "TelemetryComponent.h"
#include <AzCore/Serialization/SerializeContext.h>
namespace Telemetry
{
void TelemetryComponent::Reflect(AZ::ReflectContext* context)
{
AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context);
if (serialize)
{
serialize->Class<TelemetryComponent, AZ::Component>()
->Version(1)
;
}
}
void TelemetryComponent::Activate()
{
TelemetryEventsBus::Handler::BusConnect();
}
void TelemetryComponent::Deactivate()
{
Shutdown();
TelemetryEventsBus::Handler::BusDisconnect();
}
void TelemetryComponent::Initialize([[maybe_unused]] const char* applicationName, [[maybe_unused]] AZ::u32 processInterval, [[maybe_unused]] bool doAPIInitShutdown)
{
}
void TelemetryComponent::LogEvent([[maybe_unused]] const TelemetryEvent& telemetryEvent)
{
}
void TelemetryComponent::Shutdown()
{
}
}
@@ -0,0 +1,41 @@
/*
* 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 <AzCore/Component/Component.h>
#include <AzCore/std/chrono/chrono.h>
#include "TelemetryBus.h"
namespace Telemetry
{
class TelemetryComponent
: public AZ::Component
, public TelemetryEventsBus::Handler
{
public:
AZ_COMPONENT(TelemetryComponent, "{CE41EE3C-AF98-4B22-BA7C-2D425D1F468A}")
TelemetryComponent() = default;
//////////////////
// AZ::Component
void Activate() override;
void Deactivate() override;
static void Reflect(AZ::ReflectContext* context);
//////////////////
//////////////////////////////////////////
// Telemetry::TelemetryEventBus::Handler
void Initialize(const char* applicationName, AZ::u32 processIntervalInSeconds, bool doSDKInitShutdown) override;
void LogEvent(const TelemetryEvent& event) override;
void Shutdown() override;
//////////////////////////////////////////
};
}
@@ -0,0 +1,80 @@
/*
* 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
*
*/
#include "TelemetryEvent.h"
#include "TelemetryBus.h"
namespace Telemetry
{
TelemetryEvent::TelemetryEvent(const char* eventName)
: m_eventName(eventName)
{
}
void TelemetryEvent::SetAttribute(const AZStd::string& name, const AZStd::string& value)
{
m_attributes[name] = value;
}
const AZStd::string& TelemetryEvent::GetAttribute(const AZStd::string& name)
{
static AZStd::string k_emptyString;
AZStd::unordered_map< AZStd::string, AZStd::string >::iterator attributeIter = m_attributes.find(name);
if (attributeIter != m_attributes.end())
{
return attributeIter->second;
}
return k_emptyString;
}
void TelemetryEvent::SetMetric(const AZStd::string& name, double metric)
{
m_metrics[name] = metric;
}
double TelemetryEvent::GetMetric(const AZStd::string& name)
{
AZStd::unordered_map< AZStd::string, double >::iterator metricIter = m_metrics.find(name);
if (metricIter != m_metrics.end())
{
return metricIter->second;
}
return 0.0;
}
void TelemetryEvent::Log()
{
EBUS_EVENT(TelemetryEventsBus, LogEvent, (*this));
}
void TelemetryEvent::ResetEvent()
{
m_metrics.clear();
m_attributes.clear();
}
const char* TelemetryEvent::GetEventName() const
{
return m_eventName.c_str();
}
const TelemetryEvent::AttributesMap& TelemetryEvent::GetAttributes() const
{
return m_attributes;
}
const TelemetryEvent::MetricsMap& TelemetryEvent::GetMetrics() const
{
return m_metrics;
}
}
@@ -0,0 +1,45 @@
/*
* 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 TELEMETRY_TELEMETRYEVENT_H
#define TELEMETRY_TELEMETRYEVENT_H
#include <AzCore/std/containers/unordered_map.h>
#include <AzCore/std/string/string.h>
namespace Telemetry
{
class TelemetryEvent
{
public:
typedef AZStd::unordered_map< AZStd::string, AZStd::string > AttributesMap;
typedef AZStd::unordered_map< AZStd::string, double > MetricsMap;
TelemetryEvent(const char* eventName);
void SetAttribute(const AZStd::string& name, const AZStd::string& value);
const AZStd::string& GetAttribute(const AZStd::string& name);
void SetMetric(const AZStd::string& name, double metric);
double GetMetric(const AZStd::string& name);
void Log();
void ResetEvent();
const char* GetEventName() const;
const AttributesMap& GetAttributes() const;
const MetricsMap& GetMetrics() const;
private:
AZStd::string m_eventName;
AttributesMap m_attributes;
MetricsMap m_metrics;
};
}
#endif