Skip to content

Commit

Permalink
Move Collection to Util
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Jun 22, 2024
1 parent a21aee0 commit 37738d2
Show file tree
Hide file tree
Showing 27 changed files with 68 additions and 122 deletions.
6 changes: 3 additions & 3 deletions lib/app/include/app/action/visualization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define __VTX_UI_ACTION_VISUALIZATION__

#include <app/core/action/base_action.hpp>
#include <app/core/collection.hpp>
#include <util/collection.hpp>
#include <util/types.hpp>
#include <vector>

Expand All @@ -17,11 +17,11 @@ namespace VTX::App::Action::Visualization
class ChangeCameraController final : public App::Core::Action::BaseAction
{
public:
ChangeCameraController( const App::Core::CollectionKey & p_controllerID ) : _controllerID( p_controllerID ) {}
ChangeCameraController( const Util::CollectionKey & p_controllerID ) : _controllerID( p_controllerID ) {}
void execute() override;

private:
App::Core::CollectionKey _controllerID;
Util::CollectionKey _controllerID;
};

class ApplyNextCameraController final : public App::Core::Action::BaseAction
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/controller/camera/freefly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace VTX::App::Controller::Camera
class Freefly : public Core::Controller::BaseCameraController
{
public:
inline static const Core::CollectionKey COLLECTION_ID = "CONTROLLER_FREEFLY";
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_FREEFLY";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );

private:
Expand Down
4 changes: 2 additions & 2 deletions lib/app/include/app/controller/camera/trackball.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace VTX::App::Controller::Camera
class Trackball : public Core::Controller::BaseCameraController
{
public:
inline static const Core::CollectionKey COLLECTION_ID = "CONTROLLER_TRACKBALL";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_TRACKBALL";
inline static const Util::Hashing::Hash HASHED_COLLECTION_ID = Util::Hashing::hash( COLLECTION_ID );

private:
inline static const Core::Controller::ControllerCollection::Registration<Trackball> _reg { COLLECTION_ID };
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/controller/picker/selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace VTX::App::Controller::Picker
public:
using PickingInfo = App::Application::Selection::PickingInfo;

inline static const App::Core::CollectionKey COLLECTION_ID = "CONTROLLER_PICKER";
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_PICKER";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );

private:
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/controller/shortcut/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace VTX::App::Controller::Shortcut
class Debug final : public Core::Controller::BaseShortcutController
{
public:
inline static const App::Core::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_DEBUG";
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_DEBUG";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );

private:
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/controller/shortcut/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace VTX::App::Controller::Shortcut
class Global final : public Core::Controller::BaseShortcutController
{
public:
inline static const App::Core::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_GLOBAL";
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_GLOBAL";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );

private:
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/controller/shortcut/visualization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace VTX::App::Controller::Shortcut
class Visualization final : public Core::Controller::BaseShortcutController
{
public:
inline static const App::Core::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_VISUALIZATION";
inline static const Util::CollectionKey COLLECTION_ID = "CONTROLLER_SHORTCUT_VISUALIZATION";
inline static const VTX::Util::Hashing::Hash HASHED_COLLECTION_ID = VTX::Util::Hashing::hash( COLLECTION_ID );

private:
Expand Down
4 changes: 2 additions & 2 deletions lib/app/include/app/core/controller/controller_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#define __VTX_UI_QT_CONTROLLER_CONTROLLER_MANAGER__

#include "base_controller.hpp"
#include <app/core/collection.hpp>
#include <util/collection.hpp>

namespace VTX::App::Core::Controller
{
using ControllerCollection = App::Core::Collection<BaseController>;
using ControllerCollection = Util::Collection<BaseController>;
} // namespace VTX::App::Core::Controller
#endif
4 changes: 2 additions & 2 deletions lib/app/include/app/core/player/base_player.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef __VTX_APP_CORE_PLAYER_BASE_PLAYER__
#define __VTX_APP_CORE_PLAYER_BASE_PLAYER__

#include "app/core/collection.hpp"
#include <memory>
#include <string>
#include <util/callback.hpp>
#include <util/collection.hpp>
#include <util/types.hpp>

namespace VTX::App::Core::Player
Expand Down Expand Up @@ -39,7 +39,7 @@ namespace VTX::App::Core::Player

virtual std::unique_ptr<BasePlayer> clone() const = 0;
virtual const std::string & getDisplayName() const = 0;
virtual const CollectionKey & getCollectionKey() const = 0;
virtual const Util::CollectionKey & getCollectionKey() const = 0;

Util::Callback<> onPlay;
Util::Callback<> onPause;
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class Loop : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "LOOP";
inline static const std::string DISPLAYED_NAME = "Loop";
inline static const Util::CollectionKey COLLECTION_ID = "LOOP";
inline static const std::string DISPLAYED_NAME = "Loop";

private:
inline static const Players::Registration<Loop> _reg { COLLECTION_ID };
Expand All @@ -20,7 +20,7 @@ namespace VTX::App::Core::Player
Loop( const Loop & p_source ) = default;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<Loop>( *this ); }

void reset() override;
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/once.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class Once : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "ONCE";
inline static const std::string DISPLAYED_NAME = "Once";
inline static const Util::CollectionKey COLLECTION_ID = "ONCE";
inline static const std::string DISPLAYED_NAME = "Once";

private:
inline static const Players::Registration<Once> _reg { COLLECTION_ID };
Expand All @@ -20,7 +20,7 @@ namespace VTX::App::Core::Player
Once( const Once & p_source ) = default;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<Once>( *this ); }

void reset() override;
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/ping_pong.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class PingPong : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "PING_PONG";
inline static const std::string DISPLAYED_NAME = "Ping Pong";
inline static const Util::CollectionKey COLLECTION_ID = "PING_PONG";
inline static const std::string DISPLAYED_NAME = "Ping Pong";

private:
inline static const Players::Registration<PingPong> _reg { COLLECTION_ID };
Expand All @@ -20,7 +20,7 @@ namespace VTX::App::Core::Player
PingPong( const PingPong & p_source ) = default;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<PingPong>( *this ); }

void reset() override;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/include/app/core/player/players.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef __VTX_APP_CORE_PLAYER_PLAYERS__
#define __VTX_APP_CORE_PLAYER_PLAYERS__

#include "app/core/collection.hpp"
#include "Util/collection.hpp"
#include "app/core/player/base_player.hpp"

namespace VTX::App::Core::Player
{
using Players = Collection<BasePlayer>;
using Players = Util::Collection<BasePlayer>;
} // namespace VTX::App::Core::Player
#endif
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/revert_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class RevertLoop : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "REVERT_LOOP";
inline static const std::string DISPLAYED_NAME = "Revert Loop";
inline static const Util::CollectionKey COLLECTION_ID = "REVERT_LOOP";
inline static const std::string DISPLAYED_NAME = "Revert Loop";

private:
inline static const Players::Registration<RevertLoop> _reg { COLLECTION_ID };
Expand All @@ -20,7 +20,7 @@ namespace VTX::App::Core::Player
RevertLoop( const RevertLoop & p_source ) = default;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<RevertLoop>( *this ); }

void reset() override;
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/revert_once.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class RevertOnce : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "REVERT_ONCE";
inline static const std::string DISPLAYED_NAME = "Revert Once";
inline static const Util::CollectionKey COLLECTION_ID = "REVERT_ONCE";
inline static const std::string DISPLAYED_NAME = "Revert Once";

private:
inline static const Players::Registration<RevertOnce> _reg { COLLECTION_ID };
Expand All @@ -20,7 +20,7 @@ namespace VTX::App::Core::Player
RevertOnce( const RevertOnce & p_source ) = default;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<RevertOnce>( *this ); }

