Commit d7e7d8fb authored by IOhannes m zmölnig's avatar IOhannes m zmölnig
Browse files

pass complex data by const reference if possible

parent 6ef9a400
......@@ -50,7 +50,7 @@ typedef struct _GLMgroup {
GLuint material; /* index to material for group */
struct _GLMgroup* next; /* pointer to next group in model */
_GLMgroup(std::string _name, struct _GLMgroup*_next=0)
_GLMgroup(const std::string&_name, struct _GLMgroup*_next=0)
: name(_name)
, numtriangles(0)
, triangles(0)
......
......@@ -335,7 +335,7 @@ void model :: createVBO(void)
m_normal .create();
}
void model :: copyArray(const std::vector<std::vector<float> > tab,
void model :: copyArray(const std::vector<std::vector<float> >&tab,
gem::VertexBuffer&vb)
{
unsigned int size(0), i(0), npts(0);
......
......@@ -92,7 +92,7 @@ protected:
virtual void render(GemState *state);
virtual void startRendering();
void copyArray(const std::vector<std::vector<float> > tab,
void copyArray(const std::vector<std::vector<float> >&tab,
gem::VertexBuffer&vb);
void copyAllArrays();
void getVBOarray();
......
......@@ -466,7 +466,7 @@ void multimodel :: createVBO(void)
m_normal .create();
}
void multimodel :: copyArray(const std::vector<std::vector<float> > tab,
void multimodel :: copyArray(const std::vector<std::vector<float> >&tab,
gem::VertexBuffer&vb)
{
unsigned int size(0), i(0), npts(0);
......
......@@ -102,7 +102,7 @@ protected:
virtual void render(GemState *state);
virtual void startRendering();
void copyArray(const std::vector<std::vector<float> > tab,
void copyArray(const std::vector<std::vector<float> >&tab,
gem::VertexBuffer&vb);
void copyAllArrays();
void getVBOarray();
......
......@@ -79,7 +79,7 @@ public:
static HGLRC sharedContext;
Window(gemw32window*parent, HINSTANCE hInstance, int buffer,
bool fullscreen, bool border, std::string title, int &x, int &y,
bool fullscreen, bool border, const std::string&title, int &x, int &y,
unsigned int &w, unsigned int &h) :
win(NULL),
dc(NULL),
......@@ -139,7 +139,7 @@ public:
private:
static std::map<HWND, gemw32window*>s_winmap;
void create(HINSTANCE hInstance, int buffer, bool fullscreen, bool border,
std::string title, int &x, int &y, unsigned int &w, unsigned int &h)
const std::string&title, int &x, int &y, unsigned int &w, unsigned int &h)
{
DWORD dwExStyle;
DWORD style;
......
......@@ -246,7 +246,7 @@ public:
}
}
F0RPlugin(std::string name) :
F0RPlugin(const std::string&name) :
m_width(0), m_height(0),
m_instance(NULL),
m_name(""), m_author(""),
......@@ -509,7 +509,7 @@ void pix_frei0r :: processRGBAImage(imageStruct &image)
image.setCsizeByFormat(m_image.format);
}
void pix_frei0r :: parmMess(const std::string key, int argc, t_atom *argv)
void pix_frei0r :: parmMess(const std::string&key, int argc, t_atom *argv)
{
if(!m_plugin) {
error("no plugin present! forgetting parameter....");
......
......@@ -67,7 +67,7 @@ protected:
std::vector<t_inlet*>m_inlet;
void parmMess(int param, int, t_atom*);
void parmMess(const std::string param, int, t_atom*);
void parmMess(const std::string&param, int, t_atom*);
void openMess(t_symbol*name);
void closeMess(void);
......
......@@ -39,44 +39,44 @@ Blob::Blob() :
m_ymin(0.), m_ymax(0.)
{}
double Blob:: xmin()
double Blob:: xmin() const
{
return m_xmin;
}
double Blob:: xmax()
double Blob:: xmax() const
{
return m_xmax;
}
double Blob:: ymin()
double Blob:: ymin() const
{
return m_ymin;
}
double Blob:: ymax()
double Blob:: ymax() const
{
return m_ymax;
}
double Blob:: xmid()
double Blob:: xmid() const
{
return m_xaccum/m_xyaccum;
}
double Blob:: ymid()
double Blob:: ymid() const
{
return m_yaccum/m_xyaccum;
}
double Blob:: diameter2()
double Blob:: diameter2() const
{
return (m_xmax-m_xmin)*(m_xmax-m_xmin)+(m_ymax-m_ymin)*(m_ymax-m_ymin);
}
double Blob:: diameter()
double Blob:: diameter() const
{
return sqrt(diameter2());
}
double Blob:: distance2(Blob b)
double Blob:: distance2(const Blob&b) const
{
return (b.xmid()-xmid())*(b.xmid()-xmid())+(b.ymid()-ymid())*
(b.ymid()-ymid());
}
double Blob:: distance(Blob b)
double Blob:: distance(const Blob&b) const
{
return sqrt(distance2(b));
}
......
......@@ -35,17 +35,17 @@ class GEM_EXTERN Blob
public:
Blob();
double xmin();
double xmax();
double ymin();
double ymax();
double xmin() const;
double xmax() const;
double ymin() const;
double ymax() const;
double xmid();
double ymid();
double xmid() const;
double ymid() const;
// the squared diameter of the blob
double diameter2();
double diameter2() const;
// the diamter
double diameter();
double diameter() const;
double angle()
{
......@@ -59,9 +59,9 @@ public:
double orientation();
// the squared distance to another blob
double distance2(Blob b);
double distance2(const Blob&b) const;
// the distance to another blob
double distance(Blob b);
double distance(const Blob&b) const;
void xmin(double x);
void xmax(double x);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment