RCSB PDB Protein Data Bank A Member of the wwPDB
An Information Portal to Biological Macromolecular Structures
PDB Home | Contact Us
next up previous contents
Next: GetColumn Up: Column methods Previous: DeleteColumn

RemoveColumn

NAME RemoveColumn

PROTOTYPE

#include "ISTable.h"
int ISTable::RemoveColumn(int colIndex);

EXAMPLE

#include "ISTable.h"
...
ISTable * pTable = new ISTable();
ReVarCifArray<CifString> last_column;
CifString cs;

while (tokenizer.hasMoreTokens()) {
  cs = (char *) tokenizer.GetNextToken();
  last_column.Add(cs);
  cs.Clear();
}

pTable->InsertColumn(last_column, "LastColumn",
  pTable->GetNumColumns());

// process the last column
processTableColumn(*pTable, pTable->GetColumnIndex(
  "LastColumn"));

// erase the last column, then re-add it
pTable->RemoveColumn(pTable->GetColumnIndex("LastColumn"));
pTable->InsertColumn("LastColumn", pTable->GetNumColumns());

last_column.Clear(); // clean up array and restock with new data
while (tokenizer2.hasMoreTokens()) {
  cs = (char *) tokenizer2.GetNextToken();
  last_column.Add(cs);
  cs.Clear();
}

// fill the column again and reprocess it, since we reinserted it.
pTable->FillColumn(last_column, pTable->GetColumnIndex(
  "LastColumn"));
processTableColumn(*pTable, pTable->GetColumnIndex(
  "LastColumn"));
PURPOSE

RemoveColumn will remove the data from a column, and then remove the column itself.

RECEIVES

colIndex The index of the column to be removed.

RETURN VALUE

A negative value indicates an error or warning.

REMARKS

This method is NOT safe after index creation, but only for indices made on this column.

See also: ClearColumn
  DeleteColumn



Olivera Tosic
6/12/2002

 

© RCSB PDB