mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-05 15:30:00 +01:00
Making classes non-assignable
Following CppCheck recomendation, all classes that should not be manipulated by value are made non-assignable to ensure no mistake is made.
This commit is contained in:
@@ -289,7 +289,7 @@ set(VMIX_SRCS
|
||||
Selection.cpp
|
||||
SessionSource.cpp
|
||||
SessionVisitor.cpp
|
||||
GarbageVisitor.cpp
|
||||
Interpolator.cpp
|
||||
SessionCreator.cpp
|
||||
Mixer.cpp
|
||||
FrameGrabber.cpp
|
||||
|
||||
@@ -24,6 +24,9 @@ public:
|
||||
|
||||
FrameBufferImage(int w, int h);
|
||||
FrameBufferImage(jpegBuffer jpgimg);
|
||||
// non assignable class
|
||||
FrameBufferImage(FrameBufferImage const&) = delete;
|
||||
FrameBufferImage& operator=(FrameBufferImage const&) = delete;
|
||||
~FrameBufferImage();
|
||||
};
|
||||
|
||||
@@ -45,6 +48,7 @@ public:
|
||||
|
||||
FrameBuffer(glm::vec3 resolution, bool useAlpha = false, bool multiSampling = false);
|
||||
FrameBuffer(uint width, uint height, bool useAlpha = false, bool multiSampling = false);
|
||||
FrameBuffer(FrameBuffer const&) = delete;
|
||||
~FrameBuffer();
|
||||
|
||||
// Bind & push attribs to prepare draw
|
||||
|
||||
@@ -7,6 +7,9 @@ class GeometryView : public View
|
||||
{
|
||||
public:
|
||||
GeometryView();
|
||||
// non assignable class
|
||||
GeometryView(GeometryView const&) = delete;
|
||||
GeometryView& operator=(GeometryView const&) = delete;
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ struct InputTextCallback_UserData
|
||||
|
||||
static int InputTextCallback(ImGuiInputTextCallbackData* data)
|
||||
{
|
||||
InputTextCallback_UserData* user_data = (InputTextCallback_UserData*)data->UserData;
|
||||
InputTextCallback_UserData* user_data = static_cast<InputTextCallback_UserData*>(data->UserData);
|
||||
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize)
|
||||
{
|
||||
// if (user_data->WordWrap > 1)
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
|
||||
#include <glm/gtc/matrix_access.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include "defines.h"
|
||||
#include "Log.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
|
||||
#include "Interpolator.h"
|
||||
|
||||
|
||||
Interpolator::Interpolator(Source *subject, const SourceCore &target) :
|
||||
subject_(subject), cursor_(0.f)
|
||||
subject_(subject), from_(static_cast<SourceCore> (*subject)), to_(target), cursor_(0.f)
|
||||
{
|
||||
from_ = static_cast<SourceCore> (*subject);
|
||||
to_ = target;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Interpolator::apply(float percent)
|
||||
{
|
||||
cursor_ = CLAMP( percent, 0.f, 1.f);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
|
||||
float cursor_;
|
||||
|
||||
void apply(float percent);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ class LayerView : public View
|
||||
{
|
||||
public:
|
||||
LayerView();
|
||||
// non assignable class
|
||||
LayerView(LayerView const&) = delete;
|
||||
LayerView& operator=(LayerView const&) = delete;
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
|
||||
@@ -14,6 +14,9 @@ class MixingGroup
|
||||
|
||||
public:
|
||||
MixingGroup (SourceList sources);
|
||||
// non assignable class
|
||||
MixingGroup(MixingGroup const&) = delete;
|
||||
MixingGroup& operator=(MixingGroup const&) = delete;
|
||||
~MixingGroup ();
|
||||
|
||||
// Get unique id
|
||||
|
||||
@@ -9,6 +9,9 @@ class MixingView : public View
|
||||
{
|
||||
public:
|
||||
MixingView();
|
||||
// non assignable class
|
||||
MixingView(MixingView const&) = delete;
|
||||
MixingView& operator=(MixingView const&) = delete;
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
|
||||
@@ -20,6 +20,7 @@ protected:
|
||||
const IpEndpointName& remoteEndpoint );
|
||||
public:
|
||||
inline void setParent(NetworkStream *s) { parent_ = s; }
|
||||
StreamerResponseListener() : parent_(nullptr) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
3
Scene.h
3
Scene.h
@@ -239,6 +239,9 @@ class Scene {
|
||||
|
||||
public:
|
||||
Scene();
|
||||
// non assignable class
|
||||
Scene(Scene const&) = delete;
|
||||
Scene& operator=(Scene const&) = delete;
|
||||
~Scene();
|
||||
|
||||
void accept (Visitor& v);
|
||||
|
||||
@@ -80,8 +80,8 @@ bool SessionVisitor::saveSession(const std::string& filename, Session *session)
|
||||
// for( ; N ; N=N->NextSiblingElement())
|
||||
// snapshots->InsertEndChild( N->DeepClone( &xmlDoc ));
|
||||
|
||||
XMLText *text = xmlDoc.NewText( Action::manager().snapshotsDescription() );
|
||||
snapshots->InsertEndChild( text );
|
||||
XMLText *desc = xmlDoc.NewText( Action::manager().snapshotsDescription() );
|
||||
snapshots->InsertEndChild( desc );
|
||||
xmlDoc.InsertEndChild(snapshots);
|
||||
|
||||
// 4. optional notes
|
||||
|
||||
36
Source.cpp
36
Source.cpp
@@ -17,7 +17,7 @@
|
||||
|
||||
#include "Source.h"
|
||||
|
||||
SourceCore::SourceCore() : processingshader_(nullptr)
|
||||
SourceCore::SourceCore()
|
||||
{
|
||||
// default nodes
|
||||
groups_[View::RENDERING] = new Group;
|
||||
@@ -40,6 +40,11 @@ SourceCore::SourceCore() : processingshader_(nullptr)
|
||||
renderingshader_ = static_cast<Shader *>(new ImageShader);
|
||||
}
|
||||
|
||||
SourceCore::SourceCore(SourceCore const& other) : SourceCore()
|
||||
{
|
||||
copy(other);
|
||||
}
|
||||
|
||||
SourceCore::~SourceCore()
|
||||
{
|
||||
// all groups and their children are deleted in the scene
|
||||
@@ -61,6 +66,22 @@ SourceCore::~SourceCore()
|
||||
groups_.clear();
|
||||
}
|
||||
|
||||
void SourceCore::copy(SourceCore const& other)
|
||||
{
|
||||
// copy groups properties
|
||||
groups_[View::RENDERING]->copyTransform( other.group(View::RENDERING) );
|
||||
groups_[View::MIXING]->copyTransform( other.group(View::MIXING) );
|
||||
groups_[View::GEOMETRY]->copyTransform( other.group(View::GEOMETRY) );
|
||||
groups_[View::LAYER]->copyTransform( other.group(View::LAYER) );
|
||||
groups_[View::TEXTURE]->copyTransform( other.group(View::TEXTURE) );
|
||||
groups_[View::TRANSITION]->copyTransform( other.group(View::TRANSITION) );
|
||||
stored_status_->copyTransform( other.stored_status_ );
|
||||
|
||||
// copy shader properties
|
||||
processingshader_->copy(*other.processingshader_);
|
||||
renderingshader_->copy(*other.renderingshader_);
|
||||
}
|
||||
|
||||
void SourceCore::store (View::Mode m)
|
||||
{
|
||||
stored_status_->copyTransform(groups_[m]);
|
||||
@@ -69,18 +90,7 @@ void SourceCore::store (View::Mode m)
|
||||
SourceCore& SourceCore::operator= (SourceCore const& other)
|
||||
{
|
||||
if (this != &other) { // no self assignment
|
||||
// copy groups properties
|
||||
groups_[View::RENDERING]->copyTransform( other.group(View::RENDERING) );
|
||||
groups_[View::MIXING]->copyTransform( other.group(View::MIXING) );
|
||||
groups_[View::GEOMETRY]->copyTransform( other.group(View::GEOMETRY) );
|
||||
groups_[View::LAYER]->copyTransform( other.group(View::LAYER) );
|
||||
groups_[View::TEXTURE]->copyTransform( other.group(View::TEXTURE) );
|
||||
groups_[View::TRANSITION]->copyTransform( other.group(View::TRANSITION) );
|
||||
stored_status_->copyTransform( other.stored_status_ );
|
||||
|
||||
// copy shader properties
|
||||
processingshader_->copy(*other.processingshader_);
|
||||
renderingshader_->copy(*other.renderingshader_);
|
||||
copy(other);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
9
Source.h
9
Source.h
@@ -27,6 +27,8 @@ class SourceCore
|
||||
{
|
||||
public:
|
||||
SourceCore();
|
||||
SourceCore(SourceCore const&);
|
||||
SourceCore& operator= (SourceCore const& other);
|
||||
virtual ~SourceCore();
|
||||
|
||||
// get handle on the nodes used to manipulate the source in a view
|
||||
@@ -39,8 +41,6 @@ public:
|
||||
// a Source always has an image processing shader
|
||||
inline ImageProcessingShader *processingShader () const { return processingshader_; }
|
||||
|
||||
SourceCore& operator= (SourceCore const& other);
|
||||
|
||||
protected:
|
||||
// nodes
|
||||
std::map<View::Mode, Group*> groups_;
|
||||
@@ -51,6 +51,8 @@ protected:
|
||||
// pointer to the currently attached shader
|
||||
// (will be processingshader_ if image processing is enabled)
|
||||
Shader *renderingshader_;
|
||||
|
||||
void copy(SourceCore const& other);
|
||||
};
|
||||
|
||||
class Source : public SourceCore
|
||||
@@ -69,6 +71,9 @@ public:
|
||||
// create a source and add it to the list
|
||||
// only subclasses of sources can actually be instanciated
|
||||
Source (uint64_t id = 0);
|
||||
// non assignable class
|
||||
Source(Source const&) = delete;
|
||||
Source& operator=(Source const&) = delete;
|
||||
virtual ~Source ();
|
||||
|
||||
// Get unique id
|
||||
|
||||
@@ -8,6 +8,9 @@ class TextureView : public View
|
||||
{
|
||||
public:
|
||||
TextureView();
|
||||
// non assignable class
|
||||
TextureView(TextureView const&) = delete;
|
||||
TextureView& operator=(TextureView const&) = delete;
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
|
||||
@@ -7,6 +7,9 @@ class TransitionView : public View
|
||||
{
|
||||
public:
|
||||
TransitionView();
|
||||
// non assignable class
|
||||
TransitionView(TransitionView const&) = delete;
|
||||
TransitionView& operator=(TransitionView const&) = delete;
|
||||
|
||||
void draw () override;
|
||||
void update (float dt) override;
|
||||
|
||||
@@ -100,7 +100,7 @@ UserInterface::UserInterface()
|
||||
show_opengl_about = false;
|
||||
show_view_navigator = 0;
|
||||
target_view_navigator = 1;
|
||||
currentTextEdit = "";
|
||||
currentTextEdit.clear();
|
||||
screenshot_step = 0;
|
||||
|
||||
// keep hold on frame grabbers
|
||||
|
||||
Reference in New Issue
Block a user