![]() |
![]() An Information Portal to Biological Macromolecular Structures |
|
PDB Home |
Contact Us ![]() |
![]() |
Software Tools Home | Dictionary Home | PDBML Home |
![]() |
#include "ISTable.h"
int ISTable::ClearColumn(int colIndex);
#include "ISTable.h"
extern void processTableColumn(ISTable &, int);
...
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"));
// clear the last column
pTable->ClearColumn(pTable->GetColumnIndex("LastColumn"));
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 ClearColumn keeps
// the column there (ONLY USE FillColumn here!!! Having a column
// smaller than it was before may lead to undesireable results. See
// "Remarks", below)
pTable->FillColumn(last_column, pTable->GetColumnIndex(
"LastColumn"));
processTableColumn(*pTable, pTable->GetColumnIndex(
"LastColumn"));
ClearColumn erases all of the data in a particular column. It does not remove the column from the table; rather, it keeps placeholders. Thus, the number of columns and rows will not change as a result of this operation.
colIndex | The index of the column to be cleared. |
A negative value indicates an error or warning.
This method may be moved to the private section, since it is too easy to misuse. FillColumn is the only method that will refill a column properly after a call to ClearColumn. The proper method for refilling a column is to use DeleteColumn and then any method to add data to a column. The other method is to use RemoveColumn followed by InsertColumn.
This method is NOT safe after index creation.
See also: | DeleteColumn |
---|---|
RemoveColumn |