[vtkusers] Naming of vtkObjects again!

N Smethurst nick.smethurst at free.fr
Sat May 31 13:08:22 EDT 2003


Hi again.

I made a request about naming of VTK objects. Today I noticed that 
vtkDataArray objects already have this naming functionality. My request 
has therefore changed: Would it be possible to move this naming code up 
one class from vtkDataArray into vtkObject, thereby providing naming to 
all vtkObjects and not just the data arrays?

In vtkDataArray.h, there is :

public:
  void SetName(const char* name);
  const char* GetName();
protected:
  char* Name;

and in vtkDataArray.cxx :

in constructor:
  this->Name = 0;

in destructor:
  delete[] this->Name;

void vtkDataArray::SetName(const char* name)
{
  delete[] this->Name;
  this->Name = 0;
  if (name)
    {
    int size = static_cast<int>(strlen(name));
    this->Name = new char[size+1];
    strcpy(this->Name, name);
    }
}

const char* vtkDataArray::GetName()
{
  return this->Name;
}




More information about the vtkusers mailing list