FeatureSchema.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Memory/Memory.h>
  10. #include <AzCore/RTTI/RTTI.h>
  11. #include <AzCore/std/containers/unordered_map.h>
  12. #include <AzCore/std/containers/vector.h>
  13. #include <Feature.h>
  14. namespace EMotionFX::MotionMatching
  15. {
  16. //! The set of features involved in the motion matching search.
  17. //! The schema represents the order of the features as well as their settings while the feature matrix stores the actual feature data.
  18. class EMFX_API FeatureSchema
  19. {
  20. public:
  21. AZ_RTTI(FeatureSchema, "{E34F6BFE-73DB-4DED-AAB9-09FBC5113236}")
  22. AZ_CLASS_ALLOCATOR_DECL
  23. virtual ~FeatureSchema();
  24. void AddFeature(Feature* feature);
  25. void Clear();
  26. size_t GetNumFeatures() const;
  27. Feature* GetFeature(size_t index) const;
  28. const AZStd::vector<Feature*>& GetFeatures() const;
  29. Feature* FindFeatureById(const AZ::TypeId& featureId) const;
  30. AZStd::vector<AZStd::string> CollectColumnNames() const;
  31. static void Reflect(AZ::ReflectContext* context);
  32. protected:
  33. static Feature* CreateFeatureByType(const AZ::TypeId& typeId);
  34. AZStd::vector<Feature*> m_features; //< Ordered set of features (Owns the feature objects).
  35. AZStd::unordered_map<AZ::TypeId, Feature*> m_featuresById; //< Hash-map for fast access to the features by ID. (Weak ownership)
  36. };
  37. } // namespace EMotionFX::MotionMatching