Commit b961d6d7 authored by Sujin Philip's avatar Sujin Philip

Fix vtkSMPThreadLocal API

Makes the constructor accepting the exemplar explicit. Marks the copy-constructor and the assignment operator private to disalow copying.
parent 97cc8760
......@@ -99,7 +99,7 @@ public:
// Constructor that allows the specification of an exemplar object
// which is used when constructing objects when Local() is first called.
// Note that a copy of the exemplar is created using its copy constructor.
vtkSMPThreadLocal(const T& exemplar) : Count(0), Exemplar(exemplar)
explicit vtkSMPThreadLocal(const T& exemplar) : Count(0), Exemplar(exemplar)
{
this->Initialize();
}
......@@ -261,6 +261,10 @@ private:
{
return kaapi_get_self_kid();
}
// disable copying
vtkSMPThreadLocal(const vtkSMPThreadLocal&);
void operator=(const vtkSMPThreadLocal&);
};
#endif
// VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
......@@ -51,7 +51,7 @@ public:
// Constructor that allows the specification of an exemplar object
// which is used when constructing objects when Local() is first called.
// Note that a copy of the exemplar is created using its copy constructor.
vtkSMPThreadLocal(const T& exemplar)
explicit vtkSMPThreadLocal(const T& exemplar)
: Backend(vtk::detail::smp::GetNumberOfThreads()), Exemplar(exemplar)
{
}
......@@ -167,6 +167,10 @@ public:
private:
detail::ThreadSpecific Backend;
T Exemplar;
// disable copying
vtkSMPThreadLocal(const vtkSMPThreadLocal&);
void operator=(const vtkSMPThreadLocal&);
};
#endif
......
......@@ -57,7 +57,8 @@ public:
// Constructor that allows the specification of an exemplar object
// which is used when constructing objects when Local() is first called.
// Note that a copy of the exemplar is created using its copy constructor.
vtkSMPThreadLocal(const T& exemplar) : NumInitialized(0), Exemplar(exemplar)
explicit vtkSMPThreadLocal(const T& exemplar)
: NumInitialized(0), Exemplar(exemplar)
{
this->Initialize();
}
......@@ -217,6 +218,10 @@ private:
{
return 0;
}
// disable copying
vtkSMPThreadLocal(const vtkSMPThreadLocal&);
void operator=(const vtkSMPThreadLocal&);
};
#endif
// VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
......@@ -104,7 +104,7 @@ public:
// Constructor that allows the specification of an exemplar object
// which is used when constructing objects when Local() is first called.
// Note that a copy of the exemplar is created using its copy constructor.
vtkSMPThreadLocal(const T& exemplar) : Count(0), Exemplar(exemplar)
explicit vtkSMPThreadLocal(const T& exemplar) : Count(0), Exemplar(exemplar)
{
this->Initialize();
}
......@@ -260,6 +260,10 @@ private:
{
return vtkSMPToolsGetThreadID();
}
// disable copying
vtkSMPThreadLocal(const vtkSMPThreadLocal&);
void operator=(const vtkSMPThreadLocal&);
};
#endif
// VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
......@@ -98,7 +98,7 @@ public:
// Constructor that allows the specification of an exemplar object
// which is used when constructing objects when Local() is first called.
// Note that a copy of the exemplar is created using its copy constructor.
vtkSMPThreadLocal(const T& exemplar) : Internal(exemplar)
explicit vtkSMPThreadLocal(const T& exemplar) : Internal(exemplar)
{
}
......@@ -194,6 +194,10 @@ public:
private:
TLS Internal;
// disable copying
vtkSMPThreadLocal(const vtkSMPThreadLocal&);
void operator=(const vtkSMPThreadLocal&);
};
#endif
// VTK-HeaderTest-Exclude: vtkSMPThreadLocal.h
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