Browse Source

fixed weffc++ warnings in Reanttweakba

Former-commit-id: 2e0fd5c1cca983c3705257df267c3f8c3ef57721
Alec Jacobson (jalec 12 years ago
parent
commit
9135527843
4 changed files with 107 additions and 18 deletions
  1. 3 0
      Makefile.conf
  2. 24 0
      include/igl/ReAntTweakBar.cpp
  3. 78 18
      include/igl/ReAntTweakBar.h
  4. 2 0
      include/igl/draw_mesh.h

+ 3 - 0
Makefile.conf

@@ -36,11 +36,14 @@ ifeq ($(IGL_USERNAME),jalec_linux)
 	OPENGL_LIB=-lGL -lGLU
 	GLUT_LIB=-lglut
 	ANTTWEAKBAR_LIB=-lAntTweakBar
+	IGL_WITH_PNG=1
 endif
 ifeq ($(IGL_USERNAME),daniele)
 	IGL_WITH_MATLAB=1
 endif
 
+$(info Hello, $(IGL_USERNAME))
+
 #############################################################################
 # DEFAULTS (USUALLY TO SOMETHING THAT WORKS FOR SURE ON MAC OS X
 #############################################################################

+ 24 - 0
include/igl/ReAntTweakBar.cpp

@@ -73,6 +73,30 @@ namespace igl
   };
 }
 
+igl::ReTwBar::ReTwBar():
+ bar(NULL),rw_items(),cb_items()
+{
+}
+
+igl::ReTwBar::ReTwBar(const igl::ReTwBar & that):
+  bar(that.bar),
+  rw_items(that.rw_items),
+  cb_items(that.cb_items)
+{
+}
+
+igl::ReTwBar & igl::ReTwBar::operator=(const igl::ReTwBar & that)
+{
+  // check for self assignment
+  if(this != &that)
+  {
+    bar = that.bar;
+    rw_items = that.rw_items;
+    cb_items = that.cb_items;
+  }
+  return *this;
+}
+
 
 // BAR WRAPPERS
 void igl::ReTwBar::TwNewBar(const char *barName)

+ 78 - 18
include/igl/ReAntTweakBar.h

@@ -40,6 +40,7 @@
 
 #include <vector>
 #include <string>
+#include <cassert>
 
 namespace igl
 {
@@ -52,14 +53,37 @@ namespace igl
     std::string name;
     TwType type;
     void * var;
+    // Default constructor
     ReTwRWItem(
-      const std::string name,
-      TwType type, 
-      void *var)
+      const std::string _name,
+      TwType _type, 
+      void *_var):
+      name(_name),
+      type(_type),
+      var(_var)
     {
-      this->name = name;
-      this->type = type;
-      this->var = var;
+    }
+    // Shallow copy constructor
+    ReTwRWItem(const ReTwRWItem & that):
+      name(that.name),
+      type(that.type),
+      var(that.var)
+    {
+      // I don't think you should be using this!
+      assert(false);
+    }
+    // Shallow assignment 
+    ReTwRWItem & operator=(const ReTwRWItem & that)
+    {
+      // I don't think you should be using this!
+      assert(false);
+      if(this != &that)
+      {
+        this->name = that.name;
+        this->type = that.type;
+        this->var = that.var;
+      }
+      return *this;
     }
   };
   
@@ -67,23 +91,51 @@ namespace igl
   {
     //const char * name;
     std::string name;
+    TwType type;
     TwSetVarCallback setCallback;
     TwGetVarCallback getCallback;
     void * clientData;
-    TwType type;
+    // Default constructor
     ReTwCBItem(
-      const std::string name,
-      TwType type, 
-      TwSetVarCallback setCallback,
-      TwGetVarCallback getCallback,
-      void * clientData)
+      const std::string _name,
+      TwType _type, 
+      TwSetVarCallback _setCallback,
+      TwGetVarCallback _getCallback,
+      void * _clientData):
+      name(_name),
+      type(_type),
+      setCallback(_setCallback),
+      getCallback(_getCallback),
+      clientData(_clientData)
+    {
+    }
+    // Shallow copy
+    ReTwCBItem(const ReTwCBItem & that):
+      name(that.name),
+      type(that.type),
+      setCallback(that.setCallback),
+      getCallback(that.getCallback),
+      clientData(that.clientData)
+    {
+      // I don't think you should be using this!
+      assert(false);
+    }
+    // Shallow assignment
+    ReTwCBItem & operator=(const ReTwCBItem & that)
     {
-      this->name = name;
-      this->type = type;
-      this->setCallback = setCallback;
-      this->getCallback = getCallback;
-      this->clientData = clientData;
+      // I don't think you should be using this!
+      assert(false);
+      if(this != &that)
+      {
+        name = that.name;
+        type = that.type;
+        setCallback = that.setCallback;
+        getCallback = that.getCallback;
+        clientData = that.clientData;
+      }
+      return *this;
     }
+
   };
   
   class ReTwBar
@@ -94,9 +146,17 @@ namespace igl
     // anytime AntTweakBar functions can be called directly on the bar
     public:
       TwBar * bar;
-    private:
+    protected:
       std::vector<ReTwRWItem> rw_items;
       std::vector<ReTwCBItem> cb_items;
+    public:
+      // Default constructor with explicit initialization
+      ReTwBar();
+    private:
+      // Copy constructor does shallow copy
+      ReTwBar(const ReTwBar & that);
+      // Assignment operator does shallow assignment
+      ReTwBar &operator=(const ReTwBar & that);
   
     // WRAPPERS FOR ANTTWEAKBAR FUNCTIONS 
     public:

+ 2 - 0
include/igl/draw_mesh.h

@@ -12,7 +12,9 @@
 #    include <Windows.h>
 #    undef NOMINMAX
 #  endif
+#  define GL_GLEXT_PROTOTYPES
 #  include <GL/gl.h>
+#  include <GL/glext.h>
 #endif
 
 namespace igl