void reset() override;
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/core/player/stop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace VTX::App::Core::Player
class Stop : public BasePlayer
{
public:
inline static const CollectionKey COLLECTION_ID = "STOP";
inline static const std::string DISPLAYED_NAME = "Stop";
inline static const Util::CollectionKey COLLECTION_ID = "STOP";
inline static const std::string DISPLAYED_NAME = "Stop";

private:
inline static const Players::Registration<Stop> _reg { COLLECTION_ID };
Expand All @@ -22,7 +22,7 @@ namespace VTX::App::Core::Player
void play() override;

const std::string & getDisplayName() const override { return DISPLAYED_NAME; }
const CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
const Util::CollectionKey & getCollectionKey() const override { return COLLECTION_ID; }
std::unique_ptr<BasePlayer> clone() const override { return std::make_unique<Stop>( *this ); }

void reset() override;
Expand Down
4 changes: 2 additions & 2 deletions lib/app/include/app/core/system/system_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ namespace VTX::App::Core::System
~SystemHandler() = default;

template<SystemConcept T>
inline void store( const Util::Hashing::Hash & p_hash )
void store( const Util::Hashing::Hash & p_hash )
{
assert( not _systems.contains( p_hash ) );
const std::unique_ptr<BaseSystem> & ptr = _storage.emplace_back( std::make_unique<T>() );
_systems.emplace( p_hash, ptr.get() );
}

inline void reference( const Util::Hashing::Hash & p_hash, BaseSystem * p_systemPtr )
void reference( const Util::Hashing::Hash & p_hash, BaseSystem * p_systemPtr )
{
assert( not _systems.contains( p_hash ) );
_systems.emplace( p_hash, p_systemPtr );
Expand Down
6 changes: 3 additions & 3 deletions lib/app/include/app/mode/visualization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ namespace VTX::App::Mode
return *_currentPickerController;
}

Core::Controller::BaseController & getController( const App::Core::CollectionKey & p_controllerKey );
Core::Controller::BaseController & getController( const Util::CollectionKey & p_controllerKey );

void setCameraController( const Util::Hashing::Hash & p_controllerKey );
void setCameraController( const App::Core::CollectionKey & p_controllerKey );
void setCameraController( const Util::CollectionKey & p_controllerKey );
void setPickerController( const Util::Hashing::Hash & p_controllerHash );
void setPickerController( const App::Core::CollectionKey & p_controllerKey );
void setPickerController( const Util::CollectionKey & p_controllerKey );

const std::set<std::unique_ptr<Core::Controller::BaseController>> & getCameraControllers() const
{
Expand Down
2 changes: 1 addition & 1 deletion lib/app/include/app/vtx_app.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace VTX::App
inline Mode::BaseMode & getCurrentMode() { return *_currentMode; }
inline const Mode::BaseMode & getCurrentMode() const { return *_currentMode; }

Util::Callback<> onAppReady;
Util::Callback<> onStart;

Util::Callback<float> onPreUpdate;
Util::Callback<float> onUpdate;
Expand Down
2 changes: 1 addition & 1 deletion lib/app/src/app/action/animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "app/core/animation/animation_system.hpp"
#include <app/application/scene.hpp>
#include <app/component/render/camera.hpp>
#include <app/core/collection.hpp>
#include <util/collection.hpp>

namespace VTX::App::Action::Animation
{
Expand Down
2 changes: 1 addition & 1 deletion lib/app/src/app/action/visualization.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "app/action/visualization.hpp"
#include "app/core/collection.hpp"
#include "app/core/controller/base_camera_controller.hpp"
#include "app/core/controller/controller_manager.hpp"
#include "app/mode/base_mode.hpp"
#include "app/mode/visualization.hpp"
#include <util/collection.hpp>

namespace VTX::App::Action::Visualization
{
Expand Down
55 changes: 0 additions & 55 deletions lib/app/src/app/core/system/system_handler.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions lib/app/src/app/mode/visualization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace VTX::App::Mode
_otherControllers.emplace( std::move( p_controllerPtr ) );
}

Core::Controller::BaseController & Visualization::getController( const App::Core::CollectionKey & p_controllerKey )
Core::Controller::BaseController & Visualization::getController( const Util::CollectionKey & p_controllerKey )
{
const auto controllerIt = std::find_if(
_otherControllers.begin(),
Expand Down Expand Up @@ -125,7 +125,7 @@ namespace VTX::App::Mode

onCameraController( *_currentCameraController );
}
void Visualization::setCameraController( const App::Core::CollectionKey & p_controllerKey )
void Visualization::setCameraController( const Util::CollectionKey & p_controllerKey )
{
setCameraController( Util::Hashing::hash( p_controllerKey ) );
}
Expand All @@ -149,7 +149,7 @@ namespace VTX::App::Mode

onPickerController( *_currentPickerController );
}
void Visualization::setPickerController( const App::Core::CollectionKey & p_controllerKey )
void Visualization::setPickerController( const Util::CollectionKey & p_controllerKey )
{
setPickerController( Util::Hashing::hash( p_controllerKey ) );
}
Expand Down
Loading

0 comments on commit 37738d2

Please sign in to comment.